Jump to content
UBot Underground

Recommended Posts

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!

Link to post
Share on other sites

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.

Link to post
Share on other sites

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!

Link to post
Share on other sites

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!

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

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