Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Solving reCaptcha creates recursive loop with POST #329

Open
1 task done
TaquitoSlayer opened this issue Feb 21, 2020 · 0 comments
Open
1 task done

Solving reCaptcha creates recursive loop with POST #329

TaquitoSlayer opened this issue Feb 21, 2020 · 0 comments

Comments

@TaquitoSlayer
Copy link

Please attempt to answer the following questions before submitting a new issue:

  • What version of Cloudscraper are you using?
    • 4.6.0
  • What version of Node.js are you using? (Please share the process information)
    • v10.16.2
  • When did the problem start occurring?
    • As soon as I do any POST request, GET requests seem to resolve themselves fine, but looping still occurs. However, if the GET request has any params in the URL, the looping happens again.

I did notice that if your IP is flagged by CF, or you're using a MITM like Fiddlr, Burp, or Charles, this will automatically be triggered (the looping will be).

Please share a minimal working code snippet that reproduces the problem.

Code snippet
 let daProxy = await this.workerProxy;
        let loginOptions = {
            method: 'POST',
            uri: 'https://www.starcowparis.com/connexion?back=my-account',
            body: `back=my-account&email=${this.task.email}&password=${this.task.password}&submitLogin=1`,
            resolveWithFullResponse: true,
            headers: {
                'authority': 'www.starcowparis.com',
                'cache-control': 'max-age=0',
                'origin': 'https://www.starcowparis.com',
                'upgrade-insecure-requests': '1',
                'content-type': 'application/x-www-form-urlencoded',
                'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.0 Safari/537.36',
                'sec-fetch-user': '?1',
                'accept-language': 'en-US,en;q=0.9',
                'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
                'sec-fetch-site': 'same-origin',
                'sec-fetch-mode': 'navigate',
                'referer': 'https://www.starcowparis.com/connexion?back=my-account',
                'accept-encoding': 'gzip, deflate, br',
            },
            jar: this.cj,
            onCaptcha: await this.checkCap.bind(this),
            timeout: 10000,
            proxy: daProxy,
            // followAllRedirects: false
          };
        console.log('login started');
        console.log('Logging in!')


// where when onCaptcha called
 async checkCap(_options, { captcha }) {
            if (this.task.captcha === 'twocap') {
                this.setStatus("Solving CF captcha...")
                this.client = new Client('xxxxx', {
                    timeout: 60000,
                    polling: 5000,
                    throwErrors: false});
                await this.client.decodeRecaptchaV2({
                    googlekey: captcha.siteKey,
                    pageurl: 'www.starcowparis.com'
                  }).then(function(response) {
                    console.log(response.text);
                    captcha.form['g-recaptcha-response'] = response.text;
                    captcha.submit()
                    console.log('submitted!')
                  })
            } else if (this.task.captcha === 'manual') {
                await this.captchaPLZWORK(captcha).then(function(response) {
                    console.log('captcha found')
                    console.log(response)
                    captcha.form['g-recaptcha-response'] = response;
                    captcha.submit()
                    sleep(1000)
                    console.log('submitted!')
                })
            // this.captchaToken = '';
            }
    }  

Above has @infosimples/node_two_captcha used for the 2captcha solving.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant