Jump to content



Photo

Multi-threading multiple accts help

multiple threading log in word press update plug-in account log in account list table help

  • Please log in to reply
8 replies to this topic

#1 Chelsea

Chelsea

    Member

  • Fellow UBotter
  • PipPip
  • 13 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 07 May 2014 - 11:44 AM

So I have an excel document with a column of domains and a column of passwords for the word press account for that domain:

 

domain 1        password 1

domain 2        password 2

etc

 

I've added that excel spreadsheet to Ubot and turned it into 2 lists: %Domains and %Passwords

 

I've created a script that will navigate to the /wp-admin website extension for each domain (This may be where the problem is, not sure), log in, update plug-ins, update wp and log out. That's in a loop function that should cycle through the domain list until all of the domains' wp and plug-ins are updated.

 

...However, it loops through and continually logs into domain 1 and updates domain 1 over and over instead of logging in to domain 1 and 2, going through the loop and then logging into domains 3 and 4 (thread count is set to 2, so only 2 windows are open at once). Wondering if I should just go with a table, but I'm not sure how to make Ubot differentiate between the password and domain name in the table to log in. Thought a list would be easier. Confused.

 

Can someone check out my code and tell me what it is I've done wrong? Also, the error lists are problematic at the moment. The lists for errors are not populating as errors occur (%Unexpected Errors)...any advice on that is welcome also. Thanks!

 

