惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
美团技术团队
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
L
LangChain Blog
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
Engineering at Meta
Engineering at Meta
腾讯CDC
Recent Announcements
Recent Announcements
The Register - Security
The Register - Security
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
博客园 - Franky
博客园 - 司徒正美
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
C
Check Point Blog
小众软件
小众软件
V
Visual Studio Blog
V
V2EX
F
Full Disclosure
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
罗磊的独立博客
人人都是产品经理
人人都是产品经理
量子位
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
博客园_首页
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
酷 壳 – CoolShell
酷 壳 – CoolShell
Stack Overflow Blog
Stack Overflow Blog
Recorded Future
Recorded Future
G
Google Developers Blog
Vercel News
Vercel News
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
U
Unit 42
爱范儿
爱范儿
Jina AI
Jina AI

🛫Qifei's Blog

Python的模块构建和调用方式 - 🛫Qifei's Blog 如何选择搭建梯子用的VPS? - 🛫Qifei's Blog Hexo博客页面引入足迹地图 - 🛫Qifei's Blog 机器学习和scikit-learn库基础学习笔记 - 🛫Qifei's Blog 利用国内服务器加速v2ray访问速度和规避检查 - 🛫Qifei's Blog Matplotlib_Bar3d绘制彩色带颜色标尺的3D柱形图 - 🛫Qifei's Blog Linux后台运行nostr虚荣公钥的挖掘 - 🛫Qifei's Blog Hexo博客添加Nostr_NIP-05认证 - 🛫Qifei's Blog Nostr_NIP-05认证服务简介和配置 - 🛫Qifei's Blog Onedrive_API大文件上传记录 - 🛫Qifei's Blog Vuejs学习笔记 - 🛫Qifei's Blog OpenOffice连接Mysql数据库 - 🛫Qifei's Blog 安卓ToyVPN服务端从零开始读 - 🛫Qifei's Blog 在控制器中用JS验证CSS_Selector和Xpath - 🛫Qifei's Blog RWTH自习室自动预定程序(RWTH_Lernraum) - 🛫Qifei's Blog RWTH自习室自动预定程序(RWTH_Lernraum) - 🛫Qifei's Blog 如何利用Selenium实现更加高效的爬虫 - 🛫Qifei's Blog Python如何准确的计算Http请求中的Content_Length - 🛫Qifei's Blog 破解图片等资源跨域和防盗链阻拦 - 🛫Qifei's Blog Selenium-Webdriver接口 - 🛫Qifei's Blog
反爬虫-如何检测有没有使用Puppeteer - 🛫Qifei's Blog
Qifei · 2021-10-15 · via 🛫Qifei's Blog

现在检测Puppeteer越来越难了,用户可以通过js对无头浏览器进行各种伪装,webdriver、webgl、plugins都很难检测到爬虫,在这里有一个新思路。

许多网页都有检测控制台是否开启的功能,其中大多数网页会直接禁用F12和右键,但这似乎并没有什么用处,因为浏览器也有其他办法开启控制台,偶然的机会,我看到这篇文章《判断控制台是否开启(chrome)》。其中提供了一个思路来检测控制台是否开启,也就是重写某个函数的toString方法。当控制台开启时使用console.log时这个方法将被调用,从而检测到用户开启了控制台。

1
2
3
4
5
6
function checkOpen() {}
checkOpen.toString = function() {
this.opened = true;
};
console.log("%c", checkOpen);
// checkOpen.opened will become true if/when the console is opened

偶然的机会,我发现当用户使用Puppeteer访问网页时,即便控制台没有被开启,这个方法的this.opened也会被置为true,也就是说,我们用这个方法不仅可以检测到用户是否打开了控制台,用户在使用Puppeteer没有开启控制台的情况下也会被检测到。

这里的一个简单小实验是,别人提供的一个检测控制台开启Demo,通过Puppeteer测试开启并截图后,看到控制台是开启状态。

1
2
await this.page.goto('https://blog.aepkill.com/demos/devtools-detector/')
await this.page.screenshot({path:"aaa.png"})

反爬虫-如何检测有没有使用Puppeteer_001.png

刚才提到的那篇文章的作者,提供了一个开源的检测控制台模块,devtools-detector,可以用做Puppeteer检测。