Jump to content
UBot Underground

Recommended Posts

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)

Link to post
Share on other sites

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 {
    }
}

Link to post
Share on other sites

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") {
}

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.ubotstudio.com/forum/index.php?/topic/15441-free-plugin-threads-counter-ubot-v4-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.

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

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