berstend / puppeteer-extra

💯 Teach puppeteer new tricks through plugins.
https://extra.community
MIT License
6.47k stars 742 forks source link

Latest stealth plugin detected by Google #578

Closed teewoeijer closed 3 years ago

teewoeijer commented 3 years ago

The stealth plugin had been working fine on Google's website, however it stopped working recently. The website shows "This browser or app may not be secure" error after submitting the username.

my package version: puppeteer-extra-plugin-stealth@2.8.2 puppeteer-extra@3.2.3

Below is my code:

(async () => {
  const puppeteer = require('puppeteer-extra')
  const StealthPlugin = require('puppeteer-extra-plugin-stealth')
  puppeteer.use(StealthPlugin())  
  const browser = await puppeteer.launch({ headless: false });
  const page = await browser.newPage();
  await page.goto('https://accounts.google.com/signin/v2/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin');
  await page.type('input', 'demo123', {delay: 20})
  const elements = await page.$x('//span[text()="Next"]')
  await elements[0].click() 
  await page.waitForTimeout(3000);
  await browser.close();
})();
pierreminiggio commented 3 years ago

I use a youtube uploader package that relies on the stealth plugin, we've got issues logging in to Google as well : https://github.com/fawazahmed0/youtube-uploader/issues/48

gm2it commented 3 years ago

+1 ,same problem , This browser or app may not be secure , Even when using :

await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136");

UGLHong commented 3 years ago

same issue here =(

ghost commented 3 years ago

I was experiencing the same issue but only for certain accounts like (about 1 in 10) since September. Seems like today is the official roll-out where everything is blocked

Bramzor commented 3 years ago

Same issue here. Seems that Google can detect it. Even when using:

        executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
        userDataDir: userDataDir,
        headless: false,
teewoeijer commented 3 years ago

Okay I found something that might be useful. If using any user agent other than chrome with stealth plugin can actually bypass the detection.

So I think maybe the stealth plugin's user-agent-override package may be the answer for this fix.

My code:

(async () => {
  const puppeteer = require('puppeteer-extra')
  const StealthPlugin = require('puppeteer-extra-plugin-stealth')
  puppeteer.use(StealthPlugin())  
  const browser = await puppeteer.launch({ headless: false});
  const page = await browser.newPage();
  await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0");
  await page.goto('https://accounts.google.com/signin/v2/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin');
  await page.type('input', 'demo123', {delay: 20})
  const elements = await page.$x('//span[text()="Next"]')
  await elements[0].click() 
  await page.waitForTimeout(30000);
  await browser.close();
})();
gm2it commented 3 years ago

Okay I found something that might be useful. If using any user agent other than chrome with stealth plugin can actually bypass the detection.

So I think maybe the stealth plugin's user-agent-override package may be the answer for this fix.

My code:

(async () => {
  const puppeteer = require('puppeteer-extra')
  const StealthPlugin = require('puppeteer-extra-plugin-stealth')
  puppeteer.use(StealthPlugin())  
  const browser = await puppeteer.launch({ headless: false});
  const page = await browser.newPage();
  await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0");
  await page.goto('https://accounts.google.com/signin/v2/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin');
  await page.type('input', 'demo123', {delay: 20})
  const elements = await page.$x('//span[text()="Next"]')
  await elements[0].click() 
  await page.waitForTimeout(30000);
  await browser.close();
})();

Not working for me still getting same probleme

berstend commented 3 years ago

A fix is coming 😄

berstend commented 3 years ago

Fixed in #579:

Successfully published:
 - puppeteer-extra-plugin-stealth@2.9.0

Coffee donations accepted 😄

gm2it commented 3 years ago

@berstend thank you , but with this modification now it's giving new error captcha verification captcha

teewoeijer commented 3 years ago

@berstend Thanks its working again with version 2.9.0. However, the problem persists while running in headless mode.

code:

(async () => {
  const puppeteer = require('puppeteer-extra')
  const StealthPlugin = require('puppeteer-extra-plugin-stealth')
  puppeteer.use(StealthPlugin())
  const browser = await puppeteer.launch({ headless: true});
  const page = await browser.newPage();
  await page.goto('https://accounts.google.com/signin/v2/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltm$
  await page.type('input', 'demo123', {delay: 20})
  const elements = await page.$x('//span[text()="Next"]')
  await elements[0].click()
  await page.waitForTimeout(2000);
  await page.screenshot({path: 'screenshot.png'});
  await browser.close();
})();
ghost commented 3 years ago

It is working in headless mode. Bypass CSP geniuses

teewoeijer commented 3 years ago

It is working in headless mode. Bypass CSP geniuses

Yes added await page.setBypassCSP(true) and its working. thanks.

pierreminiggio commented 3 years ago

I just wanna say thanks for the quick response on this issue ! ♥ I'll get you a coffee later.

ngekoding commented 2 years ago

It is working in headless mode. Bypass CSP geniuses

Thank you, it is also working for me.

signaldev1 commented 2 years ago

hello @berstend this error is showing again do you have any idea ??

LinkTree3 commented 2 years ago

Google started to detect puppeteer extra stealth for me as well. :( It won't let me login to some of the few accounts I'm managing.

image

berstend commented 2 years ago

This issue has been closed in favor of #588

A possible workaround has been mentioned here: https://github.com/berstend/puppeteer-extra/issues/668#issuecomment-1175380080

signaldev1 commented 1 year ago

Hey @berstend , Once again, the issue has emerged today

bashar-odeh commented 1 year ago

Any solution to this issue?

Astralights366 commented 1 month ago

If you have these arguments in your browser startup: args: [ `--disable-web-security`, `--allow-running-insecure-content`, ]

removing them (or one of them) solved the issue for me

vladtreny commented 1 month ago

^ this is probably because they detect via iframe