Ejemplo n.º 1
0
        /// <summary>
        /// reCAPTCHA v2 automation with browser
        /// </summary>
        private void browser_recaptchav2()
        {
            Console.WriteLine("[+] reCAPTCHA v2 automation with browser");
            Console.WriteLine("---------------------------------");
            Console.WriteLine("[+] Starting browser");
            string url = "https://bestcaptchasolver.com/automation/recaptcha-v2";

            using (var b = new ChromeDriver())
            {
                Console.WriteLine("[+] Navigating to reCAPTCHA page");
                b.Navigate().GoToUrl(url);
                Console.WriteLine("[+] Completing fields of form");
                b.FindElementById("username").SendKeys("recaptcha-browser-user-123");
                string site_key = b.FindElementByClassName("g-recaptcha").GetAttribute("data-sitekey");
                Console.WriteLine("[+] Submitting page_url with site_key to bestcaptchasolver");
                var opts = new Dictionary <string, string>();
                opts.Add("page_url", url);
                opts.Add("site_key", site_key);

                // submit to bcs for solving
                var id = bcs.submit_recaptcha(opts);
                Console.WriteLine(string.Format("[+] Got ID {0}, waiting for completion...", id));
                string gresponse = "";
                while (gresponse == "")
                {
                    gresponse = bcs.retrieve(id)["gresponse"];
                    if (gresponse != "")
                    {
                        break;                         // get out if not null
                    }
                    Thread.Sleep(5000);
                }
                Console.WriteLine(string.Format("[+] Response from bestcaptchasolver.com: {0}", gresponse));
                IJavaScriptExecutor js = (IJavaScriptExecutor)b;
                js.ExecuteScript("$(\"#g-recaptcha-response\").val(\"" + gresponse + "\")");
                Console.WriteLine("[+] Submitting form");
                b.FindElementById("automation_submit").Click();       // submit form
                Console.WriteLine("[+] Form submitted !");
                Thread.Sleep(SLEEP * 1000);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// reCAPTCHA solving
        /// </summary>
        static void test_recaptcha()
        {
            string page_url = "PAGE_URL_HERE";
            string site_key = "SITE_KEY_HERE";

            // account balance
            string balance = bcs.account_balance();

            Console.WriteLine(string.Format("Balance: {0}", balance));

            Console.WriteLine("Solving recaptcha ...");
            var rd = new Dictionary <string, string>();

            rd.Add("page_url", page_url);
            rd.Add("site_key", site_key);

            // other parameters
            // ----------------------------------------------------------------------
            // reCAPTCHA type(s) - optional, defaults to 1
            // ---------------------------------------------
            // 1 - v2
            // 2 - invisible
            // 3 - v3
            // 4 - enterprise v2
            // 5 - enterprise v3
            //
            // rd.Add("type", "1");
            //
            // rd.Add("v3_action", "home");    // action used when solving v3 reCaptcha
            // rd.Add("v3_min_score", "0.3");  // min score to target when solving v3
            // rd.Add("data_s", "recaptcha data-s parameter used in loading reCAPTCHA");  // optional
            // rd.Add("cookie_input", "a=b;c=d");  // used in solving reCAPTCHA, optional
            // rd.Add("proxy", "user:[email protected]:301");     // proxy with/out authentication
            // rd.Add("affiliate_id", "get it from /account");

            string id        = bcs.submit_recaptcha(rd);
            string gresponse = "";

            while (gresponse == "")
            {
                gresponse = bcs.retrieve(id)["gresponse"];
                Thread.Sleep(5000);
            }
            Console.WriteLine(string.Format("Gresponse: {0}", gresponse));
            // var proxy_status = bcs.retrieve(id)["proxy_status"];
            // bcs.set_captcha_bad(id);      // set captcha as bad
        }