zhihu补环境(补96)
加密逻辑
- 对 版本和请求参数的拼接字符串进行 魔改md5加密 (直接扣即可, 没难度)
- 对加密后的字符串进行二次加密, 使用webpack中的1514向外暴露的加密算法 (扣webpack的加载器和模块, 补环境即可) (使用到的模块不多, 不需要吐模块)
webpack 补环境
- 挂代理, 不多说
- 以检测 toString为主, 可以对检测的变量进行手动赋值toString的结果(注意 location.toString()的结果是url)
- 补函数, 不多说
- 会检测window的原型, 注意window的原型要有值, 不能为空对象{}
注意:
无法调试,无法调试, 否则结果结果无法正常输出
(暂未找到原因, 有大佬知道, 希望留言告知, 多谢)
验证正确性
由于输出结果一直在变, 判断是 Math.random 或 Date().getTime() 导致的
对其进行重写, 固定返回值( 经过实验, 导致变化的是 Math.random)
补环境代码
function Document(){}
Document.prototype.createElement=function(){
if (arguments[0]=='canvas'){
let canvas = {
getContext: function(){
console.log('====>',arguments);
if (arguments[0] == '2d'){
d2={}
d2.toString=()=>'[object CanvasRenderingContext2D]'
return watch(d2,'canvas.getContext.2d')
}
return watch({},'canvas.getContext')
}
}
canvas.toString=()=>'[object HTMLCanvasElement]';
return watch(canvas,'canvas')
}
}
Document.prototype.getElementById=function(){}
Document.prototype.getElementsByClassName=function(){}
document=new Document();
document.toString=()=>'[object HTMLDocument]'
function Navigator(){}
Navigator.prototype={}
navigator = new Navigator();
navigator.toString=()=>'[object Navigator]'
function Location() {}
Location.prototype = {
"ancestorOrigins": {},
"href": "https://www.zhihu.com/search?type=content&q=python",
"origin": "https://www.zhihu.com",
"protocol": "https:",
"host": "www.zhihu.com",
"hostname": "www.zhihu.com",
"port": "",
"pathname": "/search",
"search": "?type=content&q=python",
"hash": ""
};
let location = new Location();
location.toString=()=>'https://www.zhihu.com/search?type=content&q=python'
function Storage(){}
Storage.prototype={}
localStorage=new Storage();
function Screen() {}
Screen.prototype={}
screen = new Screen();
screen.toString=()=>'[object Screen]';
function History() {}
History.prototype = {};
history = new History();
history.toString=()=>'[object History]';
function Window(){}
Window.prototype={
"TEMPORARY": 0,
"PERSISTENT": 1
}
// window=new Window();
window=global;
window.__proto__=Window.prototype;
window.__ZH__= {补自己电脑上的就行, 内容较多,不展示}
window.name=''
window.alert=function(){}
window.document = document;
window.navigator = navigator;
window.location = location;
window.localStorage = localStorage;
window.screen = screen;
window.history = history;