Update aak-cont-master-es6.js

This commit is contained in:
Giwayume 2017-05-28 17:41:56 +00:00
parent f59cf46931
commit e3e7f47ac7

View File

@ -326,7 +326,210 @@ var a = (function(window) {
return true;
},
generic: undefined, // TODO
/**
* Generic anti-adblocking solutions that run on every page.
* @method generic
*/
generic() {
//@pragma-keepline Based on generic solutions of Anti-Adblock Killer
//@pragma-keepline License: https://github.com/reek/anti-adblock-killer/blob/master/LICENSE
if (this.config.allowGeneric && !this.config.domExcluded) {
const data = {};
this.generic.FuckAdBlock("FuckAdBlock", "fuckAdBlock");
this.generic.FuckAdBlock("BlockAdBlock", "blockAdBlock");
this.readOnly("canRunAds", true);
this.readOnly("canShowAds", true);
this.readOnly("isAdBlockActive", false);
let playwireZeus;
this.win.Object.defineProperty(this.win, "Zeus", {
configurable: false,
set: function (val) {
playwireZeus = val;
},
get: function () {
this.config.debugMode && this.err("Playwire");
try {
playwireZeus.AdBlockTester = {
check: function (a) { a(); }
};
} catch (err) { }
return playwireZeus;
}
});
this.ready(function () {
if (this.win.XenForo && typeof this.win.XenForo.rellect === "object") {
this.config.debugMode && this.err("XenForo");
this.win.XenForo.rellect = {
AdBlockDetector: {
start: function () { }
}
};
}
if (typeof this.win.closeAdbuddy === "function") {
this.config.debugMode && this.err("Adbuddy");
this.win.closeAdbuddy();
}
if (this.$("div.adb_overlay > div.adb_modal_img").length > 0) {
this.config.debugMode && this.err("AdBlock Alerter");
this.$("div.adb_overlay").remove();
this.css("html,body {height:auto; overflow: auto;}");
}
if (this.$("#blockdiv").html() === "disable ad blocking or use another browser without any adblocker when you visit") {
this.config.debugMode && this.out.err("Uncaught AdBlock Error: Generic block screens are not allowed on this device! ");
this.$("#blockdiv").remove();
}
const styles = document.querySelectorAll("style");
for (let i = 0; i < styles.length; i++) {
const style = styles[i];
const cssRules = style.sheet.cssRules;
for (var j = 0; j < cssRules.length; j++) {
const cssRule = cssRules[j];
const cssText = cssRule.cssText;
const pattern = /^#([a-z0-9]{4,10}) ~ \* \{ display: none; \}/;
if (pattern.test(cssText)) {
const id = pattern.exec(cssText)[1];
if (this.$("script:contains(w.addEventListener('load'," + id + ",false))")) {
this.config.debugMode && this.err("Antiblock.org v2");
data.abo2 = id;
break;
}
}
}
}
for (let prop in this.win) {
try {
if (!prop.startsWith("webkit") && /^[a-z0-9]{4,12}$/i.test(prop) && prop !== "document" && (this.win[prop] instanceof this.win.HTMLDocument) === false && this.win.hasOwnProperty(prop) && typeof this.win[prop] === "object") {
const method = this.win[prop];
if (method.deferExecution &&
method.displayMessage &&
method.getElementBy &&
method.getStyle &&
method.insert &&
method.nextFunction) {
if (method.toggle) {
this.config.debugMode && this.err("BetterStopAdblock");
data.bsa = prop;
} else {
this.config.debugMode && this.err("Antiblock.org v3");
data.abo3 = prop;
}
this.win[prop] = null;
}
if (method.bab) {
this.config.debugMode && this.err("BlockAdBlock");
this.win[prop] = null;
} else if (this.win.Object.keys(method).length === 3 && this.win.Object.keys(method).join().length === 32) {
this.config.debugMode && this.err("BlockAdBlock");
this.win[prop] = null;
}
}
} catch (err) { }
}
});
const onInsertHandler = function (insertedNode) {
if (insertedNode.nodeName === "DIV" &&
insertedNode.id &&
insertedNode.id.length === 4 &&
/^[a-z0-9]{4}$/.test(insertedNode.id) &&
insertedNode.firstChild &&
insertedNode.firstChild.id &&
insertedNode.firstChild.id === insertedNode.id &&
insertedNode.innerHTML.includes("no-adblock.com")) {
this.config.debugMode && this.err("No-Adblock");
insertedNode.remove();
}
if (insertedNode.nodeName === "DIV" &&
insertedNode.id &&
insertedNode.id.length === 7 &&
/^a[a-z0-9]{6}$/.test(insertedNode.id) &&
insertedNode.parentNode &&
insertedNode.parentNode.id &&
insertedNode.parentNode.id === insertedNode.id + "2" &&
insertedNode.innerHTML.includes("stopadblock.org")) {
this.config.debugMode && this.err("StopAdblock");
insertedNode.remove();
}
const reIframeId = /^(zd|wd)$/;
const reImgId = /^(xd|gd)$/;
const reImgSrc = /\/ads\/banner.jpg/;
const reIframeSrc = /(\/adhandler\/|\/adimages\/|ad.html)/;
if (insertedNode.id &&
reImgId.test(insertedNode.id) &&
insertedNode.nodeName === "IMG" &&
reImgSrc.test(insertedNode.src) ||
insertedNode.id &&
reIframeId.test(insertedNode.id) &&
insertedNode.nodeName === "IFRAME" &&
reIframeSrc.test(insertedNode.src)) {
this.config.debugMode && this.err("AntiAdblock");
insertedNode.remove();
}
const reId = /^[a-z]{8}$/;
const reClass = /^[a-z]{8} [a-z]{8}/;
const reBg = /^[a-z]{8}-bg$/;
if (typeof this.win.vtfab !== "undefined" &&
typeof this.win.adblock_antib !== "undefined" &&
insertedNode.parentNode &&
insertedNode.parentNode.nodeName === "BODY" &&
insertedNode.id &&
reId.test(insertedNode.id) &&
insertedNode.nodeName === "DIV" &&
insertedNode.nextSibling &&
insertedNode.nextSibling.className &&
insertedNode.nextSibling.nodeName === "DIV") {
if (insertedNode.className &&
reClass.test(insertedNode.className) &&
reBg.test(insertedNode.nextSibling.className) &&
insertedNode.nextSibling.style &&
insertedNode.nextSibling.style.display !== "none") {
this.config.debugMode && this.err("Adunblock Premium");
insertedNode.nextSibling.remove();
insertedNode.remove();
} else if (insertedNode.nextSibling.id &&
reId.test(insertedNode.nextSibling.id) &&
insertedNode.innerHTML.includes("Il semblerait que vous utilisiez un bloqueur de publicité !")) {
this.config.debugMode && this.err("Adunblock Free");
insertedNode.remove();
}
}
const reMsgId = /^[a-z0-9]{4,10}$/i;
const reTag1 = /^(div|span|b|i|font|strong|center)$/i;
const reTag2 = /^(a|b|i|s|u|q|p|strong|center)$/i;
const reWords1 = /ad blocker|ad block|ad-block|adblocker|ad-blocker|adblock|bloqueur|bloqueador|Werbeblocker|adblockert|&#1570;&#1583;&#1576;&#1604;&#1608;&#1603; &#1576;&#1604;&#1587;|блокировщиком/i;
const reWords2 = /kapat|disable|désactivez|désactiver|desactivez|desactiver|desative|desactivar|desactive|desactiva|deaktiviere|disabilitare|&#945;&#960;&#949;&#957;&#949;&#961;&#947;&#959;&#960;&#959;&#943;&#951;&#963;&#951;|&#1079;&#1072;&#1087;&#1088;&#1077;&#1097;&#1072;&#1090;&#1100;|állítsd le|publicités|рекламе|verhindert|advert|kapatınız/i;
if (insertedNode.parentNode &&
insertedNode.id &&
insertedNode.style &&
insertedNode.childNodes.length &&
insertedNode.firstChild &&
!insertedNode.firstChild.id &&
!insertedNode.firstChild.className &&
reMsgId.test(insertedNode.id) &&
reTag1.test(insertedNode.nodeName) &&
reTag2.test(insertedNode.firstChild.nodeName)) {
this.config.debugMode && this.err("Antiblock.org");
const audio = insertedNode.querySelector("audio[loop]");
if (audio) {
audio.pause();
audio.remove();
} else if ((data.abo2 && insertedNode.id === data.abo2) ||
(insertedNode.firstChild.hasChildNodes() && reWords1.test(insertedNode.firstChild.innerHTML) && reWords2.test(insertedNode.firstChild.innerHTML))) {
insertedNode.remove();
} else if ((data.abo3 && insertedNode.id === data.abo3) ||
(insertedNode.firstChild.hasChildNodes() && insertedNode.firstChild.firstChild.nodeName === "IMG" && insertedNode.firstChild.firstChild.src.startsWith("data:image/png;base64"))) {
a.win[data.abo3] = null;
insertedNode.remove();
} else if (data.bsa && insertedNode.id === data.bsa) {
this.win[data.bsa] = null;
insertedNode.remove();
}
}
};
this.observe("insert", onInsertHandler);
} else if (this.config.debugMode) {
this.out.warn("Generic solutions are disabled on this domain. ");
}
},
/**
* Match enum for the "applyMatch" method.
@ -341,8 +544,38 @@ var a = (function(window) {
callback: 4 // Callback, arguments list will be supplied as an array. Retrun true for match, false for no match.
},
nativePlayer() {
/**
* Creates a native video player.
* @method nativePlayer
* @param source {String} The source URL of the video stream.
* @param [typeIn] {String} Specify a video MIME type.
* @param [widthIn] {String} Specify a custom width.
* @param [heightIn] {String} Specify a custom height.
*/
nativePlayer(source, typeIn, widthIn, heightIn) {
let type;
if (typeIn) {
type = typeIn;
} else {
const temp = source.split(".");
switch (temp[temp.length - 1]) {
case "webm":
type = "video/webm";
break;
case "mp4":
type = "video/mp4";
break;
case "ogg":
type = "video/ogg";
break;
default:
type = "video/mp4";
break;
}
}
const width = widthIn || "100%";
const height = heightIn || "auto";
return `<video width='${width}' height='${height}' controls><source src='${source}' type='${type}'></video>`;
},
/**
@ -517,8 +750,74 @@ var a = (function(window) {
*/
setInterval: unsafeWindow.setInterval,
sha256() {
/**
* Creates a SHA-256 hash signature of provided string.
* @method sha256
* @param r {String} The string to encrypt.
*/
sha256(r) {
//@pragma-keepline Based on work of Angel Marin and Paul Johnston
//@pragma-keepline More information: http://www.webtoolkit.info/javascript-sha256.html
function n(r, n) {
var t = (65535 & r) + (65535 & n),
e = (r >> 16) + (n >> 16) + (t >> 16);
return e << 16 | 65535 & t;
}
function t(r, n) {
return r >>> n | r << 32 - n;
}
function e(r, n) {
return r >>> n;
}
function o(r, n, t) {
return r & n ^ ~r & t;
}
function u(r, n, t) {
return r & n ^ r & t ^ n & t;
}
function a(r) {
return t(r, 2) ^ t(r, 13) ^ t(r, 22);
}
function f(r) {
return t(r, 6) ^ t(r, 11) ^ t(r, 25);
}
function c(r) {
return t(r, 7) ^ t(r, 18) ^ e(r, 3);
}
function i(r) {
return t(r, 17) ^ t(r, 19) ^ e(r, 10);
}
function h(r, t) {
var e, h, C, g, d, v, A, l, m, S, y, w, b = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298),
p = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225),
s = new Array(64);
r[t >> 5] |= 128 << 24 - t % 32, r[(t + 64 >> 9 << 4) + 15] = t;
for (m = 0; m < r.length; m += 16) {
e = p[0], h = p[1], C = p[2], g = p[3], d = p[4], v = p[5], A = p[6], l = p[7];
for (S = 0; 64 > S; S++) 16 > S ? s[S] = r[S + m] : s[S] = n(n(n(i(s[S - 2]), s[S - 7]), c(s[S - 15])), s[S - 16]), y = n(n(n(n(l, f(d)), o(d, v, A)), b[S]), s[S]), w = n(a(e), u(e, h, C)), l = A, A = v, v = d, d = n(g, y), g = C, C = h, h = e, e = n(y, w);
p[0] = n(e, p[0]), p[1] = n(h, p[1]), p[2] = n(C, p[2]), p[3] = n(g, p[3]), p[4] = n(d, p[4]), p[5] = n(v, p[5]), p[6] = n(A, p[6]), p[7] = n(l, p[7]);
}
return p;
}
function C(r) {
for (var n = Array(), t = (1 << v) - 1, e = 0; e < r.length * v; e += v) n[e >> 5] |= (r.charCodeAt(e / v) & t) << 24 - e % 32;
return n;
}
function g(r) {
r = r.replace(/\r\n/g, "\n");
for (var n = "", t = 0; t < r.length; t++) {
var e = r.charCodeAt(t);
128 > e ? n += String.fromCharCode(e) : e > 127 && 2048 > e ? (n += String.fromCharCode(e >> 6 | 192), n += String.fromCharCode(63 & e | 128)) : (n += String.fromCharCode(e >> 12 | 224), n += String.fromCharCode(e >> 6 & 63 | 128), n += String.fromCharCode(63 & e | 128));
}
return n;
}
function d(r) {
for (var n = A ? "0123456789ABCDEF" : "0123456789abcdef", t = "", e = 0; e < 4 * r.length; e++) t += n.charAt(r[e >> 2] >> 8 * (3 - e % 4) + 4 & 15) + n.charAt(r[e >> 2] >> 8 * (3 - e % 4) & 15);
return t;
}
var v = 8,
A = 0;
return r = g(r), d(h(C(r), r.length * v));
},
/**
@ -561,12 +860,33 @@ var a = (function(window) {
return true;
},
/**
* Generated a unique ID string.
* @method uid
* @return {String} The unique id.
*/
uid() {
const chars = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let str = "";
for (let i = 0; i < 10; i++) {
str += chars.charAt(this.win.Math.floor(this.win.Math.random() * chars.length));
}
this.uid.counter++;
return str + this.uid.counter.toString();
},
videoJS() {
/**
* Creates a videoJS player.
* @method videoJS
*
*/
videoJS(sources, types, width, height) {
let html = `<video id="uBlock_Protector_Video_Player" class="video-js vjs-default-skin" controls preload="auto" width="${width}" height="${height}" data-setup="{}">`;
for (let i = 0; i < sources.length; i++) {
html += `<source src="${sources[i]}" type="${types[i]}">`;
}
html += `</video>`;
return html;
},
/**
@ -577,7 +897,7 @@ var a = (function(window) {
};
// Defaults for config
// Static properties for aak.config
aak.config.aggressiveAdflySkipper = true;
aak.config.allowExperimental = true;
aak.config.allowGeneric = true;
@ -597,27 +917,27 @@ var a = (function(window) {
}
};
// Defaults for observe
// Static properties for aak.observe
aak.observe.init = () => {
const observer = new this.win.MutationObserver(function(mutations) {
const observer = new aak.win.MutationObserver(function(mutations) {
for (let i=0; i<mutations.length; i++) {
if (mutations[i].addedNodes.length) {
for (let ii=0; ii<this.observe.insertCallbacks.length; ii++) {
for (let ii=0; ii<aak.observe.insertCallbacks.length; ii++) {
for (let iii=0; iii<mutations[i].addedNodes.length; iii++) {
this.observe.insertCallbacks[ii](mutations[i].addedNodes[iii]);
aak.observe.insertCallbacks[ii](mutations[i].addedNodes[iii]);
}
}
}
if (mutations[i].removedNodes.length) {
for (let ii = 0; ii < this.observe.removeCallbacks.length; ii++) {
for (let ii = 0; ii < aak.observe.removeCallbacks.length; ii++) {
for (let iii = 0; iii < mutations[i].removedNodes.length; iii++) {
this.observe.removeCallbacks[ii](mutations[i].removedNodes[iii]);
aak.observe.removeCallbacks[ii](mutations[i].removedNodes[iii]);
}
}
}
}
});
observer.observe(this.doc, {
observer.observe(aak.doc, {
childList: true,
subtree: true
});
@ -626,11 +946,25 @@ var a = (function(window) {
aak.observe.insertCallbacks = [];
aak.observe.removeCallbacks = [];
// Defaults for protectFunc
// Static properties for aak.protectFunc
aak.protectFunc.enabled = false;
aak.protectFunc.pointers = [];
aak.protectFunc.masks = [];
// Static properties for aak.uuid
aak.uuid.counter = 0;
// Static properties for aak.videoJS
aak.videoJS.init = (...args) => {
try {
aak.win.HELP_IMPROVE_VIDEOJS = false;
} catch (err) { }
let plugins = args.join();
aak.$("head").append(`<link href="//vjs.zencdn.net/5.4.6/video-js.min.css" rel="stylesheet"><script src="//vjs.zencdn.net/5.4.6/video.min.js"><\/script>${plugins}`);
};
aak.videoJS.plugins = {};
aak.videoJS.plugins.hls = `<script src="//cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.4.0/videojs-contrib-hls.min.js"><\/script>`;
return aak;
})(window);