Exemple #1
0
        static public void Main(string[] argv)
        {
            string dbcUsername = argv[0], dbcPassword = argv[1];

            // Put your DBC username & password here.
            //Client client = (Client)new HttpClient(dbcUsername, dbcPassword);
            Client client = (Client) new HttpClient(dbcUsername, dbcPassword);

            Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);

            for (int i = 2, l = argv.Length; i < l; i++)
            {
                Console.WriteLine("Solving CAPTCHA {0}", argv[i]);

                // Upload a CAPTCHA and poll for its status.  Put the CAPTCHA
                // image file name, file object, stream, or a vector of bytes,
                // and desired solving timeout (in seconds) here:
                client.Decode(new DecodeDelegate(ExampleAsync.Decoded),
                              argv[i],
                              Client.DefaultTimeout);
                ExampleAsync._ready.WaitOne();
            }

            Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);
        }
        private static async Task <SolvedCaptcha> CrackCaptcha(DeathByCaptcha.Client dbc_client, HttpClient client, string content)
        {
            var recaptcha_id = content.Split(new string[] { "Recaptcha.create(\"" }, StringSplitOptions.None)[1]
                               .Split('\"')[0]
                               .Trim();

            var challenge_response =
                await client.GetStringAsync("https://www.google.com/recaptcha/api/challenge?k=" + recaptcha_id);

            Regex regexChallenge = new Regex("challenge : '(.*)'");
            var   match          = regexChallenge.Match(challenge_response);

            if (!match.Success)
            {
                return(null);
            }

            var recaptcha_challenge = match.Groups[1].Value;

            var image_response =
                await client.GetByteArrayAsync("https://www.google.com/recaptcha/api/image?c=" + recaptcha_challenge);

            if (image_response == null)
            {
                return(null);
            }

            Captcha captcha = dbc_client.Decode(image_response);

            if (captcha.Solved && captcha.Correct)
            {
                SolvedCaptcha solved = new SolvedCaptcha();
                solved.captcha   = captcha;
                solved.challenge = recaptcha_challenge;

                return(solved);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
        static public void Main(string[] argv)
        {
            string dbcUsername = argv[0], dbcPassword = argv[1];

            // Put your DBC username & password here.
            //Client client = (Client)new HttpClient(dbcUsername, dbcPassword);
            Client client = (Client) new HttpClient(dbcUsername, dbcPassword);

            Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);

            for (int i = 2, l = argv.Length; i < l; i++)
            {
                Console.WriteLine("Solving CAPTCHA {0}", argv[i]);

                // Upload a CAPTCHA and poll for its status.  Put the CAPTCHA
                // image file name, file object, stream, or a vector of bytes,
                // and desired solving timeout (in seconds) here.  If solved,
                // you'll receive a DeathByCaptcha.Captcha object.
                Captcha captcha = client.Decode(argv[i], Client.DefaultTimeout);

                /*
                 * //Uploading captchas with type = 2 (Coordinates API)
                 * Captcha captcha = client.Decode(argv[i], Client.DefaultTimeout,
                 * new Hashtable (){
                 * { "type", 2 }
                 * });
                 *
                 * //Uploading captchas with type = 3 (Image Group API)
                 * Captcha captcha = client.Decode(argv[i], Client.DefaultTimeout,
                 * new Hashtable (){
                 *      { "type", 3 },
                 *      { "grid", "2x4" }, //optional grid parameter
                 *      {"banner_text", "Select all images with meat"},
                 *      {"banner", bannerFileName}
                 * });
                 */

                /*
                 * //Uploading captchas with type = 3 (Image Group API) and grid
                 * Captcha captcha = client.Decode(argv[i], Client.DefaultTimeout,
                 * new Hashtable (){
                 *      { "type", 3 },
                 *      {"banner_text", "Select all images with meat"},
                 *      {"banner", bannerFileName},
                 *      {"grid", "4x4"}
                 * });
                 */
                /*
                 * // Upload a CAPTCHA and poll for its status.  Put the Token CAPTCHA
                 * // Json payload, CAPTCHA type and desired solving timeout (in seconds)
                 * // here. If solved, you'll receive a DeathByCaptcha.Captcha object.
                 * Captcha captcha = client.Decode( Client.DefaultTokenTimeout,
                 *      new Hashtable (){
                 *              { "type", 4 },
                 *              {"token_params", "{\"proxy\": \"http://*****:*****@127.0.0.1:1234\",\"proxytype\": \"HTTP\",\"googlekey\": \"6Lc2fhwTAAAAAGatXTzFYfvlQMI2T7B6ji8UVV_f\",\"pageurl\": \"http://google.com\"}"}
                 *
                 *      });
                 */
                if (null != captcha)
                {
                    Console.WriteLine("CAPTCHA {0:D} solved: {1}",
                                      captcha.Id, captcha.Text);

                    // Report an incorrectly solved CAPTCHA.  Make sure the
                    // CAPTCHA was in fact incorrectly solved, do not just
                    // report them all or at random, or you might be banned
                    // as abuser.
                    if (false /* put your CAPTCHA correctness check here */)
                    {
                        if (client.Report(captcha))
                        {
                            Console.WriteLine("Reported as incorrectly solved");
                        }
                        else
                        {
                            Console.WriteLine("Failed reporting as incorrectly solved");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("CAPTCHA was not solved");
                }
            }

            Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);
        }
Exemple #4
0
        static public void Main(string[] argv)
        {
            string dbcUsername = argv[0], dbcPassword = argv[1];

            // Put your DBC username & password here.
            //Client client = (Client)new HttpClient(dbcUsername, dbcPassword);
            Client client = (Client) new HttpClient(dbcUsername, dbcPassword);

            //Put your Proxy credentials and type here
            string proxy     = "http://*****:*****@127.0.0.1:1234";
            string proxyType = "HTTP";


            Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);

            if (argv.Length == 4)
            {
                //Create the Json payload, Put the Site url and Sitekey here.
                string tokenParams = "{\"proxy\": \"" + proxy + "\"," +
                                     "\"proxytype\": \"" + proxyType + "\"," +
                                     "\"googlekey\": \"" + argv[3] + "\"," +
                                     "\"pageurl\": \"" + argv[2] + "\"}";

                // Upload a CAPTCHA and poll for its status.  Put the Token CAPTCHA
                // Json payload, CAPTCHA type and desired solving timeout (in seconds)
                // here. If solved, you'll receive a DeathByCaptcha.Captcha object.
                Captcha captcha = client.Decode(Client.DefaultTimeout,
                                                new Hashtable()
                {
                    { "type", 4 },
                    { "token_params", tokenParams }
                });

                if (null != captcha)
                {
                    Console.WriteLine("CAPTCHA {0:D} solved: {1}",
                                      captcha.Id, captcha.Text);

                    // Report an incorrectly solved CAPTCHA.  Make sure the
                    // CAPTCHA was in fact incorrectly solved, do not just
                    // report them all or at random, or you might be banned
                    // as abuser.
                    if (false /* put your CAPTCHA correctness check here */)
                    {
                        if (client.Report(captcha))
                        {
                            Console.WriteLine("Reported as incorrectly solved");
                        }
                        else
                        {
                            Console.WriteLine("Failed reporting as incorrectly solved");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("CAPTCHA was not solved");
                }
            }

            Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);
        }