add noeval.js and bab-defuser

This commit is contained in:
jspenguin2017 2017-05-27 14:40:43 -06:00
parent fd2422b434
commit 9a89d66d30

View File

@ -19,6 +19,7 @@
// ==/UserScript== // ==/UserScript==
(function () { (function () {
//=====START UTIL=====
var util = { var util = {
dropScript: function (txt, scriptDropMode) { dropScript: function (txt, scriptDropMode) {
//scriptDropMode: undefined = autodetect, 1 for force eval, 2 for force drop element //scriptDropMode: undefined = autodetect, 1 for force eval, 2 for force drop element
@ -49,24 +50,24 @@
} }
}, },
getScriptManager: function () { getScriptManager: function () {
if (typeof GM_info == 'object') { if (typeof GM_info === 'object') {
// Greasemonkey (Firefox) // Greasemonkey (Firefox)
if (typeof GM_info.uuid != 'undefined') { if (typeof GM_info.uuid !== 'undefined') {
return 'Greasemonkey'; return 'Greasemonkey';
} // Tampermonkey (Chrome/Opera) } // Tampermonkey (Chrome/Opera)
else if (typeof GM_info.scriptHandler != 'undefined') { else if (typeof GM_info.scriptHandler !== 'undefined') {
return 'Tampermonkey'; return 'Tampermonkey';
} }
} else { } else {
// Scriptish (Firefox) // Scriptish (Firefox)
if (typeof GM_getMetadata == 'function') { if (typeof GM_getMetadata === 'function') {
return 'Scriptish'; return 'Scriptish';
} // NinjaKit (Safari/Chrome) } // NinjaKit (Safari/Chrome)
else if (typeof GM_setValue != 'undefined' && else if (typeof GM_setValue !== 'undefined' &&
typeof GM_getResourceText == 'undefined' && typeof GM_getResourceText === 'undefined' &&
typeof GM_getResourceURL == 'undefined' && typeof GM_getResourceURL === 'undefined' &&
typeof GM_openInTab == 'undefined' && typeof GM_openInTab === 'undefined' &&
typeof GM_setClipboard == 'undefined') { typeof GM_setClipboard === 'undefined') {
return 'NinjaKit'; return 'NinjaKit';
} else { // Native } else { // Native
return 'Native'; return 'Native';
@ -75,8 +76,13 @@
}, },
domCmp: function (domain) { domCmp: function (domain) {
return domain === location.hostname || location.hostname.endsWith("." + domain); return domain === location.hostname || location.hostname.endsWith("." + domain);
},
patchToString: function () {
//Implementation wanted.
//Patch Function.prototype.toString so our modification can't be detected by the page script
} }
}; };
//=====START CORE RUNTIME=====
var ubo = { var ubo = {
setTimeout_defuser: function (niddle, delay, scriptDropMode) { setTimeout_defuser: function (niddle, delay, scriptDropMode) {
var uSol = function () { var uSol = function () {
@ -187,9 +193,81 @@
}; };
var str = String(uSol).replace("{{1}}", String(niddle)); var str = String(uSol).replace("{{1}}", String(niddle));
util.dropScript(str, scriptDropMode); util.dropScript(str, scriptDropMode);
},
bab_defuser: function (scriptDropMode) {
var uSol = function () {
var sto = window.setTimeout,
re = /\.bab_elementid.$/;
window.setTimeout = function (a, b) {
if (typeof a !== 'string' || !re.test(a)) {
return sto(a, b);
}
}.bind(window);
var signatures = [
['blockadblock'],
['babasbm'],
[/getItem\('babn'\)/],
[
'getElementById',
'String.fromCharCode',
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
'charAt',
'DOMContentLoaded',
'AdBlock',
'addEventListener',
'doScroll',
'fromCharCode',
'<<2|r>>4',
'sessionStorage',
'clientWidth',
'localStorage',
'Math',
'random'
]
];
var check = function (s) {
var tokens, match, j, token, pos;
for (var i = 0; i < signatures.length; i++) {
tokens = signatures[i];
match = 0;
for (j = 0, pos = 0; j < tokens.length; j++) {
token = tokens[j];
pos = token instanceof RegExp ? s.search(token) : s.indexOf(token);
if (pos !== -1) { match += 1; }
}
if ((match / tokens.length) >= 0.8) { return true; }
}
return false;
};
var realEval = window.eval;
window.eval = function (a) {
if (!check(a)) {
return realEval(a);
}
var el = document.body;
if (el) {
el.style.removeProperty('visibility');
}
el = document.getElementById('babasbmsgx');
if (el) {
el.parentNode.removeChild(el);
}
}.bind(window);
};
var str = String(uSol);
util.dropScript(str, scriptDropMode);
},
noeval: function (scriptDropMode) {
var uSol = function () {
window.eval = function (s) {
console.log('Document tried to eval... \n' + s);
}.bind(window);
};
var str = String(uSol);
util.dropScript(str, scriptDropMode);
} }
}; };
//Rules //=====START RULES=====
if (util.domCmp("thewindowsclub.com")) { if (util.domCmp("thewindowsclub.com")) {
ubo.setTimeout_defuser("[native code]"); ubo.setTimeout_defuser("[native code]");
} }