Jump to content
UBot Underground

New v4 Tutorial (Multi Threading Example)


Recommended Posts

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Her eis example code you can use for multi threading that is very simple to setup and use with "most" applications.   ui drop down("Thread Count", "2,3,4,5,6,7,8,9,10", #num threads) ui text box("Num

Here's a Multi Threading Example that TJ helped me with that processes a list with 3 elements per row. I originally tried to use TJ's Advanced example using Tables but found that the multi threading w

Using the above example how would I loop thru multiple list? I have a list of post I would like to run thru that are specific for each login. So user A logs in and post from user A list (schedule), th

what issues are you having?

 

My code;

ui drop down("Thread Count", "2,3,4,5,6,7,8,9,10", #num threads)
ui text box("Number of accounts", #number accounts)
set(#num created, 0, "Global")
set(#used threads, 0, "Global")
loop(#number accounts) {
    loop while($comparison(#used threads, ">=", #num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    increment(#num created)
    registration procedure()
}
define registration procedure {
    thread {
        in new browser {
            registration code here()
            decrement(#used threads)
        }
    }
}
define registration code here {
    if($comparison(#num created, "<", #number accounts)) {
        then {
            wordpress()
            myopera()
        }
        else {
        }
    }
}
define wordpress {
    navigate("https://signup.wordpress.com/signup/", "Wait")
    type text(<username field>, $account data("First Name"), "Standard")
    type text(<password field>, $account data("Password"), "Standard")
    wait(30)
}
define myopera {
    navigate("https://my.opera.com/community/signup/", "Wait")
    type text(<username field>, $account data("First Name"), "Standard")
    type text(<password field>, $account data("Password"), "Standard")
    wait(30)
}

 

 

Theard count 2

Number of accounts 1

Don't working.

 

Only 1 account created.

Link to post
Share on other sites
  • 2 weeks later...

Her eis example code you can use for multi threading that is very simple to setup and use with "most" applications.

 

ui drop down("Thread Count", "2,3,4,5,6,7,8,9,10", #num threads)
ui text box("Number of accounts", #number accounts)
set(#num created, 0, "Global")
set(#used threads, 0, "Global")
loop(#number accounts) {
    loop while($comparison(#used threads, ">=", #num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    increment(#num created)
    registration procedure()
}
define registration procedure {
    thread {
        in new browser {
            registration code here()
            decrement(#used threads)
        }
    }
}
define registration code here {
    if($comparison(#num created, "<", #number accounts)) {
        then {
            comment("PLACE YOUR CODE TO ME MULTI THREADED HERE")
        }
        else {
        }
    }
}

 

 

More advanced multi threading

Video: http://screencast.com/t/yq7RuppSDMu

 

Example code attached

 

 

This uses a login script from the bot bank, and hope you like it..

 

 

maybe you could attach the hotmail login code from the video to make it more clear TJ if you have time

Link to post
Share on other sites

This code sets the user pass, to be the same for both sites in the creation process

 

the way you had it without setting them to local variables to that defined command would mean it changes on each time the $account data is called

and would even change if you placed that to a add item to list would be different then it entered as well. (i think this is a bug) but this is a sure bet wway to use the proper data on both

 

ui drop down("Thread Count", "2,3,4,5,6,7,8,9,10", #num threads)
ui text box("Number of accounts", #number accounts)
set(#num created, 0, "Global")
set(#used threads, 0, "Global")
loop(#number accounts) {
    loop while($comparison(#used threads, ">=", #num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    increment(#num created)
    registration procedure()
}
define registration procedure {
    thread {
        in new browser {
            registration code here()
            decrement(#used threads)
        }
    }
}
define registration code here {
    if($comparison(#num created, "<", #number accounts)) {
        then {
            reset account("Any")
            set(#user, $account data("Username"), "Local")
            set(#pass, $account data("Password"), "Local")
            wordpress()
            myopera()
        }
        else {
        }
    }
}
define wordpress {
    navigate("https://signup.wordpress.com/signup/", "Wait")
    type text(<username field>, #user, "Standard")
    type text(<password field>, #pass, "Standard")
    wait(30)
}
define myopera {
    navigate("https://my.opera.com/community/signup/", "Wait")
    type text(<username field>, #user, "Standard")
    type text(<password field>, #pass, "Standard")
    wait(30)
}

 

 

 

 

Link to post
Share on other sites

This code sets the user pass, to be the same for both sites in the creation process

 

the way you had it without setting them to local variables to that defined command would mean it changes on each time the $account data is called

and would even change if you placed that to a add item to list would be different then it entered as well. (i think this is a bug) but this is a sure bet wway to use the proper data on both

 

ui drop down("Thread Count", "2,3,4,5,6,7,8,9,10", #num threads)
ui text box("Number of accounts", #number accounts)
set(#num created, 0, "Global")
set(#used threads, 0, "Global")
loop(#number accounts) {
    loop while($comparison(#used threads, ">=", #num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    increment(#num created)
    registration procedure()
}
define registration procedure {
    thread {
        in new browser {
            registration code here()
            decrement(#used threads)
        }
    }
}
define registration code here {
    if($comparison(#num created, "<", #number accounts)) {
        then {
            reset account("Any")
            set(#user, $account data("Username"), "Local")
            set(#pass, $account data("Password"), "Local")
            wordpress()
            myopera()
        }
        else {
        }
    }
}
define wordpress {
    navigate("https://signup.wordpress.com/signup/", "Wait")
    type text(<username field>, #user, "Standard")
    type text(<password field>, #pass, "Standard")
    wait(30)
}
define myopera {
    navigate("https://my.opera.com/community/signup/", "Wait")
    type text(<username field>, #user, "Standard")
    type text(<password field>, #pass, "Standard")
    wait(30)
}

 

Thanks Tj

 

ya i more wanted the actual thread controls in the loops more then the hotmail part i didnt need that only the thread control

 

increment thread

decrease thread

 

type setup you had in the video explanation

 

thanks tho

Link to post
Share on other sites

actually your explanation answered another question i had about global and local assignments to variables and or username passwords etc , to be local to the thread

 

one follow up question tho to that

 

when using local as container for variables and un/pass do we need to create extra #variable containers for each of the thread local assignments or does it store it somewhere else? and how can they be retrieved from each thread?

 

ie

 

must we create

 

#username_thread1
#username_thread2

#username_thread3

#username_thread4

 

etc...

 

for each browser thread?

 

or is that even needed but if we want to save them lets say or use them again how do we retrieve them if not stored in a local #variable container

 

sorry if its a advanced question but its been on my brain all day LOL

 

thanks

Link to post
Share on other sites
  • 2 months later...

Here's a Multi Threading Example that TJ helped me with that processes a list with 3 elements per row. I originally tried to use TJ's Advanced example using Tables but found that the multi threading was either missing rows entirely or doubling up on rows. 

This was primarily due to the fact that the table row value was incremented at the end of each cycle and is a global setting not a local setting. This allowed multiple threads to attempt to increment the table row value at the same time and resulted in almost certain misses in the processing.

Following is a complete example for Multi Threading  using lists with multiple elements per row. Thanks again to TJ for his help!

 

MultiThreading Using Lists

sourcedata.csv
A,26,z
B,25,y
C,24,x
D,23,w
E,22,v
F,21,u
G,20,t
H,19,s
I,18,r
J,17,q
K,16,p
L,15,o
M,14,n
N,13,m
O,12,l
P,11,k
Q,10,j
R,9,i
S,8,h
T,7,g
U,6,f
V,5,e
W,4,d
X,3,c
Y,2,b
Z,1,a

set user agent("Chrome")
Create Lists()
set(#num threads, 2, "Global")
set(#used threads, 0, "Global")
loop($list total(%List1)) {
    loop while($comparison(#used threads, ">=", #num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    run procedure()
}
define run procedure {
    thread {
        in new browser {
            code procedure()
            decrement(#used threads)
        }
    }
}
define code procedure {
    if($comparison(#completed rows, "<", $list total(%List1))) {
        then {
            comment("NO NEED TO CLEAR IT
THE THREAD EXITS IT CLEARS ON AUTO")
            add list to list(%local break down, $list from text($next list item(%List1), ","), "Don\'t Delete", "Local")
            set(#VariableA, $list item(%local break down, 0), "Local")
            set(#VariableB, $list item(%local break down, 1), "Local")
            set(#VariableC, $list item(%local break down, 2), "Local")
            comment("START REST OF YOUR CODE RIGHT IN HERE
THE VARIABLES ABOVE WONT SHOW
IN YOUR DEBUGGER< SAME WITH THE 
BREAK DOWN LIST -- THEY ARE LOCAL")
            add item to list(%recompile, "{#VariableB},{#VariableC},{#VariableA}", "Don\'t Delete", "Global")
        }
        else {
        }
    }
    increment(#completed rows)
}
define Create Lists {
    set(#Source, "{$special folder("Desktop")}\\Ubot\\UbotData\\", "Global")
    clear list(%List1)
    clear list(%recompile)
    add list to list(%List1, $list from file("{#Source}sourcedata.csv"), "Don\'t Delete", "Global")
    set list position(%List1, 0)
}

 

  • Like 2
Link to post
Share on other sites

I have read this post over and over. Watched the Video over and over.. I just dnt get how it works. Why does it pause ? what does making it wait the one second do ?

 

Maybe im missing something or just dont understand that logic. 

 

I have made A LOT of scripts by now using Ubot..

Almost all of them mulit threading but not one of them have i done like this. If there is anyone who thinks they could explain this a little more for me.. Like how it actually works. Not just how to do it. 

 

Sorry if this is a dumb question. Thanks in advance to everyone..

Link to post
Share on other sites

IC IC. I get it now...  So each time used threads is equal to or greater than  number of threads, the "Loop while" will continue to wait a second. When used threads falls behind number of threads. Then it will allow the "loop process" to initiate.

 

I see.. very cool. Thanks.

Link to post
Share on other sites
  • 1 month later...
  • 4 weeks later...

 

Here's a Multi Threading Example that TJ helped me with that processes a list with 3 elements per row. I originally tried to use TJ's Advanced example using Tables but found that the multi threading was either missing rows entirely or doubling up on rows. 

 

This was primarily due to the fact that the table row value was incremented at the end of each cycle and is a global setting not a local setting. This allowed multiple threads to attempt to increment the table row value at the same time and resulted in almost certain misses in the processing.

 

Following is a complete example for Multi Threading  using lists with multiple elements per row. Thanks again to TJ for his help!

MultiThreading Using Lists

sourcedata.csv
A,26,z
B,25,y
C,24,x
D,23,w
E,22,v
F,21,u
G,20,t
H,19,s
I,18,r
J,17,q
K,16,p
L,15,o
M,14,n
N,13,m
O,12,l
P,11,k
Q,10,j
R,9,i
S,8,h
T,7,g
U,6,f
V,5,e
W,4,d
X,3,c
Y,2,b
Z,1,a

set user agent("Chrome")
Create Lists()
set(#num threads, 2, "Global")
set(#used threads, 0, "Global")
loop($list total(%List1)) {
    loop while($comparison(#used threads, ">=", #num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    run procedure()
}
define run procedure {
    thread {
        in new browser {
            code procedure()
            decrement(#used threads)
        }
    }
}
define code procedure {
    if($comparison(#completed rows, "<", $list total(%List1))) {
        then {
            comment("NO NEED TO CLEAR IT
THE THREAD EXITS IT CLEARS ON AUTO")
            add list to list(%local break down, $list from text($next list item(%List1), ","), "Don\'t Delete", "Local")
            set(#VariableA, $list item(%local break down, 0), "Local")
            set(#VariableB, $list item(%local break down, 1), "Local")
            set(#VariableC, $list item(%local break down, 2), "Local")
            comment("START REST OF YOUR CODE RIGHT IN HERE
THE VARIABLES ABOVE WONT SHOW
IN YOUR DEBUGGER< SAME WITH THE 
BREAK DOWN LIST -- THEY ARE LOCAL")
            add item to list(%recompile, "{#VariableB},{#VariableC},{#VariableA}", "Don\'t Delete", "Global")
        }
        else {
        }
    }
    increment(#completed rows)
}
define Create Lists {
    set(#Source, "{$special folder("Desktop")}\\Ubot\\UbotData\\", "Global")
    clear list(%List1)
    clear list(%recompile)
    add list to list(%List1, $list from file("{#Source}sourcedata.csv"), "Don\'t Delete", "Global")
    set list position(%List1, 0)
}

 

Using the above example how would I loop thru multiple list?

I have a list of post I would like to run thru that are specific for each login.

So user A logs in and post from user A list (schedule), then post from user A list2 (tweets)

Both A list and A list2 have list like this

List A

a,b,c

d,f,g

List A2

tweet1,link1

tweet2, link2

 

So I will need to use "list items" & "next list item" some how I guess.

 

Once I start trying to post  stuff that's where everything starts to fail and I get lost in not being able to see it happen cuz it's all local.

 

I'm tired of switching variable to see if they are  working. They seem to work globally, I mean I have a non threaded version and it works. But when I try it threaded I start getting all kinds of error messages and throws me off.

 

Can someone throw up a example using this with additional list please?

 

Actually it only needs to be one additional list to loop through, I can add those two together.

  • Like 1
Link to post
Share on other sites

Yes, as stated above this bot along with many others I have waiting for multi threading,

 

I get a exceeds list error. I guess I need a list position but where?

 

Or I need to not have a clear list or it needs to be some where else. Where? I have tried at beginning of the loop, right before the loop, at the end of the loop, and right after the loop. Different places cause different errors sometimes none at all from Ubot. But then the bot does funny things. May post to one thread but not the other.

 

Or I need to "set" a list position.

 

Or some other things....

 

Or I need to make something not local and the rest local. Typically I would try to have the next list item global. The rest local.

 

Maybe I should do next list item differently, like do a "set" list position -1 or 0 depending if I use headers. What should be the standard?

 

Is it possible to make a plugin for this? There must be some sort of standard that works for most occasions or at least to get it in our busy little heads.

 

Maybe there should be a set of nodes specific to threading? Or at least have a "local debugger" along with the "Global debugger" so we can see what the heck we are doing wrong.

 

I usually have commands in a define command. Which work fine in non threaded bot. I would think just change those to local and bingo! but no first thing usually is the exceeds list which is do from clearing the list which is a global deal.

 

A side note: to those that don't know if you start changing stuff even after saving Ubot tends to NOT overwrite the changes after a bit and you will have to completely exit program and restart for your "saved" changes to actually work. So you sit there and try different nodes hit save but Ubot will act like it was never any different until you restart it. I have many of time fell into this trap. Made code change didn't work restarted and then it worked fine. So when in doubt exit out!!

 

Ok, so I step away to figure this out once and for all!!

 

I was including the clear list,list position and first add list to list in the same define as where I have the threaded commands...this is BAD.

 

Here is the example I asked for in my previous post.

 

 

set user agent("Chrome")
Create Lists()
set(#num threads, 2, "Global")
set(#used threads, 0, "Global")
loop($list total(%List1)) {
    loop while($comparison(#used threads">="#num threads)) {
        wait(1)
    }
    loop process()
}
define loop process {
    increment(#used threads)
    run procedure()
}
define run procedure {
    thread {
        in new browser {
            code procedure()
            decrement(#used threads)
        }
    }
}
define code procedure {
    if($comparison(#completed rows"<"$list total(%List1))) {
        then {
            comment("NO NEED TO CLEAR IT
THE THREAD EXITS IT CLEARS ON AUTO")
            add list to list(%local break down$list from text($next list item(%List1), ","), "Don\'t Delete""Local")
            set(#VariableA$list item(%local break down, 0), "Local")
            set(#VariableB$list item(%local break down, 1), "Local")
            set(#VariableC$list item(%local break down, 2), "Local")
            set(#VariableD$list item(%local break down, 3), "Local")
            set(#VariableE$list item(%local break down, 4), "Local")
            comment("START REST OF YOUR CODE RIGHT IN HERE
THE VARIABLES ABOVE WONT SHOW
IN YOUR DEBUGGER< SAME WITH THE 
BREAK DOWN LIST -- THEY ARE LOCAL")
            navigate("http://www.ubotstudio.com/playground/simple-form""Wait")
            wait for element(<innertext="Fake account creation form:">"""Appear")
            type text(<username field>#VariableA"Standard")
            type text(<password field>#VariableB"Standard")
            type text(<first name field>#VariableC"Standard")
            type text(<last name field>#VariableD"Standard")
            type text(<about me textarea>#VariableE"Standard")
            wait(1)
            pause script
            list2 commands()
            pause script
        }
        else {
        }
    }
    increment(#completed rows)
}
define Create Lists {
    clear list(%List1)
    clear list(%List2)
    add list to list(%List1$list from file("{$special folder("Desktop")}\\list1.csv"), "Don\'t Delete""Global")
    add list to list(%List2$list from file("{$special folder("Desktop")}\\list2.csv"), "Don\'t Delete""Global")
    set list position(%List1, 0)
    set list position(%List2, 0)
}
define list2 commands {
    add list to list(%local break down list2$list from text($next list item(%List2), ","), "Don\'t Delete""Local")
    set(#post$list item(%local break down list2, 0), "Local")
    set(#link$list item(%local break down list2, 1), "Local")
    navigate("http://www.ubotstudio.com/playground/simple-form""Wait")
    wait for element(<innertext="Fake account creation form:">"""Appear")
    type text(<about me textarea>$spin("\{{#link} {#post}|{#post} {#link}\}"), "Standard")
    wait(1)
}

 

The key was the define command "Create List" I imagine you can just repeat this as often as needed. Hmm is this where I would put my proxy list?

The pause script is there for you to see it happen just hit run to see list2 in action.

 

The list I used:

 

The path for both is on the desktop. CSV files

The contents you can make your own or use what I used.

 

list1.csv

Traffik Cop,123abc,Nick,Not Telling,I am frustrated with threading and determined to figure this out!!
Anti Guru,abc696,Jack,Jackson,I know nothing about everything, But something about nothing.

 

list2.csv

post 1,link1.com
post 2,link2.net

 

 

Now I know the where, can someone explain the why?

 

 

Thanks Dutch & TJ!! for providing original code.

 

So the next challenge would be how to multi thread the "post" themselves. Say I have 1000 post. Would I just do this Whole setup in a define where my list 2 define command is? What is a good way to do this? In shared browser insread of in new browser would be a start...How would you do it?

 

Hope this helps the rest of you!! it sure as @%&^%!! made my day when I got this...

 

TC

Link to post
Share on other sites

Ok, thats all fine and dandy if list 2 equals list 1. Back to the drawing board.

 

In the list2 define I want to loop thru list total of list 2...I'm exceeding the list again and it is just posting the first item it that list.

 

So, now where do I put the set list position and clear list?

 

list2.csv

post 1,link1.com
post 2,link2.net
post 3,link3.org
post 4,link4.mobi
post 5,link5.info

 

it just continues posting "post 1,link1.com"

 

errrghhh!!

Link to post
Share on other sites

Ok well, I think I did it.

 

Not sure how it works but it works for the moment. I might have extra something in there that may not need to be, but seems to be working.

 

define list2 commands {
    set(#list2 pos, 0, "Local")
    loop($list total(%List2)) {
        set list position(%List2#list2 pos)
        set(#list2 next item$next list item(%List2), "Local")
        add list to list(%local break down list2$list from text(#list2 next item","), "Don\'t Delete""Local")
        set(#post$list item(%local break down list2, 0), "Local")
        set(#link$list item(%local break down list2, 1), "Local")
        navigate("http://www.ubotstudio.com/playground/simple-form""Wait")
        wait for element(<innertext="Fake account creation form:">"""Appear")
        type text(<about me textarea>"{#post} {#link}""Standard")
        wait(1)
        increment(#list2 pos)
        clear list(%local break down list2)
    }
}

 

 

Any thoughts?

 

TC

  • Like 1
Link to post
Share on other sites

thats the correct way..

 

i also when using tables i dont create a table from file, i do a list and then break it down local with a comma delimiter so that i can use the data easier local then having to deal with a variable for my row

Link to post
Share on other sites

anyone having an issue with this where threads arent opening back up? for example.. im starting with 50 threads.. and after an hour if i check.. only like 10 threads will be running

Link to post
Share on other sites

LOL, wish I had a machine capable of running 50 threads!

I haven't had any problems with 15 threads running for a long time - saying that I am using TJs free memory plugin that may help I guess.

Link to post
Share on other sites

ughh this is driving me crazyyyy. yeah my machine can handle that, but its not using that many. or it does at first... but then they die down until im down to only a few threads.. 

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