Jump to content
UBot Underground

Changing User Agent On Every Loop


Recommended Posts

I need to change my user agent frequently because Ubot crashes if I don't. I want to do change it after every sequence of events. I'm trying to EVAL an incrementing variable - if it's odd, change to Chrome. If it's even, change to Safari. I came up with this:

 

ui stat monitor("Useragent #:",#useragent)
set(#useragent,1,"Global")
loop(5) {
    if(#useragent = $eval("^(\\s*\\d*[13579]\\s*,)*(\\s*\\d*[13579]\\s*)$")) {
        then {
            set user agent("Chrome")
            alert("ODD")
        }
        else {
            set user agent("Safari")
            alert("EVEN")
        }
    }
    increment(#useragent)
}

 

This doesn't work. Is there an easier way to change a user agent?

Link to post
Share on other sites

or

set user agent("Chrome")
navigate("http://user-agent.me/","Wait")
pause script
set user agent("Safari")
navigate("http://user-agent.me/","Wait")
Link to post
Share on other sites

or

set user agent("Chrome")
load html("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>

<input type=\"text\" id=\"UserAgent\">
<script>$(\'#UserAgent\').val(navigator.userAgent);</script>")
set(#user agent,$eval("var x = document.getElementById(\'UserAgent\').value = navigator.userAgent;
x;"),"Global")
alert(#user agent)
Link to post
Share on other sites

Thanks for looking at this Pash. I know how to set a user agent, that's easy. (I already have that in my example.)  I have pauses and alerts in my example, just so I can see what's going on. Ultimately I don't want them in there. They're for testing purposes only. I want it to:

 

(start the loop)

 

1. Set user agent to Chrome.

2. do it's thing (loop)

3. Set user agent to Safari

3. do it's thing (loop)

4. etc. forever.

 

Do this with no input from me.

Link to post
Share on other sites

Thanks for looking at this Pash. I know how to set a user agent, that's easy. (I already have that in my example.)  I have pauses and alerts in my example, just so I can see what's going on. Ultimately I don't want them in there. They're for testing purposes only. I want it to:

 

(start the loop)

 

1. Set user agent to Chrome.

2. do it's thing (loop)

3. Set user agent to Safari

3. do it's thing (loop)

4. etc. forever.

 

Do this with no input from me.

try.

set(#Check,$true,"Global")
loop(5) {
    if(#Check) {
        then {
            set user agent("Chrome")
            navigate("http://user-agent.me/","Wait")
            wait for browser event("Everything Loaded","")
            wait(1)
            set(#Check,$false,"Global")
        }
        else {
            set user agent("Safari")
            navigate("http://user-agent.me/","Wait")
            wait for browser event("Everything Loaded","")
            wait(1)
            set(#Check,$true,"Global")
        }
    }
}
Link to post
Share on other sites

Woo hoo! That did it! I've never used the TRUE/FALSE type variable - till now. See what happens when you have a Photoshop expert trying to do programming? :-)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...