JS逆向中浏览器环境的两种监控方式分别是什么

2023-10-27,

JS逆向中浏览器环境的两种监控方式分别是什么,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

1,首先要说的肯定是 Proxy 了,介绍就不说了,直接上代码:

window = new Proxy(global, {    get: function (target, key, receiver) {        console.log("window.get", key, target[key]);        if (key=="location"){            location = new Proxy(target[key], {                get: function (_target, _key, _receiver) {                    console.log("window.get", key, _key, _target[_key]);                    if (_key=="port"){console.log("关注公众号【妄为写代码】")}                    return _target[_key];                }            })        }        return target[key];    },    set: function (target, key, value, receiver) {        console.log("window.set", key, value);        target[key] = value;    }});

window.a = {};window.a;window.location = {a: 2};window.location.a;window.b = {a: 2};window.b.a;location.port;console.log("--------------");window.location.port;

node 环境执行结果:

2,对象属性的 hook 方式

在浏览器中执行:

3,这个监控的作用就不用说了吧,就是大家常说的缺哪补哪需要用到的,现在补环境的场景越来越多了,一些知名 js 反爬产品,就可以用这个思路,环境补的好,可以到处用,还能省好多事,一举多得。

关于JS逆向中浏览器环境的两种监控方式分别是什么问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注本站行业资讯频道了解更多相关知识。

《JS逆向中浏览器环境的两种监控方式分别是什么.doc》

下载本文的Word格式文档,以方便收藏与打印。