Jump to content
UBot Underground

Chelsea

Fellow UBotter
  • Content Count

    13
  • Joined

  • Last visited

Posts posted by Chelsea

  1. As promised, the solution:

     

         clear list(%Navigation Errors)
         clear list(%Log In Errors)

         if($search page("<h2 class=\"status_title sign_dangerous\" id=\"lbl_status\">Dangerous Page</h2>")) {
             then {
                 add list to list(%Navigation Errors$scrape attribute(<id="address">"innertext"), "Delete""Global")
                 alert("Navigation Error")
             }
             else {
             }
         }

         if($search page("<div id=\"login_error\">")) {
             then {
                 alert("Log In Failed")
                 add list to list(%Log In Errors$scrape attribute(<title="Are you lost?">"innertext"), "Delete""Global")
             }
             else {
             }
         }

         if("{$list item(%Log In 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)
                 save to file("C:\\Desktop\\WP Update Errors"&WP Update Errors)
             }
             else {
             }
         }

     

    Forgot about this a bit, apologies. Hopefully that helps someone. 

    • Like 1
  2. 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.

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

  4.  

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

     

    What did you set #completed rows to? And why do you have that if($comparison... bit at the end? What are variables A, B and C for? If you get rid of that bit of code, would the loop process still work correctly?

     

    Need help figuring out how to do this but with a table instead of a list, so I'm looking to set a #row variable and make it increment that after completing a loop, but it won't work. Help, please!

  5. What is the difference between these 3 options and when do you use them? 

     

    Problem I'm having: need to scrape an attribute from a page for multiple accounts, but with the same script, how do you do this? If there's a log in error, need to scrape the domain name that is having the error and add it to a list to send to the user so they know there's been a log in error for that domain.

     

    When I do something simple like $scrape attribute(href"http://www.domain.com") the href area populates with the specific domain in the script that has the log in error. So, when another domain using the same script has an error, that adds a blank item to the list (because it's looking for an exact match to that domain in the script--which isn't there). It's nice to know there are errors, but not knowing which domains of hundreds have errors is not awesome. Kind of defeats the purpose of the bot.

     

    Can you move the wildcard function around in the code so it reads something like $scrape attribute(href="w") or something so it grabs whatever is in place of the w? Is that how it even works? Do I need to figure out a regular expression for this? Any suggestions as to how to do that?

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

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

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

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

  10. So, now I'm breaking the errors down into two steps so the user knows which error occurred (either a navigation to site error or a log in error) and this is what I have so far:

     

     }
    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")
                        alert("Navigation Error with domain(s): {$list item(%Errors, 0)}")
                    }
                    else {
                    }
                }

     

    So, it pops up an alert to the user saying there was a navigation error to a specific domain, which works (at least on the one example I tried).

     

    Then I'll just have the program spit out an excel document at the end with all the errors, but I'm not sure how to accomplish that just yet. I'll post it if I figure it out. Create a list of Navigation errors and a list of Log in errors, make one list a column in a table in position 0 and the other a column in position 1, create folder on desktop, save to file...seems easy enough, just haven't worked out the details yet. I'll give it a go. If you have ideas on this, or a sample code from something you've done that's similar, that'd help me significantly! 

     

    Anyone have any advice on this error alert message business? Or any idea how to solve the problem from earlier? New at this. Any advice is welcome. Especially if you know how to make this loop/multiple threading thing work. I think I get the basics, but would welcome any pointers or corrections to my code.

     

    Thanks!

  11. you could use an if else along with the part where it looks for the words.

     

    The else if could be something like checking if an element exists after the logon, or something that will only show up on success.

     

    What would happen if the website didn't work? put that as the else if.

     

    Thanks for the post!

     

    I understand what you're saying, but I'm not sure how to make the alert do what I want if the website doesn't work. I have the search page command looking for "error" which pops up if the log in fails or "dangerous" which pops up if the site can't be navigated to directly do to a firewall or something. So, I get how to make it alert me if there is an error. I just don't understand how to make it tell me which specific domain error-ed out.

     

    If the bot finds "error" or "dangerous" it should send me an alert saying: "Error with domain: [domain]". The domain in brackets is what I can't figure out. Any ideas?

     

    The problem is, I have a list of hundreds of domains that I'm tying to update in word press, so I want to be able to dump them all into a spreadsheet and click run on this bot. The bot will have to send me an error if one of the domains doesn't log in properly to word press or I'll have to sift through all of those domains to find the one that didn't update...which would defeat the purpose of the bot a little. 

     

    Once again, thanks for the response!

  12. Looking to create an error alert that returns the account that failed to log in. Trying to create a bot that updates word press. Here's the code so far:

     

    define Start up {
        set user agent("Chrome")
        allow javascript("Yes")
        allow images("Yes")
        clear table(&WP Update Domains)
        create table from file("C:\\randomfile.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")
    }
    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("{$list item(%Domains, 0)}/wp-admin""Wait")
                type text(<username field>"admin""Standard")
                type text(<password field>$list item(%Passwords, 0), "Standard")
                click(<login button>"Left Click""No")
                wait(3)
                if($either($search page("error"), $search page("dangerous"))) {
                    then {
                        alert("Error with domain: {$list item(%Domains, 0)}")
                    }
                    else {
                    }
                }
            }
        }
    }
    code procedure()
    decrement(#used threads)

     

    So, basically, I don't know how to make it send the alert to the user that a specific domain didn't log in properly, or couldn't get to the log in for some reason and then continue with the loop on to the next item. As of right now, I'm sure it will just return the first item in the list indiscriminately if it finds either of those words on the page. If anyone can help, that'd be appreciated. Of course, any other tips are welcome as well. Obviously new at this. Thanks!

×
×
  • Create New...