public async Task Start()
        {
            Console.Title = "H";
            HCaptcha captcha = new HCaptcha("https://dashboard.hcaptcha.com/signup", false, true);
            await captcha.SolveCaptcha();

            Console.ReadKey();
        }
Exemplo n.º 2
0
        public async Task TestAllOptions()
        {
            HCaptcha captcha = new HCaptcha();

            captcha.SetSiteKey("f1ab2cdefa3456789012345b6c78d90e");
            captcha.SetUrl("https://www.site.com/page/");

            var parameters = new Dictionary <string, string>();

            parameters["method"]  = "hcaptcha";
            parameters["sitekey"] = "f1ab2cdefa3456789012345b6c78d90e";
            parameters["pageurl"] = "https://www.site.com/page/";

            await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
        }
Exemplo n.º 3
0
        public void Main()
        {
            TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");

            HCaptcha captcha = new HCaptcha();

            captcha.SetSiteKey("10000000-ffff-ffff-ffff-000000000001");
            captcha.SetUrl("https://www.site.com/page/");

            try
            {
                solver.Solve(captcha).Wait();
                Console.WriteLine("Captcha solved: " + captcha.Code);
            }
            catch (AggregateException e)
            {
                Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// HCaptcha
        /// </summary>
        /// <param name="hCaptcha">Модель параметров</param>
        /// <param name="sleep">Время задержки получения ответа</param>
        /// <returns></returns>
        public Response HCaptcha(HCaptcha hCaptcha, int sleep = 2000)
        {
            var response = _request.Get(_urlIn, hCaptcha.ToString());

            return(Check(new Check(response.Request, sleep: sleep)));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Решение капчи hCaptcha
        /// </summary>
        /// <param name="hCaptcha">Модель данных</param>
        /// <param name="sleep">Задержка получения ответа</param>
        /// <returns></returns>
        public TaskResultResp HCaptcha(HCaptcha hCaptcha, int sleep = 4000)
        {
            var create = CreateTask(new CreateTask(hCaptcha));

            return(GetResult(create, sleep));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Get(
            [FromServices] RedisEventTool redisEventTool,
            int setId,
            [FromQuery(Name = "k")] string key,
            [FromQuery(Name = "nv")] bool noVideo,
            [FromQuery(Name = "s")] DownloadState state)
        {
            if (key == null)
            {
                return(StatusCode(StatusCodes.Status401Unauthorized,
                                  new APIError
                {
                    Code = ErrorCode.InvalidKey,
                    Message = "The given key is invalid..."
                }));
            }

            if (state == DownloadState.None)
            {
                return(StatusCode(StatusCodes.Status400BadRequest,
                                  new APIError
                {
                    Code = ErrorCode.InvalidState,
                    Message = "State cannot be none"
                }));
            }

            switch (state)
            {
            case DownloadState.HCaptcha:
                var verified = await HCaptcha.VerifyAccessToken(key);

                Console.WriteLine(verified);

                if (!verified)
                {
                    return(StatusCode(StatusCodes.Status401Unauthorized,
                                      new APIError
                    {
                        Code = ErrorCode.InvalidKey,
                        Message = "The given key is invalid... (HCaptcha Failure)"
                    }));
                }

                var response = await redisEventTool.DownloadBeatmap(new DownloadMapRequest
                {
                    SetId   = setId,
                    NoVideo = noVideo
                });

                if (response == null || response.IpfsHash == "")
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError,
                                      new APIError
                    {
                        Code = ErrorCode.DownloadFailed,
                        Message = "For some unknown reason, we couldn't download the beatmap. This incidence has been reported."
                    }));
                }

                return(Redirect($"https://ipfs.chimu.moe/{response.IpfsHash}?filename={response.File}"));
            }

            return(Ok("Yes"));
        }