Athlon1600 / php-proxy

A web proxy script written in PHP and built as an alternative to Glype.
https://www.php-proxy.com
MIT License
298 stars 158 forks source link

Proxied website "jumps" outside the proxy #43

Closed webaddicto closed 7 years ago

webaddicto commented 7 years ago

I was testing a few sites and noticed that if I browse with the proxy porntube.com or baidu.com then the addressbar of the web browser is changed to the proxied website (i.e baidu.com). Looks like an anti-proxy js script or similar. Seems like if it "jumps" outside the proxy.

webaddicto commented 7 years ago

Found the Javascript code that checks the window location and redirects to the main site (jumping outside the proxy), here it is:

if (typeof window.isIframe == 'undefined' && top.location.host != 'www.site.com') {
    top.location.host = 'www.site.com';
}

And another one:

var dm=document.location.hostname.toLowerCase(),dr='elgoog',dl='oohay';
dr = dr.split('').reverse().join('');
if (dm.indexOf(dr) < 0) top.location = "//" + dl.split('').reverse().join('') + ".com/?s";

And another one:

if(["site1.com","site2.com"].indexOf(document.location.hostname)==-1 || window.self!==window.top){window.top.location.replace("https://site2.com/");};

A simple fix would be to create a plugin that removes all scripts on that sites, i.e:

$output = preg_replace('/<script.*?<\/script>/sm', '', $output);