codemanki / cloudscraper

--DEPRECATED -- 🛑 🛑 Node.js library to bypass cloudflare's anti-ddos page
MIT License
599 stars 139 forks source link

Solving reCaptcha creates recursive loop with POST #329

Open TaquitoSlayer opened 4 years ago

TaquitoSlayer commented 4 years ago

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

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 ```js 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.