define Start up {
    set user agent("Chrome")
    allow javascript("Yes")
    allow images("Yes")
    clear table(&WP Update Domains)
    create table from file("C:\\Users\\user3\\Desktop\\Bot Files\\WP Update 4.csv"&WP Update Domains)
    clear list(%Domains)
    add list to list(%Domains$plugin function("TableCommands.dll""$list from table"&WP Update Domains"Column", 0), "Delete""Global")
    clear list(%Passwords)
    add list to list(%Passwords$plugin function("TableCommands.dll""$list from table"&WP Update Domains"Column", 1), "Delete""Global")
    clear list(%Navigation Errors)
    clear list(%Log In Errors)
    clear list(%Unexpected Errors)
}
Start up()
ui drop down("Thread Count""2,3,4,5,6,7,8,9,10"#num threads)
set(#num threads, 2, "Global")
set(#used threads, 0, "Global")
loop($list total(%Domains)) {
    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 {
            navigate("{$list item(%Domains, 0)}/wp-admin""Wait")
            wait for browser event("Page Loaded""")
            if($search page("Dangerous Page")) {
                then {
                    set(#dangerous$scrape attribute(<id="address">"innertext"), "Global")
                    add item to list(%Navigation Errors#dangerous"Delete""Global")
                }
                else {
                }
            }
            type text(<username field>"admin""Standard")
            type text(<password field>$list item(%Passwords, 0), "Standard")
            click(<login button>"Left Click""No")
            wait for browser event("Everything Loaded""")
            click(<href="update-core.php">"Left Click""No")
            wait for browser event("Everything Loaded""")
            change checkbox(<id="plugins-select-all">"Checked")
            click(<id="upgrade-plugins">"Left Click""No")
            if($search page("unexpected error occurred")) {
                then {
                    set(#unexpected$scrape attribute(<innertext="/home/xut/public_html/colombopashkus.com/wp-admin/includes/update.php">"innertext"), "Global")
                    add item to list(%Unexpected Errors#unexpected"Delete""Global")
                }
                else {
                }
            }
            wait for element(<innertext="All updates have been completed.">"""Appear")
            click(<href="update-core.php">"Left Click""No")
            wait for browser event("Everything Loaded""")
            click(<id="upgrade">"Left Click""No")
            if($search page("unexpected error occurred")) {
                then {
                    set(#unexpected$scrape attribute(<innertext="/home/xut/public_html/colombopashkus.com/wp-admin/includes/update.php">"innertext"), "Global")
                    add item to list(%Unexpected Errors#unexpected"Delete""Global")
                }
                else {
                }
            }
            wait for element(<innertext="successfully">"""Appear")
            click($element offset(<login link>, 0), "Left Click""No")
            decrement(#used threads)
            code procedure()
        }
    }
}
define code procedure {
    increment(#completed rows)
    set(#completed rows$next list item(%Domains), "Global")
}
create folder("C:\\Desktop\\""WP Update Errors")
clear table(&WP Update Errors)
add list to table as column(&WP Update Errors, 0, 0, %Navigation Errors)
add list to table as column(&WP Update Errors, 0, 1, %Log In Errors)
add list to table as column(&WP Update Errors, 0, 2, %Unexpected Errors)



#2 a2mateit

a2mateit

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 1765 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 07 May 2014 - 02:29 PM

Use $next list item instead of $list item.

 

Should solve your problem.


*404 ERROR*


#3 Chelsea

Chelsea

    Member

  • Fellow UBotter
  • PipPip
  • 13 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 07 May 2014 - 02:57 PM

Yeah, I went another way with #row and then increment(#row), which should work, but I'm getting a script error now. I don't know how to make $next list item work with a table, so if you have any hints or tips to make that happen, let me know. Here's the script error and the new code, what did I do wrong?

 

Error: bad lexical cast: source type value could not be interpreted as target

Source: > WP Update > loop > loop process > run procedure > thread > thread > in new browser > navigate > $table cell

 

define Start up {
    set user agent("Chrome")
    allow javascript("Yes")
    allow images("Yes")
    clear table(&WP Update Domains)
    create table from file("C:\\Users\\user3\\Desktop\\Bot Files\\WP Update 4.csv"&WP Update Domains)
    clear list(%Navigation Errors)
    clear list(%Log In Errors)
    clear list(%Unexpected Errors)
}
Start up()
ui drop down("Thread Count""2,3,4,5,6,7,8,9,10"#num threads)
set(#num threads, 2, "Global")
set(#used threads, 0, "Global")
loop($table total rows(&WP Update Domains)) {
    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 {
            navigate("{$table cell(&WP Update Domains#row, 0)}/wp-admin""Wait")
            wait for browser event("Page Loaded""")
            if($search page("Dangerous Page")) {
                then {
                    set(#dangerous$scrape attribute(<id="address">"innertext"), "Global")
                    add item to list(%Navigation Errors#dangerous"Delete""Global")
                }
                else {
                }
            }
            type text(<username field>"admin""Standard")
            type text(<password field>$table cell(&WP Update Domains#row, 1), "Standard")
            click(<login button>"Left Click""No")
            wait for browser event("Everything Loaded""")
            click(<href="update-core.php">"Left Click""No")
            wait for browser event("Everything Loaded""")
            if($exists(<id="plugins-select-all">)) {
                then {
                    change checkbox(<id="plugins-select-all">"Checked")
                    click(<id="upgrade-plugins">"Left Click""No")
                    if($search page("unexpected error occurred")) {
                        then {
                            set(#unexpected$scrape attribute(<innertext="/home/xut/public_html/colombopashkus.com/wp-admin/includes/update.php">"innertext"), "Global")
                            add item to list(%Unexpected Errors#unexpected"Delete""Global")
                        }
                        else {
                            wait for element(<innertext="All updates have been completed.">"""Appear")
                            click(<href="update-core.php">"Left Click""No")
                            wait for browser event("Everything Loaded""")
                        }
                    }
                }
                else {
                    click(<id="upgrade">"Left Click""No")
                }
            }
            if($search page("unexpected error occurred")) {
                then {
                    set(#unexpected$scrape attribute(<innertext="/home/xut/public_html/colombopashkus.com/wp-admin/includes/update.php">"innertext"), "Global")
                    add item to list(%Unexpected Errors#unexpected"Delete""Global")
                }
                else {
                }
            }
            wait for element(<innertext="successfully">"""Appear")
            click($element offset(<login link>, 0), "Left Click""No")
            decrement(#used threads)
            code procedure()
        }
    }
}
define code procedure {
    increment(#row)
}
if("{$list item(%Log In Errors, 0)}or $list item(%Unexpected Errors, 0) or $list item(%Navigation Errors, 0)") {
    then {
        create folder("C:\\Desktop\\""WP Update Errors")
        add list to table as column(&WP Update Errors, 0, 0, %Navigation Errors)
        add list to table as column(&WP Update Errors, 0, 1, %Log In Errors)
        add list to table as column(&WP Update Errors, 0, 2, %Unexpected Errors)
        save to file("C:\\Desktop\\WP Update Errors"&WP Update Errors)
    }
    else {
    }
}

 

___________________

 

 }
if($comparison("makes feel better"">""cost")) {
    then {
        loop($either("head meet desk""fist meet monitor")) {
        }
    }
    else {
    }
}



#4 Chelsea

Chelsea

    Member

  • Fellow UBotter
  • PipPip
  • 13 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 08 May 2014 - 09:27 AM

So I figured out that the error has to do with the #row variable. I'm trying to set the variable to be any row in the table. So the increment command will mean moving from row 0 to row 1 and so on. I tried this before with lists, but there must be a way to do this with a table.

 

Domains are in column 0 of the table &WP Update Domains and Passwords are in column 1. The bot needs to navigate to the domain in column 0, row 0 and add /wp-admin to the end of the domain name to navigate to Word Press for that domain. Hence the command: navigate("{$table cell(&WP Update Domains#row, 0)}/wp-admin""Wait"). However, the variable #row isn't set correctly to do that. The password in column 1, row 0 accompanies the domain in column 0, row 0 so that's why I want to set #row, so the two fields will be filled in correctly. Sorry, that's worded kind of messily. You get it.

 

Need help figuring out how to set #row and then it should work...Hoping. Any ideas?

 

}
loop("head meet desk") {
}



#5 Chelsea

Chelsea

    Member

  • Fellow UBotter
  • PipPip
  • 13 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 08 May 2014 - 09:42 AM

Okay, think I've got the #row thing figured out: set(#row, 0, "Global")...seems like it should work. But, for whatever reason, when the bot navigates to two domains at the same time (thread count set to 2) it navigates to the same domain twice instead of 2 different domains. Do I have to increment the #row variable sooner in my script? Not sure how that's supposed to work...? 

 

Any Multiple-Threaders out there that know how to log into different accounts from the same list/table? Confused.

 

So close and yet so very very far.



#6 UBotDev

UBotDev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 1395 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 08 May 2014 - 04:01 PM

I think you need to pass #row to thread as defines parameter, and this won't happen.

 

Else you have a proper threading example here: http://www.ubotstudi...threading-fixed


CLICK UBotDev.com - Download FREE UBot Plugins!

______________________________________________

 


#7 Chelsea

Chelsea

    Member

  • Fellow UBotter
  • PipPip
  • 13 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 09 May 2014 - 07:57 AM

I think you need to pass #row to thread as defines parameter, and this won't happen.

 

Else you have a proper threading example here: http://www.ubotstudi...threading-fixed

 

Not sure quite what you mean by passing #row as a define parameter...?

 

It seems like a simple enough command: when the bot navigates to a page, it should navigate to one of the domains in the table and each time it opens a new thread or whatever, it picks the next domain in the table...seems like it should be easy enough that there have to be existing commands in Ubot to do it. Guess I'll submit a support ticket. Someone has to know how to do this.

 

Thanks for the offer of a plug-in, but I'm not sure I want to delve into that just yet.



#8 Bot-Factory (Dan)

Bot-Factory (Dan)

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 3108 posts
  • LocationEurope/Germany
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 09 May 2014 - 09:36 AM

You should first try to make your bot working without multi threading.

If that works fine you can look into multithreading.

 

A lot of stuff can not be done from within a thread. Not all ubot commands are thread safe. So when you call them from within threads you will have strange issues.

 

You have the option to add parameters to define commands. And than use that parameter as a variable within the define. It's kind of a local variable then.

 

So you send the correct value from your table to the define command. But instead from reading it from within the thread, you pass it to the thread from outside.

 

Dan


Signature-JPG.jpg


#9 Chelsea

Chelsea

    Member

  • Fellow UBotter
  • PipPip
  • 13 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 09 May 2014 - 10:12 AM

You should first try to make your bot working without multi threading.

If that works fine you can look into multithreading.

 

A lot of stuff can not be done from within a thread. Not all ubot commands are thread safe. So when you call them from within threads you will have strange issues.

 

You have the option to add parameters to define commands. And than use that parameter as a variable within the define. It's kind of a local variable then.

 

So you send the correct value from your table to the define command. But instead from reading it from within the thread, you pass it to the thread from outside.

 

Dan

 

Ok, not sure I follow you, but I get the gist. Thanks for the input! I'll try making the bot without multiple-threading and see if just a simple loop works. It'll increase the overall time for the bot to do the task, but if it works, it works. Thanks again.







Also tagged with one or more of these keywords: multiple threading, log in, word press, update, plug-in, account log in, account, list, table, help

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users