//hook xxx.call
Function.__proto__.__call = Function.__proto__.call;
Function.__proto__.call = function (...args) {
//感兴趣的某个调用
if(args.length === 8 && args[0]===args[3] && args[2].exports===args[0] && typeof(args[0]==='string')){
console.info('================== find: ', args[5])
}else{
//console.info('================= not find: ', this)
}
//调原来的 call 函数
return this.__call(... args);
//如果是 chrome 里面运行, 则在 console 中每次敲下键盘, 都会执行 hasOwnProperty 函数或者 eval
if (this === eval || Object.prototype.hasOwnProperty===this)
{
//console.info('eval / hasOwnProperty called');
}
else {
}
}
//hook 某个函数, 保留它的参数
function cc(klass) {
var Traits = function () {};
Traits.prototype = klass.prototype;
return function () {
var instance = new Traits();
var tmp = klass.apply(instance, arguments);
// For builtin-function
js hook 对象上的成员函数访问
最新推荐文章于 2025-06-03 12:08:50 发布
本文探讨如何使用JavaScript Hook技术来跟踪和控制对象实例上成员函数的访问,包括调用前后的操作,以及在不修改原有代码的情况下实现函数拦截和增强。

最低0.47元/天 解锁文章
122

被折叠的 条评论
为什么被折叠?



