Beispiel #1
0
        public static void hCaptchaSolve(this ChromiumWebBrowser Browser)
        {
            if (Browser.hCaptchaIsSolved())
            {
                return;
            }

            var Solver = new SolveCaptcha(Browser, hCaptcha: true);

            while (!Browser.hCaptchaIsSolved())
            {
                Solver.ShowDialog();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Try Solve the Captcha, And request the user help if needed.
        /// </summary>
        /// <param name="OBrowser">The Browser Instance With the Captcha</param>
        public static void ReCaptchaTrySolve(this ChromiumWebBrowser OBrowser, CaptchaSolverType SolverType = CaptchaSolverType.SemiAuto)
        {
            var Browser = OBrowser.GetBrowser();

            Browser.WaitForLoad();
            ThreadTools.Wait(1500, true);
            if (SolverType != CaptchaSolverType.Manual)
            {
                if (!Browser.ReCaptchaIsSolved())
                {
                    Point Cursor = new Point(0, 0);

                    do
                    {
                        OBrowser.ReCaptchaClickImNotRobot(out Cursor);
                        if (Browser.ReCaptchaIsSolved())
                        {
                            return;
                        }
                    } while (Browser.ReCaptchaGetBFramePosition().Y == BFrameHidden);


                    for (int i = 0; i < 3 && !Browser.ReCaptchaIsSolved(); i++)
                    {
                        try
                        {
                            if (Browser.ReCaptchaIsFailed())
                            {
                                Browser.ReCaptchaReset();
                                if (Browser.ReCaptchaIsSolved())
                                {
                                    break;
                                }
                            }
                        }
                        catch { }
                        try
                        {
                            OBrowser.ReCaptchaClickAudioChallenge(Cursor, out Cursor);
                            if (Browser.ReCaptchaIsFailed())
                            {
                                continue;
                            }
                            var Response = Browser.DecodeAudioChallenge();
                            if (Response == null)
                            {
                                continue;
                            }
                            OBrowser.ReCaptchaSolveSound(Response, Cursor, out Cursor);
                        }
                        catch (Exception ex)
                        {
                            if (!Browser.ReCaptchaIsSolved())
                            {
                                throw ex;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }

            if (Browser.ReCaptchaIsSolved())
            {
                return;
            }

            do
            {
                using (var Solver = new SolveCaptcha(OBrowser))
                    Solver.ShowDialog();
            } while (!Browser.ReCaptchaIsSolved());
        }
Beispiel #3
0
        /// <summary>
        /// Try Solve the Recaptcha v3
        /// </summary>
        /// <param name="OBrowser">The Browser with the recaptcha</param>
        /// <param name="Submit">A Event that can trigger the recaptcha</param>
        /// <param name="Validate">A Event that can confirm if the captcha is solved</param>
        public static void ReCaptchaTrySolveV3(this ChromiumWebBrowser OBrowser, Action Submit, Func <bool> Validate = null, CaptchaSolverType SolverType = CaptchaSolverType.SemiAuto)
        {
            var Browser = OBrowser.GetBrowser();

            Browser.WaitForLoad();
            Submit();
            ThreadTools.Wait(100, true);
            if (SolverType != CaptchaSolverType.Manual)
            {
                if (!Validate?.Invoke() ?? !Browser.ReCaptchaIsSolved(true))
                {
                    Point Cursor = new Point(0, 0);

                    for (int i = 0; i < 3 && !(Validate?.Invoke() ?? Browser.ReCaptchaIsSolved(true)); i++)
                    {
                        try
                        {
                            OBrowser.ReCaptchaClickAudioChallenge(Cursor, out Cursor);
                            if (Browser.ReCaptchaIsFailed())
                            {
                                Browser.ReCaptchaReset();
                                ThreadTools.Wait(500, true);
                                Submit();
                                if (!Validate?.Invoke() ?? !Browser.ReCaptchaIsSolved(true))
                                {
                                    break;
                                }
                            }
                            var Response = Browser.DecodeAudioChallenge();
                            if (Response == null)
                            {
                                continue;
                            }
                            OBrowser.ReCaptchaSolveSound(Response, Cursor, out Cursor);
                        }
                        catch (Exception ex)
                        {
                            if (!Validate?.Invoke() ?? !Browser.ReCaptchaIsSolved(true))
                            {
                                throw ex;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }

            if (Validate?.Invoke() ?? Browser.ReCaptchaIsSolved(true))
            {
                return;
            }

            do
            {
                using (var Solver = new SolveCaptcha(OBrowser, true, Submit: Submit))
                    Solver.ShowDialog();
            } while (!Validate?.Invoke() ?? !Browser.ReCaptchaIsSolved(true));
        }