[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]selenium,chromeDriver防检测

上一篇:[备忘]解决pip install慢的方法
下一篇:[备忘]二进制文件编辑器

添加日期:2020/7/23 1:56:06 快速返回   返回列表 阅读1218次
检测:


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直接改二进制。
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved