How to manually call (find) the ReCaptcha Callback

2019-05-28 10:35发布

问题:

I'm currently experimenting with captcha solving, and have decided to use the popular 2captcha service to do so. Their approach is to send them the recaptcha values (google recaptcha key & site thread), then they solve it and send me back the finished value that is supposed to be sent to google to check that the captcha have been solved.

I'm stuck on the last step; using the returned solved value and send it to google. As the docs https://2captcha.com/2captcha-api#callback explain, I find no "submit" button hence need to find the recaptcha callback function myself, so I can call it. I do however have a hard time finding the function since everything seems obfuscated. I explored all their methods to find a callback function but have been unable to do so. The closest I think I've been is finding the obfuscated recaptcha-en.js (located at sources>webworker.js>www.gstatic.com>recaptcha/api2/v1519325468512) https://pastebin.com/VgtJUftm which contains some callback searchwords, though due the obfuscation I don't know what to call. Tried some deobfuscation tools without luck.

So; how do I find and fire the ReCaptcha Callback function, when the recaptcha isn't hosted on my own website? Thanks in advance

回答1:

Managed to solve my problem, successfully solving captchas, though I did not manage to ever find out how to call the recaptcha callback function. After I had inserted the returned captcha solve-value into my "g-recaptcha-response" field, I simply used javascript to submit the form as described here http://www.deathbycaptcha.com/user/api/newtokenrecaptcha#how-use-token.

Selenium with Java:

    JavascriptExecutor js = (JavascriptExecutor) driver;
System.out.println("Executing js set-recaptcha-response script");
js.executeScript("document.getElementById(\"g-recaptcha-response\").innerHTML=\"" + responseToken + "\";");
System.out.println("Executing js submit-form script");
js.executeScript("document.getElementsByName('post')[0].submit();");