Jump to content
UBot Underground

How To Use Multi-Threading With This?


Recommended Posts

Hey guys,

I've never used multi-threading before. Wanted to experiment with it and used another example from TJ here in the forums and just tried to copy over my
code and mix n match and it created a TON of errors so I cleaned up the code again and took out the crap I came up with :)

Can anyone fix this and make it multi-threaded so I have an idea of how to do it?

on load("Bot Loaded") {
    plugin command("Advanced Ubot.dll", "hide menu strip (this app)", "True")
    clear cookies
}
set(#currently doing,"idle..","Global")
ui text box("Bitly Username",#login)
ui text box("Bitly API Key",#apikey)
ui text box("Insert URL Here (Only use www.domain.com )",#url)
ui button("Start") {
    plugin command("Advanced Ubot.dll", "main button click", "Run")
}
ui stat monitor("<b>Status:</b>",#currently doing)
set(#currently doing,"Downloading User Agents","Global")
download file("http://techpatterns.com/downloads/firefox/useragentswitcher.xml","{$special folder("Application")}\\useragentswitcher.xml")
wait(1)
clear list(%Useragents)
clear list(%linkinjectionsites)
add list to list(%Useragents,$list from text($find regular expression($read file("{$special folder("Application")}\\useragentswitcher.xml"),"(?<=useragent=\").*?(?=\")"),"
"),"Delete","Global")
set(#currently doing,"Saving User Agents","Global")
save to file("{$special folder("Application")}\\Useragents.txt",%Useragents)
set(#currently doing,"Picking Random User Agent","Global")
set(#user_agent,$random list item($list from file("{$special folder("Application")}\\Useragents.txt")),"Global")
clear list(%newlycreatedbitlys)
add list to list(%linkinjectionsites,$list from text("http://sthm.temple.edu/tellafriend.php?url={#url}
http://sunsite3.berkeley.edu:9876/help/urlstatusgo.html?col=staff&url={#url}
http://ucblibrary3.berkeley.edu:9876/help/urlstatusgo.html?col=library&url={#url}
http://bernco.gov:8765/help/urlstatusgo.html?col=myindex&url={#url}
http://www.cathedralcity.gov/redirect.aspx?url={#url}
http://cherokeecounty-nc.gov/redirect.aspx?url={#url}
http://www.evansville.in.gov/redirect.aspx?url={#url}
http://transtats.bts.gov/exit.asp?url={#url}",$new line),"Delete","Global")
set(#currently doing,"Creating Bitly\'s","Global")
loop($list total(%linkinjectionsites)) {
    set(#returnedbitlylink,$BITLY SHORTEN URL($next list item(%linkinjectionsites)),"Global")
    add item to list(%newlycreatedbitlys,#returnedbitlylink,"Delete","Global")
}
set(#currently doing,"Creating TinyURLs","Global")
loop($list total(%linkinjectionsites)) {
    set(#returnedtinyurllink,$TinyURL($next list item(%linkinjectionsites)),"Global")
    add item to list(%newlycreatedbitlys,#returnedtinyurllink,"Delete","Global")
}
set(#currently doing,"Creating Is.gd Links","Global")
loop($list total(%linkinjectionsites)) {
    set(#returnedIsgdlink,$Isgd SHORTEN URL($next list item(%linkinjectionsites)),"Global")
    wait(1)
    add item to list(%newlycreatedbitlys,#returnedIsgdlink,"Delete","Global")
}
define $BITLY SHORTEN URL(#DEF URL) {
    return($trim($read file("http://api.bitly.com/v3/shorten?login={#login}&apiKey={#apikey}&longUrl={$plugin function("SocketCommands.dll", "$url encode", #DEF URL)}&format=txt")))
}
define $Isgd SHORTEN URL(#DEF URL) {
    return($trim($read file("http://is.gd/create.php?format=simple&url={$plugin function("SocketCommands.dll", "$url encode", #DEF URL)}")))
}
define $TinyURL(#DEF URL) {
    return($trim($read file("http://tinyurl.com/api-create.php?url={$plugin function("SocketCommands.dll", "$url encode", #DEF URL)}")))
}
set(#currently doing,"Finished","Global")
save to file("{$special folder("Desktop")}\\Bitlys.txt",%newlycreatedbitlys)
alert("Bitly Links Saved To Desktop (Bitlys.txt)")

Link to post
Share on other sites

I had an example by TJ that looked easy enough but after adding it to my bot and moving code around I was left with a ton

of errors. :/

Link to post
Share on other sites

I had an example by TJ that looked easy enough but after adding it to my bot and moving code around I was left with a ton

of errors. :/

There are two parts to muiltithreading.

 

1. The management and control of the threads. Starting the threads and monitoring when threads are closed

2. Making your code thread ready. It has to run within defines. Every define has to have all the data within the define to work properly. 

Reading and wring global variables, lists and tables can be a problem. 

 

Dan

Link to post
Share on other sites

Hi,

 

Here is a simple multi thread sample. Threading your program will not be easy. Trying to keep the shortened urls together and in order with the url used to generate them.

ui text box("threads", #threads)
ui text box("cycles", #cycles)
set(#theadcount, 0, "Global")
set(#cyclecount, 0, "Global")
loop(#cycles) {
    loop(#threads) {
        loop while($comparison(#theadcount, ">=", #threads)) {
            wait(1)
        }
        increment(#theadcount)
        thread {
            in new browser {
                navigate("http://www.ubotstudio.com/playground/simple-form", "Wait")
                wait for browser event("Everything Loaded", "")
                reset account("Any")
                type text(<username field>, "{$account data("First Name")}{$account data("Last Name")}", "Standard")
                type text(<first name field>, $account data("First Name"), "Standard")
                type text(<password field>, $account data("Password"), "Standard")
                click(<value="Submit">, "Left Click", "No")
                wait for browser event("Everything Loaded", "")
                wait(3)
            }
            decrement(#theadcount)
        }
    }
    increment(#cyclecount)
}
wait(30)
stop script

sample-thread-006.ubot

 

Kevin

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