检测:
const _0x207ab1 = "__webdriver_evaluate"; const _0x146400 = "webdriver"; const _0x57be01 = "Sequentum"; const _0x152dcb = "__selenium_evaluate"; const _0x2b2767 = "__webdriver_script_func"; const _0x4da0c9 = "_Selenium_IDE_Recorder"; const _0x261dbe = {}; const _0x53d471 = 1; const _0x3b7fb8 = "_phantom"; const _0x5341d3 = "__nightmare"; const _0x40bc04 = "__fxdriver_evaluate"; const _0x1101b1 = "callSelenium"; const _0x27a4fa = "__driver_unwrapped"; const _0x1a7633 = "__webdriver_script_function"; const _0x553eb4 = "_selenium"; const _0x3ada7c = "callPhantom"; const _0x2c770b = true; const _0x1b15f6 = "__webdriver_script_fn"; const _0x6fa32f = "driver"; const _0x442448 = "__selenium_unwrapped"; const _0xca0390 = false; const _0x500970 = "__driver_evaluate"; const _0x4d3b38 = "selenium"; const _0x1c2bea = "__fxdriver_unwrapped"; const _0x2f4c6d = "__webdriver_unwrapped";
try { var _0x3e47d8 = [ _0x207ab1, _0x152dcb, _0x1a7633, _0x2b2767, _0x1b15f6, _0x40bc04, _0x27a4fa, _0x2f4c6d, _0x500970, _0x442448, _0x1c2bea ]; var _0x171dd6 = [ _0x3b7fb8, _0x5341d3, _0x553eb4, _0x3ada7c, _0x1101b1, _0x4da0c9 ]; for (var _0x391ccc in _0x171dd6) { var _0x4db8b5 = _0x171dd6[_0x391ccc]; if (window[_0x4db8b5]) { alert(_0x4db8b5); } } for (var _0x2b989e in _0x3e47d8) { var _0x59228c = _0x3e47d8[_0x2b989e]; if (window.document[_0x59228c]) { alert(_0x59228c); } } for (var _0x312588 in window.document) { if (_0x312588.match(_0x261dbe) && window.document[_0x312588].cache_) { alert(_0x312588); } } if (window.external && window.external.toString() && window.external.toString().indexOf(_0x57be01) != -_0x53d471) alert(111); if (window.document.documentElement.getAttribute(_0x4d3b38)) alert(222); if (window.document.documentElement.getAttribute(_0x146400)) alert(333); if (window.document.documentElement.getAttribute(_0x6fa32f)) alert(444); if (window.navigator.webdriver) alert(555); alert(666); } catch (_0x26513c) { alert(7777); }
防检测:
options = Options() options.add_argument("start-maximized") options.add_argument("--disable-blink-features"); options.add_argument("--disable-blink-features=AutomationControlled") options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) #driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe') cwd = getcwd() d = webdriver.Chrome(f'{cwd}{sep}chromedriver',options=options)
d.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"}) d.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": "Object.defineProperty(navigator, 'languages', {get: function() { return ['zh-CN','zh'];}})"}) d.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": "Object.defineProperty(navigator, 'plugins', {get: () => [1, 2, 3]})"})
d.execute_cdp_cmd('Network.setUserAgentOverride', {"userAgent": 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36'}) print(d.execute_script("return navigator.userAgent;")) print(d.execute_script("return navigator.webdriver;"))
cache_你懂得,exe直接改二进制。
|