当前位置: 首页 > news >正文

史先生 网站建设九冶建设有限公司官方网站

史先生 网站建设,九冶建设有限公司官方网站,phpcms仿站,申请自己的网站背景 最近在使用selenium自动播放学习课程,相信大家也有一些类似的使用场景。 能自动化的事情,绝不自己干。 为防止被检测是机器人做题,刷视频,需要做一些小调整。 先来看作为服务方维护者,是如何检测是Selenium打…

背景

最近在使用selenium自动播放学习课程,相信大家也有一些类似的使用场景。

能自动化的事情,绝不自己干。

为防止被检测是机器人做题,刷视频,需要做一些小调整。

先来看作为服务方维护者,是如何检测是Selenium打开的浏览器,而非一般的活跃用户打开的浏览器。

测试环境

本文的测试环境如下:

Google Chrome 浏览器版本:版本 125.0.6422.77(正式版本) (64 位)

ChromeDriver版本:Chrome for Testing availability

如何检测是否是Selenium打开的浏览器页面

window.navigator.webdriver

直接的方式就是检测navigator的值。如果是selenium打开的web浏览器,则此值为true,或者为false,捉着undefined

 Selenium Page缓存

selenium自身再页面上的缓存有如下特征。

 可以用如下代码检测

function getPageCache(opt_doc) {var doc = opt_doc || document;var key = '$cdc_asdjflasutopfhvcZLmcfl_';
//  var key = 'doggie_';if (!(key in doc))doc[key] = new Cache();return doc[key];
}

如下是一些自动化测试常有的特征检测

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;
};

去除Selenium特征

去除window.navigator.webdriver

ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-allow-origins=*");
// 移除chrome selenium 特征,window.navigator.webdriver
// chrome 125
options.addArguments("--disable-blink-features=AutomationControlled");
// 关闭界面上的---Chrome正在受到自动软件的控制
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);
// 再去打开页面
// driver.get("https://xxxxx.xx.xx.xx")

修改ChromeDriver特征

修改ChromeDriver特征,要么修改源码,再重新编译,要么直接修改二进制代码。本文选择直接修改二进制代码的方式,比较简单。

下载VIM

download : vim online

修改ChromeDriver可执行文件内容,修改之前记得备份下chromedriver.exe

vim.exe chromedriver.exe

将cdc_开头的都替换成你想要的,比如这边我是替换成了doggie 

替换完成保存

%s/cdc_/doggie_/g

当然还有一些伪装自己是活人的办法:

不再深入,后续有机会再玩。

参考文档

https://www.zenrows.com/blog/selenium-avoid-bot-detection#remove-javascript-signiture

https://datadome.co/threat-research/detecting-selenium-chrome/

http://www.yayakq.cn/news/927843/

相关文章:

  • 家居网站 模板水果 网站源码
  • 网站数据分析视频喜欢做木工 网站
  • wordpress免费网站怎么建设网站页面
  • 苏州网站建设制作方案百度wordpress插件下载
  • 设计图片欣赏搜索引擎优化面对哪些困境
  • 企业网站备案是什么意思怎么做公司招聘网站
  • 在网站里怎么做图片超链接网站添加多个关键词
  • 青岛 网站制作公司设计师交流平台有哪些
  • 网站内页301网络推广公司有多少家
  • 哈尔滨网站建设托管公司免费咨询劳动法电话
  • 做网站为什么没收入网站挣钱怎么做
  • 企业网站建设的具体需求望京SOHO网站建设
  • 贵阳工程建设招聘信息网站响应式网站模板怎么做
  • 协会网站方案班级网页设计模板html代码
  • 建设网站学什么媒体网络推广价格优惠
  • 重庆建站多少钱一年wordpress 手机模板调用pc内容
  • 5118站长工具箱免费傻瓜室内装修设计软件
  • 单页网站 html5 动态网站文件夹命名seo
  • 淘宝联盟做的好的网站建搜索引擎网站
  • 南昌专业网站制作公司做公司网站需不需要注册
  • 多种东莞微信网站建设网站改版费用
  • 营销型网站平台建设帮网站网站做推广被抓会判刑吗
  • 铁岭卫生职业学院官方网站建设小程序官网入口
  • 网站几个页面wordpress.模板
  • php做的网站首页是什么文件企业的管理系统有哪些
  • 怎么填写网站icp备案如何查看网站的空间大小
  • 网站建设费是什么企业信息系统开发
  • 请求php网站数据库做优秀网站
  • 人事处网站开发文献综述网站建设淘宝详情页
  • 厦门优秀的网站设计seo的定义是什么