Jump to content
UBot Underground

Random User Agent (psuedo library)


Recommended Posts

Here's another psuedo library file. Please refer to this for the basic concept of the psuedo library along with file structure.

 

http://www.ubotstudio.com/forum/index.php?/topic/10970-using-hma-and-auto-verifying-ip-change/

 

So the premise here, is making another exe we can call on to do something that we need to do often. In this case, we're going to use it for a random user agent. When creating user accounts (xx-x,xxx) on one site, it's probably dumb to do it showing the same user agent. A lot of people are looking for random user agent codes, well this one mimics (almost) what the odds are someone will be using browser x,y,z.

 

I based the numbers off the following.

 

http://www.w3schools.com/browsers/browsers_stats.asp

Make sure you have a main folder with a folder entitled 'data', and add a new blank notepad document in data called agent.

 

Next open up a new ubot file, save it as "random_agent" in the main folder (first link shows the folder structure).

 

First line of code is the onload feature from kreatus since we want it to run immediately when opened.

 

ui stat monitor("<script type=\"text/javascript\">
   window.onload = ubot.runScript(\'random_agent()\')
</script>", "")

Next is the define with everything in it. I've added the user agents even though they don't do anything for us, at the bottom of the page I've put a version without them.

 

define random_agent {
   delete file("{$special folder("Application")}\\data\\agent.txt")
   set(#agent, $rand(1, 969), "Global")
   if($comparison(#agent, "<=", 167)) {
       then {
           set user agent("Internet Explorer 10")
           save to file("{$special folder("Application")}\\data\\agent.txt", 1)
       }
       else {
           if($comparison(#agent, "<=", 511)) {
               then {
                   set user agent("Firefox 6")
                   save to file("{$special folder("Application")}\\data\\agent.txt", 2)
               }
               else {
                   if($comparison(#agent, "<=", 928)) {
                       then {
                           set user agent("Chrome")
                           save to file("{$special folder("Application")}\\data\\agent.txt", 3)
                       }
                       else {
                           if($comparison(#agent, "<=", 969)) {
                               then {
                                   set user agent("Safari")
                                   save to file("{$special folder("Application")}\\data\\agent.txt", 4)
                               }
                               else {
                               }
                           }
                       }
                   }
               }
           }
       }
   }
   shell("cmd.exe /c \"taskkill /im random_agent.exe /f\"")
}

First thing it does is set the variable to a number between 1-969, then compares that number against the percents from w3's site. It should be noted that I did not include opera since ubot doesn't offer it as a user agent. After it evaluates the variable (1-969) it creates a text file in the data folder with a number 1-4 then self terminates. So save, and compile to the main folder as random_agent.exe.

 

Now its time for the snippet we use whenever we want to call on it to generate us a new user agent.

 

define Agent {
   shell("{$special folder("Application")}\\random_agent.exe")
   wait(5)
   set(#agent, $read file("{$special folder("Application")}\\data\\agent.txt"), "Global")
   if($comparison(#agent, "=", 1)) {
       then {
           set user agent("Internet Explorer 10")
       }
       else {
           if($comparison(#agent, "=", 2)) {
               then {
                   set user agent("Firefox 6")
               }
               else {
                   if($comparison(#agent, "=", 3)) {
                       then {
                           set user agent("Chrome")
                       }
                       else {
                           if($comparison(#agent, "=", 4)) {
                               then {
                                   set user agent("Safari")
                               }
                               else {
                               }
                           }
                       }
                   }
               }
           }
       }
   }
}

 

Now whenever this code is ran, it'll run the random_agent.exe to generate us a new user agent based on odds.

 

Like the hma, the exe needs to be in the main folder of the program you're working with along with the data folder.

 

Here's the edited/non demo version of the random_agent without the user agents showing.

 

define random_agent {
   delete file("{$special folder("Application")}\\data\\agent.txt")
   set(#agent, $rand(1, 969), "Global")
   if($comparison(#agent, "<=", 167)) {
       then {
           save to file("{$special folder("Application")}\\data\\agent.txt", 1)
       }
       else {
           if($comparison(#agent, "<=", 511)) {
               then {
                   save to file("{$special folder("Application")}\\data\\agent.txt", 2)
               }
               else {
                   if($comparison(#agent, "<=", 928)) {
                       then {
                           save to file("{$special folder("Application")}\\data\\agent.txt", 3)
                       }
                       else {
                           if($comparison(#agent, "<=", 969)) {
                               then {
                                   save to file("{$special folder("Application")}\\data\\agent.txt", 4)
                               }
                               else {
                               }
                           }
                       }
                   }
               }
           }
       }
   }
   shell("cmd.exe /c \"taskkill /im random_agent.exe /f\"")
}

  • Like 2
Link to post
Share on other sites
  • 1 month later...
  • 4 months later...

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...