mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-17 00:17:11 +08:00
补环境
This commit is contained in:
parent
e5253b6a6b
commit
def2b759ce
BIN
img/63.png
Normal file
BIN
img/63.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
15
zy-补环境框架/window.js
Normal file
15
zy-补环境框架/window.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
navigator = {
|
||||||
|
userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36"
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.getOwnPropertyDescriptor_ = Object.getOwnPropertyDescriptor;
|
||||||
|
|
||||||
|
Object.getOwnPropertyDescriptor = function (o,p) {
|
||||||
|
if(navigator.toString() == "[object Navigator]"){
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
Object.getOwnPropertyDescriptor_.apply(this, arguments)
|
||||||
|
};
|
||||||
|
|
||||||
|
const descriptor1 = Object.getOwnPropertyDescriptor(navigator, 'userAgent');
|
||||||
|
console.log(descriptor1);
|
@ -13,4 +13,51 @@ jsdom 是许多 web 标准的纯 JavaScript 实现,特别是 WHATWG DOM和HTML
|
|||||||
利用谷歌开源浏览器,进行修改内核代码
|
利用谷歌开源浏览器,进行修改内核代码
|
||||||
|
|
||||||
代码如果被检测
|
代码如果被检测
|
||||||
tostring,node
|
tostring,node,基于原型连的检测,dom环境
|
||||||
|
|
||||||
|
## 检测举例 Object.getOwnPropertyDescriptor
|
||||||
|
|
||||||
|
在node中运行 Object.getOwnPropertyDescriptor
|
||||||
|
|
||||||
|
navigator = {
|
||||||
|
userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36"
|
||||||
|
};
|
||||||
|
|
||||||
|
const descriptor1 = Object.getOwnPropertyDescriptor(navigator, 'userAgent');
|
||||||
|
console.log(descriptor1);
|
||||||
|
|
||||||
|
会出现
|
||||||
|
|
||||||
|
{
|
||||||
|
value: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36',
|
||||||
|
writable: true,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
}
|
||||||
|
|
||||||
|
浏览器中运行,这里打印的 undefined
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
接下来就需要重写 getOwnPropertyDescriptor 逻辑
|
||||||
|
|
||||||
|
navigator = {
|
||||||
|
userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36"
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.getOwnPropertyDescriptor_ = Object.getOwnPropertyDescriptor;
|
||||||
|
|
||||||
|
Object.getOwnPropertyDescriptor = function (o,p) {
|
||||||
|
if(navigator.toString() == "[object Navigator]"){
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
Object.getOwnPropertyDescriptor_.apply(this, arguments)
|
||||||
|
};
|
||||||
|
|
||||||
|
const descriptor1 = Object.getOwnPropertyDescriptor(navigator, 'userAgent');
|
||||||
|
console.log(descriptor1);
|
||||||
|
|
||||||
|
## 代理是什么
|
||||||
|
|
||||||
|
js代码中读了 window.ayf 现在我需要拦截代码
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user