1 | var debug_run = null; |
||
2 | /** |
||
3 | * Disable debugger |
||
4 | */ |
||
5 | function bannedebug() { |
||
6 | if (debug_run) return; |
||
7 | debug_run = true; |
||
8 | document.body.innerHTML = |
||
9 | '<iframe frameborder="0" src="//www.webmanajemen.com" width="100%" height="100%"></iframe><a href="https://www.webmanajemen.com" id="DebuggeRedirect"></a>'; |
||
10 | |||
11 | if (!document.getElementById("DebuggeRedirect").click()) { |
||
12 | setTimeout(function () { |
||
13 | window.location.replace("https://www.webmanajemen.com"); |
||
14 | }, 5000); |
||
15 | } |
||
16 | } |
||
17 | /** |
||
18 | * Detect debugger using flooding loop |
||
19 | */ |
||
20 | function debug_detect() { |
||
21 | setInterval(function () { |
||
22 | var startTime = performance.now(), |
||
23 | check, |
||
24 | diff; |
||
25 | for (check = 0; check < 1000; check++) { |
||
26 | console.log(check); |
||
0 ignored issues
–
show
Debugging Code
introduced
by
![]() |
|||
27 | console.clear(); |
||
28 | } |
||
29 | diff = performance.now() - startTime; |
||
30 | if (diff > 200) { |
||
31 | bannedebug(); |
||
32 | debugger; |
||
0 ignored issues
–
show
|
|||
33 | throw "you got banned"; |
||
34 | } |
||
35 | }, 500); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * restrict debug |
||
40 | * @param {Boolean} restrict |
||
41 | */ |
||
42 | function restrict_mode(restrict) { |
||
43 | if (restrict) { |
||
44 | console.clear(); |
||
45 | window["console"]["log"] = function () {}; |
||
46 | var threshold = 160; |
||
47 | var devtools = { |
||
48 | isOpen: false, |
||
49 | orientation: undefined, |
||
50 | }; |
||
51 | //console.log(devtools); |
||
52 | setInterval(function () { |
||
53 | var widthThreshold = window.outerWidth - window.innerWidth > threshold; |
||
54 | var heightThreshold = window.outerHeight - window.innerHeight > threshold; |
||
55 | var orientation = widthThreshold ? "vertical" : "horizontal"; |
||
56 | //console.log(widthThreshold, heightThreshold, orientation); |
||
57 | |||
58 | if ( |
||
59 | !(heightThreshold && widthThreshold) && |
||
60 | ((window.Firebug && |
||
61 | window.Firebug.chrome && |
||
62 | window.Firebug.chrome.isInitialized) || |
||
63 | widthThreshold || |
||
64 | heightThreshold) |
||
65 | ) { |
||
66 | if (!devtools.isOpen || devtools.orientation !== orientation) { |
||
67 | devtools.orientation = orientation; |
||
68 | } |
||
69 | //console.log('opened'); |
||
70 | devtools.isOpen = true; |
||
71 | devtools.orientation = orientation; |
||
72 | } else { |
||
73 | if (devtools.isOpen) { |
||
74 | devtools.isOpen = false; |
||
75 | devtools.orientation = undefined; |
||
76 | } |
||
77 | |||
78 | devtools.isOpen = false; |
||
79 | devtools.orientation = undefined; |
||
80 | } |
||
81 | if (devtools.isOpen) { |
||
82 | console.error("devtools opened"); |
||
83 | //console.clear(); |
||
84 | bannedebug(); |
||
85 | debugger; |
||
0 ignored issues
–
show
|
|||
86 | throw "banned"; |
||
87 | } |
||
88 | }, 500); |
||
89 | |||
90 | /** |
||
91 | * Hotkey disabler |
||
92 | */ |
||
93 | document.onkeydown = function (e) { |
||
94 | //prevent key F12 |
||
95 | if (event.keyCode == 123) { |
||
96 | return false; |
||
97 | } |
||
98 | |||
99 | //prevent CTRL + Shift + I |
||
100 | if (e.ctrlKey && e.shiftKey && e.keyCode == "I".charCodeAt(0)) { |
||
101 | return false; |
||
102 | } |
||
103 | |||
104 | //prevent CTRL + Shift + J |
||
105 | if (e.ctrlKey && e.shiftKey && e.keyCode == "J".charCodeAt(0)) { |
||
106 | return false; |
||
107 | } |
||
108 | //prevent CTRL + Shift + C |
||
109 | if (e.ctrlKey && e.shiftKey && e.keyCode == "C".charCodeAt(0)) { |
||
110 | return false; |
||
111 | } |
||
112 | //prevent CTRL + U |
||
113 | if (e.ctrlKey && e.keyCode == "U".charCodeAt(0)) { |
||
0 ignored issues
–
show
There is no return statement if
e.ctrlKey && e.keyCode == "U".charCodeAt(0) is false . Are you sure this is correct? If so, consider adding return; explicitly.
This check looks for functions where a Consider this little piece of code function isBig(a) {
if (a > 5000) {
return "yes";
}
}
console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined
The function This behaviour may not be what you had intended. In any case, you can add a
![]() |
|||
114 | return false; |
||
115 | } |
||
116 | }; |
||
117 | } |
||
118 | } |
||
119 | |||
120 | if (!(typeof module !== "undefined" && module.exports)) { |
||
121 | var restrict = !isMobile(); |
||
122 | //restrict = false; |
||
123 | restrict = restrict && !is_localhost() && !is_development(); |
||
124 | //console.log('is restricted mode : ' + restrict); |
||
125 | restrict_mode(restrict); |
||
126 | } |
||
127 |