网上说的基本不全,最近有个新加密(F5shape)是控制流加密,解起来比较繁琐,就直接用selenium了,我看到有环境监测,但是没想到有检测selenium…一开始用nodejs写的,但是用nodejs写面向过程的代码真的很难受,又改为python了

打开这个网站就能看到部分检测点 https://bot.sannysoft.com

基本配置

  1. UA
  2. 手机版本的话要设置通用手机型号
  3. 根据这个网页好好配置下https://peter.sh/experiments/chromium-command-line-switches/#enable-print-preview-register-promos
options = webdriver.ChromeOptions()
# 配置
# options.add_argument('--headless')
# options.add_argument('--disable-gpu')
# options.add_argument('--blink-settings=imagesEnabled=false');#无图模式options.add_argument("--disable-blink-features")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument('--incognito')#无痕模式
options.add_argument("--disable-extensions")
options.add_argument("--disable-infobars")
options.add_argument("--no-default-browser-check")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
mobileEmulation = {'deviceName': 'iPhone X'}#模拟手机
options.add_experimental_option('mobileEmulation', mobileEmulation)

网上入门就有讲的那堆全局变量

windows.navigator.webdriver 需要改为false
navigator.plugins 插件数量不应该为0
navigator.languages 为英文(但是国外本来就应该是英文)

这些都是小打小闹,弄个提前hook就过去了

