AdguardTeam / CoreLibs

Core Adguard libraries
https://adguard.com/
Apache License 2.0
39 stars 7 forks source link

JS rule ignores domain restriction #187

Closed ameshkov closed 6 years ago

ameshkov commented 6 years ago

@ameshkov commented on Wed Jul 27 2016

I this rule's code on youtube.com:

q.gs,j.gs,adf.ly,sh.st#%#!function(){var loc=document.location.href,interval,secinterval,bypassers={adfly:function(){var e=/var zzz = ['"]([^'"]+)['"]/,t=/\/locked(?:\/|\?url=)([a-zA-Z0-9\-_]+)/,r=/\d+\/(http.+?)$/i,n=/\d+\/([a-zA-Z\-]+\.[a-zA-Z\-]+.*)/i,a=/blocked\.php(?:\?t=1)?$/;if(loc.match(t)){clearInterval(interval);var o=t.exec(loc)[1];document.title="** Waiting .. **",secinterval=setInterval(function(){"none"!=document.getElementById("continue").style.display&&bypassers.doRedirect("http://adf.ly/"+o)},1e3)}else if(loc.match(r))clearInterval(interval),bypassers.doRedirect(r.exec(loc)[1]);else if(loc.match(n))clearInterval(interval),bypassers.doRedirect("http://"+n.exec(loc)[1]);else if(document.head.innerHTML.match(e))document.title="** adfly bypasser: Bypassing the link... **",clearInterval(interval),bypassers._inject(function(){var e={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(t){var r,n,a,o,i,c,s,d="",l=0;for(t=e._utf8_encode(t);l<t.length;)r=t.charCodeAt(l++),n=t.charCodeAt(l++),a=t.charCodeAt(l++),o=r>>2,i=(3&r)<<4|n>>4,c=(15&n)<<2|a>>6,s=63&a,isNaN(n)?c=s=64:isNaN(a)&&(s=64),d=d+this._keyStr.charAt(o)+this._keyStr.charAt(i)+this._keyStr.charAt(c)+this._keyStr.charAt(s);return d},decode:function(t){var r,n,a,o,i,c,s,d="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),i=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),s=this._keyStr.indexOf(t.charAt(l++)),r=o<<2|i>>4,n=(15&i)<<4|c>>2,a=(3&c)<<6|s,d+=String.fromCharCode(r),64!=c&&(d+=String.fromCharCode(n)),64!=s&&(d+=String.fromCharCode(a));return d=e._utf8_decode(d)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);128>n?t+=String.fromCharCode(n):n>127&&2048>n?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t},_utf8_decode:function(e){for(var t="",r=0,n=c1=c2=0;r<e.length;)n=e.charCodeAt(r),128>n?(t+=String.fromCharCode(n),r++):n>191&&224>n?(c2=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&c2),r+=2):(c2=e.charCodeAt(r+1),c3=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&c2)<<6|63&c3),r+=3);return t}};window.onbeforeunload=null;var t=ysmm,r=t.indexOf("?"),n=t.indexOf("!HiTommy");if(-1!=n&&(t=t.substr(0,n)),-1!=r&&(t=t.substr(0,r)),"true"==easyUrl)document.head.innerHTML="<title>** Redirect in progress</title>",document.body.innerHTML="Ignorando este link (redirecionando para "+t+"), aguarde...",window.location=t;else{for(var a="",o="",i=0;i<t.length;i++)i%2==0?a+=t.charAt(i):o=t.charAt(i)+o;var c=a+o;c=e.decode(c),c=c.substring(c.length-(c.length-2)),document.head.innerHTML="<title>** Redirect in progress</title>",document.body.innerHTML="Ignorando este link (redirecionando para "+c+"), aguarde...",window.location=c}});else if(loc.match(a)){clearInterval(interval);var i="** ERROR: adf.ly detected our bypassing attempt.\n";i+="Please report the problem on the following url: http://userscripts.org/scripts/discuss/122331 and INCLUDE the adfly link.\n",i+="Thanks, Robertof (the script author - and note that I'm NOT an Arabian guy or something)",alert(i)}else clearInterval(interval),alert("Something went wrong! Please report the problem on the following url: http://userscripts.org/scripts/discuss/122331 and INCLUDE the adfly link!")},lienscash:function(){var e=/<a href="([^"]+)">skip/;document.body.innerHTML.match(e)&&(clearInterval(interval),bypassers.doRedirect(e.exec(document.body.innerHTML)[1]))},adfocus:function(){var e=/var click_url = ["']([^"']+)["']/;document.body.innerHTML.match(e)&&bypassers.doRedirect(e.exec(document.body.innerHTML.replace(/\/\/var\sclick_url\s=.+/,""))[1])},shst:function(){var e=/<a class="skip-btn" href="([^"]+)" id="skip_button">/;document.body.innerHTML.match(e)&&(clearInterval(interval),bypassers.doRedirect(e.exec(document.body.innerHTML)[1]))},bcvc:function(){bypassers._inject(function(){var ajaxrx=/\{(opt:'make.+)/;if(document.body.innerHTML.match(ajaxrx)){var p=ajaxrx.exec(document.body.innerHTML)[1];p=p.substr(0,p.length-1);var _a=eval("({"+p+")");document.head.innerHTML="<title>** Bypassing, please wait..</title>",document.body.innerHTML="Eu vou ignorar este site ruim, por favor, aguarde alguns segundos...<br /><strong style='font-size:18px;' id='sReplace'>0</strong>";var gayCallback=function(myself,retShit,count){document.getElementById("sReplace").innerHTML="Try #"+count+": "+(1==count?"a few more..":2==count?"just a few tries left..":3==count?"so close..":4==count?"almost done..":5==count?"GOTCHA! (probably)":count>5?"wait, what?":"a moment.."),$.post("http://bc.vc/fly/ajax.fly2.php",retShit,function(res){var jsono=eval("("+res+")");return jsono.message?(document.head.innerHTML="<title>** Redirect in progress **</title>",document.body.innerHTML="Ignorando este link (redirecionando para "+jsono.message.url+"), aguarde...",void(window.location=jsono.message.url)):void setTimeout(function(){myself(myself,retShit,++count)},1e3)})};gayCallback(gayCallback,_a,0)}})},doRedirect:function(e){document.head.innerHTML="<title>** Redirect in progress **</title>",document.body.innerHTML="Ignorando este link (redirecionando para "+e+"), agurade...",window.location=e},_inject:function(e){var t=document.createElement("script");t.appendChild(document.createTextNode("("+e+")();")),(document.body||document.head||document.documentElement).appendChild(t)}};-1!==loc.indexOf("adf.ly")||-1!==loc.indexOf("q.gs")||-1!==loc.indexOf("9.bb")||-1!==loc.indexOf("u.bb")||-1!==loc.indexOf("j.gs")?interval=setInterval(bypassers.adfly,1e3):-1!==loc.indexOf("lienscash.com")?interval=setInterval(bypassers.lienscash,1e3):-1!==loc.indexOf("bc.vc")?bypassers.bcvc():-1!==loc.indexOf("sh.st")?bypassers.shst():bypassers.adfocus()}();
ameshkov commented 6 years ago

Not reproduce with a CoreLibs integrated Android build