Hack Forums
[.NET] Making a bot - how do I autoclick a Javascript button? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Making a bot - how do I autoclick a Javascript button? (/showthread.php?tid=5058491)



Making a bot - how do I autoclick a Javascript button? - Datageni - Nov 15, 2015

Hello there.
I have been trying to figure this out for days and I'm completely lost. I'm in my final high school year and we have this group voting website, where we vote for the best group. The votes are based on IP, so I'm trying to make a "bot" where my script clicks the "Vote" button, then changes the IP using a proxy list, and then clicks the button again. I'm not quite sure what language I'm supposed to code this in, I'm trying VB and a couple other languages as well.

Anyways, where should I start? My very first problem is that the button is coded in Javascript, so the button link is href="javascript :void(0)". How do I generate this as an URL? Such as www.website.com/page/#void(0), or something like that. Will that work in this scenario?

Here is the website I'm trying to make a script for: http://russelaat.no/huemist-2016-01/
And this is how the vote button looks like:
[Image: 99794zo.png]

Please help me get going with this small project.
Thank you very much in advance.


* - BahNahNah - Nov 15, 2015

I whipped this up, just add proxy support and you are good to go.

Code
private static void Vote(string url)
{
     using(WebClient wc = new WebClient())
     {
         string init = wc.DownloadString(url);

         string wpv_nonce = Regex.Match(init, "\"wpv_nonce\":\"(.*)\"").Groups[1].Value;
         string postID = Regex.Match(init, "class=\"postID\" value=\"(.*)\"").Groups[1].Value;
         string userID = Regex.Match(init, "class=\"userID\" value=\"(.*)\"").Groups[1].Value;
         string authorID = Regex.Match(init, "class=\"authorID\" value=\"(.*)\"").Groups[1].Value;

         NameValueCollection post = new NameValueCollection();
         post.Add("action", "wpv-submit");
         post.Add("wpv_nonce", wpv_nonce);
         post.Add("postID", postID);
         post.Add("userID", userID);
         post.Add("authorID", authorID);

         wc.UploadValues("http://russelaat.no/wp-admin/admin-ajax.php", post);
     }
}

Usage:
Code
Vote("http://russelaat.no/huemist-2016-01/");


Edit: It would be more efficient to just get the "init" request once, then use the values from it for each vote request( i guess the values would always be the same for the page).


* - Datageni - Nov 15, 2015

(Nov 15, 2015 05:29 AM)BahNahNah Wrote:  -snip-

I'll give it a go and try it out when I get home. I'll keep you posted and let you know how it goes.