driver = webdriver.Chrome(executable_path=path+'/chromedriver.exe',chrome_options=options)driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": '''Object.defineProperties(navigator,{ webdriver:{ get: () => false } }) }
window.navigator.chrome = { runtime: {},  }; }
Object.defineProperty(navigator, 'languages', { get: () => ['en-US', 'en'] }); }
Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5,6], }); }'''
})

后来有了新方法,直接导出浏览器的状态生成js

这个跟第二个是一样的,但是比第二个全

with open(path+'/stealth.min.js') as f:js = f.read()driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": js
})

stealth.min.js文件获取方法
安装nodejs后运行以下命令,自动生成在根目录

  npx extract-stealth-evasions

这时候已经能绕过大部分检测了,包括本文开头那个检测网站

命令通讯检测

这个调了好久,发现只要webdriver跟selenium有通讯,js就检测到了
后来看了webdriver的文档:https://www.w3.org/TR/webdriver
发现她们通讯是通过http的,猜测是在全局变量有缓存

然而浏览器的全局变量就:windows

selenium其实还能当油猴用

with open(path+'/stealth.min.js') as f:js = f.read()driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": '''function objKeySort(obj) {let newkey = Object.keys(obj).sort();let resStr = '';for (let i = 0; i < newkey.length; i++) {let str = obj[newkey[i]];console.log(i,newkey[i],str);resStr += str;}
}'''
})

这时候console已经有objKeySort这个方法了
用objKeySort(windows)看一下命令运行前和命令运行后的区别

找到了document这里变了
用Object.keys(window.document)可以看到,命令运行之后多了个$cdc_xxxxxx的key

后来搜了下 在https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver

可以看到,直接用命令改驱动里面的字符串就行了
perl -pi -e ‘s/cdc_/dcd_/g’ chromedriver.exe


听别人说tb的监测cdc直接在js搜就能搜到,但是我这个是jsvmp,不能搜,只能慢慢调才找出来~
在上面偷了个检测脚本

runBotDetection = function () {var documentDetectionKeys = ["__webdriver_evaluate","__selenium_evaluate","__webdriver_script_function","__webdriver_script_func","__webdriver_script_fn","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__driver_evaluate","__selenium_unwrapped","__fxdriver_unwrapped",];var windowDetectionKeys = ["_phantom","__nightmare","_selenium","callPhantom","callSelenium","_Selenium_IDE_Recorder",];for (const windowDetectionKey in windowDetectionKeys) {const windowDetectionKeyValue = windowDetectionKeys[windowDetectionKey];if (window[windowDetectionKeyValue]) {return true;}};for (const documentDetectionKey in documentDetectionKeys) {const documentDetectionKeyValue = documentDetectionKeys[documentDetectionKey];if (window['document'][documentDetectionKeyValue]) {return true;}};for (const documentKey in window['document']) {if (documentKey.match(/\$[a-z]dc_/) && window['document'][documentKey]['cache_']) {return true;}}if (window['external'] && window['external'].toString() && (window['external'].toString()['indexOf']('Sequentum') != -1)) return true;if (window['document']['documentElement']['getAttribute']('selenium')) return true;if (window['document']['documentElement']['getAttribute']('webdriver')) return true;if (window['document']['documentElement']['getAttribute']('driver')) return true;return false;
};

换个bypass驱动

https://github.com/ultrafunkamsterdam/undetected-chromedriver
挺多人在用的,但是还是要改cdc_

selenium所有检测点和绕过方式[运行命令后被检测/打开就被检测/环境检测]相关推荐

  1. win10在运行命令输入什么可以打开设置

    win10在运行命令中输入ms-settings:wheel命令就可以打开设置. 步骤如下: 一:右键点击系统桌面左下角的[开始],在开始菜单中点击[运行]: 二:在运行对话框中输入:ms-setti ...

  2. python打开word后再关闭再打开出错_用Python写了个程序调用word,运行完后再手动打开word文档就变慢了,这是为啥?...

    公司归档文件比较麻烦,于是用Python写了个程序自动归档,运行无错误.但是运行完后问题就来了,自己手动打开word文档时速度变得奇慢,打开一个文档需要1~2min,请各位同仁帮我看看.下为源代码 # ...

  3. 绕过WAF运行命令执行漏洞的方法大全

    文章目录 **前言** **一.windows下** 二.进入linux 三.一个有趣的例子 总结 前言 作者:掌控安全-桐镜 今天发散一下思维,聊聊关于命令执行漏洞绕过过滤的方法,让我们一起由浅入深 ...

  4. hive 运行命令后FAILED: Execution Error, return code 137 from org.apache.hadoop.hive.ql.ex ec.mr.MapredLoc

    FAILED: Execution Error, return code 137 from org.apache.hadoop.hive.ql.ex ec.mr.MapredLocalTask vi ...

  5. 以管理员方式运行CMD以及常用的DOS命令

    自己的学习笔记,大神绕路!!! 管理员方式运行CMD 打开就是以管理员方式运行命令行窗口,会有更多权限. 常用的Dos命令 1.盘符切换 只需要需要的盘符后加英文的":" 所有的命 ...

  6. linux后台运行命令总结

    linux后台运行命令总结 问题: 我们有时候需要登录远程服务器跑运行时间非常长的脚本,这个时候你要让脚本后台运行,不然占着终端窗口看着不舒服.但万一网络不好,(比如我这儿的破校园网,高峰时几秒钟断一 ...

  7. 命令注入_命令注入绕过方式总结 (20210111学习笔记)

    前言 命令注入是web中常见的漏洞之一,由于web应用程序未对用户提交的数据做严格的过滤,导致用户输入可以直接被linux或windows系统当成命令执行,一般都会造成严重的危害. 常用符号 分号(; ...

  8. 服务器php 启动命令_服务端的cli方式运行

    既然是结合tp5,咱当然要借鉴tp5的优势 # tp5自定义命令行 这个需要自己看tp5的官方文档,直接搜索就能找到,自己添加command.php文件,我的如下 ~~~ /** * Time: 13 ...

  9. 命令注入_命令注入绕过方式总结

    前言 命令注入是web中常见的漏洞之一,由于web应用程序未对用户提交的数据做严格的过滤,导致用户输入可以直接被linux或windows系统当成命令执行,一般都会造成严重的危害. 常用符号 分号(; ...

  10. 以命令行的方式运行activity

    以命令行的方式运行activity,可以直接运行你想要运行的那个activity,不必从第一个activity开始 1. <activity android:name=".camera ...

最新文章

  1. XamarinAndroid组件教程设置动画的时长参数
  2. 商品品牌信息的增删改查操作步骤_javaweb09-Servlet增删改查
  3. 汇编语言0AH功能调用中显示字符出错
  4. 前端学习(1931)vue之电商管理系统电商系统之美化一层循环的UI结构删除业务逻辑实现分配权限的对话框实现
  5. MSSQL 2005数据库与SP4补丁安装
  6. 网易数据运河系统NDC设计与应用
  7. Centos/Red Hat7.9 源码和在线yum 安装 vsftpd
  8. java开发一年多少钱_Java
  9. python @staticmethod方法
  10. Oracle创建上下文 SYS_CONTEXT
  11. SpringBoot Maven repackage failed: Unable to find a single main class from the following candidates
  12. MIUI9修改手机机型 修改王者荣耀版本
  13. 软件测试工作的不足与改善,软件测试工作中对问题的发现和改进
  14. 3d数字孪生工厂可视化三维建模平台
  15. 标题中冒号的用法_[转载]英文中冒号的用法
  16. 房屋水电煤气省钱秘籍
  17. 使用telnet来在线调试海思开发板
  18. c++成员函数指针的本质
  19. Python项目四:新闻聚合
  20. 输入无线网密码后显示无法连接服务器,无线网连接失败

热门文章

  1. 软考高项比中项在难度上高多少?
  2. lammps教程:磨屑原子Ovito后处理教程
  3. 利用python调用PSS/E进行电力系统仿真
  4. 2022年java知识点汇总,面试大全!超级全面,逐步完善!
  5. tar 打包压缩命令
  6. 杨辉三角 java版
  7. linux-centos8安装oracle11
  8. 全网最全Java微服务面试题总结(SpringCloud+Spring Boot)
  9. 运筹学 知识点总结(三)
  10. Eclipse基础--安装eclipse及语言包