Jump to content
UBot Underground

Issues With Passing Variables To Multithreded Bot


Recommended Posts

Hi,

 

Im making a bot, but im having issues with passing variables from a list to a multithreaded bot. The issues im having are several. The last version of my code is an attempt to make the bot pass the variable(email in this case) to a "optin procedure" however i dont know exactly how to do it. Ive also tried to use a increment before a new thread is started. But it doesnt seem to work, and many of the threads use the same info in from the list of emails. Please see code below (its not finished because im simply not sure how to pass a varaible to the function "optin procedure."

 

What i need addionally for this code to do is, to validate if an email is in fact successfully registered. I could use something like this to achieve that (not sure if the code is correct but im sure you guys know what im trying to do. So basically i want to take the email from the list, pass it to the function optin procedure, then in return get success of fail. If fail id like it to enter the email in a new list "failedemails". (mostly because of captcha).

Then i want to iterate the failed emails 10 times. (this will in my testing make 99% of emails sucessfully submited)

 

So first go throug all emails, place all failed in failed list, then go through second round place all still failed in list. Iterate 10 times.

 

Suggestion to see if a email was sucessfully opted in. I guess this would be placed at the end of the optin procedure.

 

 if($either($url = #thanks,$search page("Already Subscribed"))) {
                then {
                    set(#optingood,1,"Global")
                    return(#optingood)
                }
                else {
                    set(#optingood,0,"Global")
                    return(#optingood)
                }

 

Id appreciate your help alot with this, because i dont seem to be able to put it together properly. Thanks again guys.
 

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10",#num threads)
startup()
loop($list total(%emails)) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    loop process()
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#email position,0,"Local")
    set(#used threads,0,"Global")
}
define loop process {
    increment(#used threads)
    registration procedure()
}
define registration procedure {
    thread {
        in new browser {
            decrement(#used threads)
        }
    }
}
define $optin procedure(#email) {
    clear cookies
    set user agent($random list item(%useragents))
    change proxy($random list item(%proxys))
    navigate(#optin,"Wait")
    wait for browser event("Everything Loaded","")
    type text(<email field>,$list item(%emails,#email position),"Standard")
    click(<name="submit">,"Left Click","No")
    wait for browser event("Everything Loaded","")
}
Link to post
Share on other sites

non test.

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10",#num threads)
startup()
loop($list total(%emails)) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread {
        optin procedure($next list item(%emails), $random list item(%useragents), $random list item(%proxys))
        decrement(#used threads)
    }
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define optin procedure(#email, #useragents, #proxy) {
    in new browser {
        set user agent(#useragents)
        change proxy(#proxy)
        navigate(#optin,"Wait")
        wait for browser event("Everything Loaded","")
        type text(<email field>,$list item(%emails,#email position),"Standard")
        click(<name="submit">,"Left Click","No")
        wait for browser event("Everything Loaded","")
    }
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#email position,0,"Local")
    set(#used threads,0,"Global")
}

or use "thread spawn" in ubot 5

Link to post
Share on other sites

Thanks Pash, Now it works to go through the list.

 

One more thing though. Is it possible to receive back a return value from the optin procedure? either success or fail. So i can put a if statement in the optin procedure sending back success if the optin was successfull and fail if not?

 

How would i change the code?

 

Thanks again.

Link to post
Share on other sites

Thanks Pash, Now it works to go through the list.

 

One more thing though. Is it possible to receive back a return value from the optin procedure? either success or fail. So i can put a if statement in the optin procedure sending back success if the optin was successfull and fail if not?

 

How would i change the code?

 

Thanks again.

change define "optin procedure" from command to function

and use command "return" at end of define for return value

Link to post
Share on other sites

Thanks, So helpful. So i got that out of the way, now it returns correctly. If you where so kind to check also this code again. My intention was to run a loop backwards through the list with a decrement value called "cyclesleft".

When an email is successfully optin. (meaning return success) from the function "optin procedure" it will remove this "remove from list (%emails,#cyclesleft)". Running it backwards throgh list should prevent from out of range error

in list when removing line as far as i understand. However using the script now i still get errors with duplicate emails being entered at the same time in several threads. I guess this is because of the remove from list action is in each thread. Better have it outside of threads. But im not sure how to do that. Please take a look at code below. Thanks.

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100",#num threads)
startup()
define $optin procedure(#email, #useragents, #proxy) {
    in new browser {
        set user agent(#useragents)
        change proxy(#proxy)
        navigate(#optin,"Wait")
        wait for browser event("Everything Loaded","")
        type text(<email field>,#email,"Standard")
        click(<name="submit">,"Left Click","No")
        wait for browser event("Everything Loaded","")
        if($either($url = #thanks,$search page("Already Subscribed"))) {
            then {
                alert("sucess")
                return("success")
            }
            else {
                alert("failed")
                return("failed")
            }
        }
    }
}
loop(#cyclesleft) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread {
        set(#optingood,$optin procedure($list item(%emails,#cyclesleft), $random list item(%useragents), $random list item(%proxys)),"Global")
        if(#optingood = "failed") {
            then {
            }
            else {
                remove from list(%emails,#cyclesleft)
            }
        }
        decrement(#used threads)
    }
    decrement(#cyclesleft)
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#used threads,0,"Global")
    set(#cyclesleft,$subtract($list total(%emails),1),"Global")
}

Link to post
Share on other sites

I successfuly changed it so that the if statement is outside of the thread. And now all works fine with regards to the order in which the emails are entered in each thread. However now the issue is with the if statement for optin good. Which doesnt work properly since its changed in several threads at once...ahhh, its difficult to work with several threads like this...I only need it to be able to delete the success emails from the list. All rest of functionality i can handle. So if you guys could take one last quick look id appreciate it a lot.

 

Check code:

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100",#num threads)
startup()
define $optin procedure(#email, #useragents, #proxy) {
    in new browser {
        set user agent(#useragents)
        change proxy(#proxy)
        navigate(#optin,"Wait")
        wait for browser event("Everything Loaded","")
        type text(<email field>,#email,"Standard")
        click(<name="submit">,"Left Click","No")
        wait for browser event("Everything Loaded","")
        if($either($url = #thanks,$search page("Already Subscribed"))) {
            then {
                alert("sucess {#email}")
                return("success")
            }
            else {
                alert("failed {#email}")
                return("failed")
            }
        }
    }
}
loop(#cyclesleft) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread {
        set(#optingood,$optin procedure($list item(%emails,$subtract(#cyclesleft,1)), $random list item(%useragents), $random list item(%proxys)),"Global")
        decrement(#used threads)
    }
    if(#optingood = "failed") {
        then {
        }
        else {
            remove from list(%emails,$subtract(#cyclesleft,1))
        }
    }
    decrement(#cyclesleft)
    alert("Cycles Left: {#cyclesleft}")
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#used threads,0,"Global")
    set(#cyclesleft,$list total(%emails),"Global")
    alert("Cycles Left: {#cyclesleft}")
}

Edited by martinsuede
Link to post
Share on other sites

add small wait time for next thread

sample

 

before

increment(#used threads)
thread {
set(#optingood,$optin procedure($list item(%emails,$subtract(#cyclesleft,1)), $random list item(%useragents), $random list item(%proxys)),"Global")
decrement(#used threads)
}

after

increment(#used threads)
thread {
set(#optingood,$optin procedure($list item(%emails,$subtract(#cyclesleft,1)), $random list item(%useragents), $random list item(%proxys)),"Global")
decrement(#used threads)
}
wait(0.001)
Link to post
Share on other sites

Thanks again. I addedd that, but it still doesnt do the trick properly. Success emails, vs failed emails are not deleted properly from list. Many emails that where successful in if statement inside of the define $optin procedure, are still not removed from the %emails list. It seems as though there is something tricky with the threads and variables still. I can see that the list size of %emails list decrease in debugger even before the software has finished the optin predure function. So this obviosly still doesnt work properly. Any and all help to fix this is appreciated. Thanks

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100",#num threads)
startup()
define $optin procedure(#email, #useragents, #proxy) {
    in new browser {
        set user agent(#useragents)
        change proxy(#proxy)
        navigate(#optin,"Wait")
        wait for browser event("Everything Loaded","")
        type text(<email field>,#email,"Standard")
        click(<name="submit">,"Left Click","No")
        wait for browser event("Everything Loaded","")
        if($either($url = #thanks,$search page("Already Subscribed"))) {
            then {
                alert("sucess {#email}")
                return("success")
            }
            else {
                alert("failed {#email}")
                return("failed")
            }
        }
    }
}
loop(#cyclesleft) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread {
        set(#optingood,$optin procedure($list item(%emails,$subtract(#cyclesleft,1)), $random list item(%useragents), $random list item(%proxys)),"Global")
        decrement(#used threads)
    }
    wait(0.001)
    if(#optingood = "failed") {
        then {
        }
        else {
            remove from list(%emails,$subtract(#cyclesleft,1))
        }
    }
    decrement(#cyclesleft)
    alert("Cycles Left: {#cyclesleft}")
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#used threads,0,"Global")
    set(#cyclesleft,$list total(%emails),"Global")
    alert("Cycles Left: {#cyclesleft}")
}

Link to post
Share on other sites

Try this

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100",#num threads)
startup()
define $optin procedure(#useragents, #proxy, #position) {
    in new browser {
        set(#email,$list item(%emails,#position),"Local")
        set user agent(#useragents)
        change proxy(#proxy)
        navigate(#optin,"Wait")
        wait for browser event("Everything Loaded","")
        type text(<email field>,#email,"Standard")
        click(<name="submit">,"Left Click","No")
        wait for browser event("Everything Loaded","")
        if($either($url = #thanks,$search page("Already Subscribed"))) {
            then {
                alert("sucess {#email}")
                return("success")
            }
            else {
                alert("failed {#email}")
                return("failed|{#position}")
            }
        }
    }
}
set(#positionT,0,"Global")
loop(#cyclesleft) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread pro()
    decrement(#cyclesleft)
    alert("Cycles Left: {#cyclesleft}")
}
define thread pro {
    thread {
        increment(#positionT)
        set(#optingood,$optin procedure($random list item(%useragents), $random list item(%proxys), #positionT),"Local")
        decrement(#used threads)
        wait(0.001)
        if($contains(#optingood,"failed")) {
            then {
            }
            else {
                remove from list(%emails,$find regular expression(#optingood,"[0-9]\{1,3\}"))
            }
        }
    }
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#used threads,0,"Global")
    set(#cyclesleft,$list total(%emails),"Global")
    alert("Cycles Left: {#cyclesleft}")
}

Link to post
Share on other sites

Updated

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100",#num threads)
startup()
loop(#cyclesleft) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread pro()
    decrement(#cyclesleft)
    alert("Cycles Left: {#cyclesleft}")
}
define thread pro {
    thread {
        in new browser {
            set(#useragents,$random list item(%useragents),"Local")
            set(#proxy,$random list item(%proxys),"Local")
            set(#email,$next list item(%emails),"Local")
            set user agent(#useragents)
            change proxy(#proxy)
            navigate(#optin,"Wait")
            wait for browser event("Everything Loaded","")
            type text(<email field>,#email,"Standard")
            click(<name="submit">,"Left Click","No")
            wait for browser event("Everything Loaded","")
            if($either($url = #thanks,$search page("Already Subscribed"))) {
                then {
                    alert("sucess {#email}")
                    return("success")
                    remove text from list(%emails,#email,"First")
                }
                else {
                    alert("failed {#email}")
                    return("failed|{#email}")
                }
            }
            decrement(#used threads)
            wait(0.001)
        }
    }
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#used threads,0,"Global")
    set(#cyclesleft,$list total(%emails),"Global")
    alert("Cycles Left: {#cyclesleft}")
}


Link to post
Share on other sites

Updated and ran tested

ui open file("Useragents",#useragentspath)
ui open file("emails",#emailsfile)
ui open file("Proxys",#proxyspath)
ui text box("Optin",#optin)
ui text box("Thank You Page",#thanks)
ui drop down("Threads","2,3,4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100",#num threads)
ui stat monitor("cyclesleft",#cyclesleft)
ui stat monitor("emails in list",$list total(%emails))
startup()
loop(#cyclesleft) {
    loop while($comparison(#used threads,">=",#num threads)) {
        wait(1)
    }
    increment(#used threads)
    thread pro()
    decrement(#cyclesleft)
}
loop while($comparison(#used threads,">",0)) {
    wait(1)
}
define thread pro {
    thread {
        in new browser {
            the process()
            decrement(#used threads)
            wait(0.001)
        }
    }
}
define the process {
    set(#useragents,$random list item(%useragents),"Local")
    set(#proxy,$random list item(%proxys),"Local")
    set(#email,$next list item(%emails),"Local")
    set user agent(#useragents)
    change proxy(#proxy)
    navigate(#optin,"Wait")
    wait for browser event("Everything Loaded","")
    type text(<email field>,#email,"Standard")
    click(<name="submit">,"Left Click","No")
    wait for browser event("Everything Loaded","")
    wait($rand(2,4))
    if($either($comparison($url,"=",#thanks),$search page("Already Subscribed"))) {
        then {
            comment("Success")
            remove text from list(%emails,#email,"First")
        }
        else if($search page("*Thank you*")) {
            comment("Success")
            remove text from list(%emails,#email,"First")
        }
        else {
            comment("Failed")
        }
    }
}
define startup {
    clear list(%emails)
    add list to list(%emails,$list from file(#emailsfile),"Delete","Global")
define disable random make emails {
        clear list(%emails)
        loop(20) {
            reset account("Any")
            add item to list(%emails,"{$account data("Username")}{$rand(9999,999999)}@gmail.com","Don\'t Delete","Global")
        }
    }
    clear list(%useragents)
    add list to list(%useragents,$list from file(#useragentspath),"Delete","Global")
    clear list(%proxys)
    add list to list(%proxys,$list from file(#proxyspath),"Delete","Global")
    set(#used threads,0,"Global")
    set(#cyclesleft,$list total(%emails),"Global")
}
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...