-
For bypassing the same page with requests using our captcha solver, code is very similar
Console.WriteLine("[+] Getting sitekey from test page...");
string resp = get(TEST_PAGE_INVISIBLE); // download page first (to get sitekey)
HtmlDocument d = new HtmlDocument();
d.LoadHtml(resp);
// get sitekey
string site_key = d.DocumentNode.SelectSingleNode("//button").GetAttributeValue("data-sitekey", "");
Console.WriteLine(string.Format("[+] Site key: {0}", site_key));
// complete captcha
Console.WriteLine("[+] Waiting for recaptcha to be solved ...");
ImageTypersAPI i = new ImageTypersAPI(IMAGETYPERS_TOKEN);
Dictionary p = new Dictionary();
p.Add("page_url", TEST_PAGE_NORMAL);
p.Add("sitekey", site_key);
p.Add("type", "2");
string recaptcha_id = i.submit_recaptcha(p); // submit recaptcha info
// while in progress, sleep for 10 seconds
while (i.in_progress(recaptcha_id)) { Thread.Sleep(10000); }
string g_response_code = i.retrieve_captcha(recaptcha_id);
//Console.Write("CODE:"); Console.ReadLine(); string g_response_code = File.ReadAllText("g-response.txt"); // get manually
Console.WriteLine(string.Format("[+] Got g-response-code: {0}", g_response_code));
// create post request data
string data = string.Format(
"username=my-username&" +
"password=password-here&" +
"g-recaptcha-response={0}",
g_response_code);
// submit
string response = post(TEST_PAGE_REQUESTS_VERIFY, data);
Console.WriteLine(string.Format("[+] Response: {0}", response));
- Very similar to the normal reCAPTCHA submission with requests. Main difference is that the submisison to our captcha service has to be with type set to 2
- The other difference is that the sitekey is gathered from a button and not div
We have examples to bypass normal recaptcha and invisible recaptcha in both C# and Python. Each language has 4 ways of completing the captcha, and that is:
-
Browser (selenium) normal reCAPTCHA v2
-
Requests normal reCAPTCHA v2
-
Browser invisible reCAPTCHA
-
Requests invisible reCAPTCHA