上一篇文章是在开发者模式下驱动浏览器,在网上也看到了不同的方法,我验证了下,在此附上。我看到的是添加mitmdump代理驱动浏览器。
技术参考来源:https://zhuanlan.zhihu.com/p/43581988
https://blog.csdn.net/hihell/article/details/88648151
如果想了解原理可以参考我附上的链接。
按照要求首先修改mitmdump源码
新建一个py文件indject_js_proxy.py
from mitmproxy import ctx
injected_javascript = '''
// overwrite the `languages` property to use a custom getter
Object.defineProperty(navigator, "languages", {
get: function() {
return ["zh-CN","zh","zh-TW","en-US","en"];
}
});
// Overwrite the `plugins` property to use a custom getter.
Object.defineProperty(navigator, 'plugins', {
get: () => [1, 2, 3, 4, 5],
});
// Pass the Webdriver test
Object.defineProperty(navigator, 'webdriver', {
get: () => false,
});
// Pass the Chrome Test.
// We can mock this in as much depth as we need for the test.
window.navigator.