Javascript Anti Anti-debugger/Code-Protection

Some website using kinds of javascript anti anti-debugger (or code-protection) to protect others analysis their client side code through browser dev-tools, it’s very painful if you really want to see.

For example: anti-debugger demo page

Here is a sample way to bypass it.

Utilize browser user script plugin

If you don’t heard it, try to visit below site, most popular browser it’s few extensions support. if you don’t have one, you should try and play with it.

https://greasyfork.org/

Enable Anti Anti-debugger script

There is an anti anti-debugger script available, please check it out and install it. and i also attached the script in below:

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
// ==UserScript==
// @name Anti Anti-debugger
// @namespace http://tampermonkey.net/
// @version 1
// @description Stops most anti debugging implementations by JavaScript obfuscaters
// @author ww
// @match *
// @grant unsafeWindow
// @run-at document-start
// ==/UserScript==

(function() {
var _constructor = unsafeWindow.Function.prototype.constructor;
// Hook Function.prototype.constructor
unsafeWindow.Function.prototype.constructor = function() {
var fnContent = arguments[0];
if (fnContent) {
if (fnContent.includes('debugger')) { // An anti-debugger is attempting to stop debugging
var caller = Function.prototype.constructor.caller; // Non-standard hack to get the function caller
var callerContent = caller.toString();
if (callerContent.includes(/\bdebugger\b/gi)) { // Eliminate all debugger statements from the caller, if any
callerContent = callerContent.replace(/\bdebugger\b/gi, ''); // Remove all debugger expressions
eval('caller = ' + callerContent); // Replace the function
}
return (function () {});
}
}
// Execute the normal function constructor if nothing unusual is going on
return _constructor.apply(this, arguments);
};
})();

After installation, you can enable it.

Free to view the code through browser dev-tool

References