如何解决反调试困扰-反反反反反反反调试-让我们用一个插件搞定
資深大佬 : 546669204 78
fuck-debugger-extensions
简介
这个拓展是一个 反反反调试框架
当看到一段漂亮代码的时候 发现有反调试 卡浏览器 死机 这个时候就很不爽了。
拥有这个插件 就可以解决问题于无形之中。
主要解决问题
- 基于 console 的 devtool 检测
- 基于 pushState 的卡浏览器
- 基于 debugger 的卡浏览器 检测 devtool
- 基于 regexp 的代码风格检测
安装和使用
下载
cd ~ git clone https://github.com/546669204/fuck-debugger-extensions.git
安装
1. Navigate to chrome://extensions in your browser. You can also access this page by clicking on the Chrome menu on the top right side of the Omnibox, hovering over **More Tools** and selecting **Extensions**. 2. Check the box next to **Developer Mode**. 3. Click **Load Unpacked Extension** and select the directory for your "Hello Extensions" extension. Congratulations!
使用
地址栏右侧找到拓展 点击 配置 功能选项 刷新即可
快捷键 Alt+Shift+D 开启请求拦截功能
原理详解
使用 console.log 来判断是否打开开发者工具
//方法 1 var x = document.createElement('div'); Object.defineProperty(x, 'id', { get:function(){ // 开发者工具被打开 } }); console.log(x); //方法 2 var c = new RegExp("1"); c.toString = function(){ // 开发者工具被打开 } console.log(c);
直接 hook console 对象 让所有输出失效
使用 debugger 语句判断是否打开开发者工具 和 无限循环 debugger 卡机
var startTime = new Date(); debugger; var endTime = new Date(); var isDev = endTime - startTime >100; while(true){ debugger; } // debugger 的另一种实现方式 (function(){}).constructor("debugger")()
静态 debugger
使用 chrome protocol 拦截所有请求 修改返回值
动态 debugger
hook 了 Function.protype.constructor 替换所有的 debugger 字符
基于 regexp 的代码格式化检测
new RegExp(`\w+ *\(\) *{\w+ *['|"].+['|"];? *}`).test((function(){return "dev"}).toString())
目前的解决方案是 hook regexp 当触发 apply 函数的时候 参数等于给定值 返回空 regexp
chrome protocol
大概流程
- chrome.debugger.attach 注入指定 tabId
- 监听 chrome.debugger.onEvent 获取返回值
- 发送 Fetch.enable 开启请求拦截器
- 在事件 Fetch.requestPaused 中修改 response 返回结果
- OK !
该功能使用了 chrome 实验特性 需要新版 chrome
利用 chrome protocol 还能做到更多
其他
如果在使用中遇到问题和建议可以提 issuse 与我们进行联系;
如果有更好的想法可以参与进来。
该项目不倡导去破解他人项目来谋取利益。仅做学术研究使用。
毕竟代码运行在客户端。如果有价值,只要花功夫。都是可以被人攻破的。
建议把不重要的代码放在客户端。
项目地址
https://github.com/546669204/fuck-debugger-extensions/blob/master/README.zh-CN.md
大佬有話說 (2)