-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathForbidden_log.js
More file actions
32 lines (28 loc) · 1.29 KB
/
Forbidden_log.js
File metadata and controls
32 lines (28 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name Forbidden_log
// @namespace https://github.com/0xsdeo/Hook_JS
// @version 2025-03-14
// @description 重写console.log为空函数,以此来阻止网站js打印内容。
// @author 0xsdeo
// @match http://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
// let temp_toString = Function.prototype.toString;
//
// Function.prototype.toString = function () {
// if (this === Function.prototype.toString) {
// return 'function toString() { [native code] }';
// } else if (this === xxx) { // 将xxx修改为要hook的方法
// return ''; // 在控制台执行xxx.toString(),将输出的内容替换掉空字符串
// }
// return temp_toString.apply(this, arguments);
// }
// let temp_log = console.log; // 将xxx修改为要hook的方法,temp_xxx变量名可以根据需要进行修改命名
console.log = function () { // 将xxx修改为要hook的方法
// 在这里写你想让hook后的方法执行的代码
// return temp_log(...arguments); // 将网站js调用目标方法时所传入的内容传给原方法执行并返回结果
}
})();