Example #1
0
define('URLREG', '/^' . '(?:([a-z]*)?(?:\\:?\\/\\/))' . '(?:([^\\@\\/]*)\\@)?' . '([^\\/:\\?\\#\\&]*)' . '(?:\\:([0-9]+))?' . '(\\/[^\\&\\?\\#]*?)?' . '([^\\/\\?\\#\\&]*(?:\\&[^\\?\\#]*)?)' . '(?:\\?([\\s\\S]*?))?' . '(?:\\#([\\s\\S]*))?' . '$/ix');
function escape_regexp($regexp, $dollar = false)
{
    $regexp = str_replace('\\', '\\\\', str_replace('\'', '\\\'', str_replace('"', '\\"', str_replace(chr(10), '\\n', str_replace(chr(13), '\\r', str_replace(chr(9), '\\t', $regexp))))));
    return $dollar ? preg_replace('/[\\\\]+(?=[0-9])/', '\\\\$', $regexp) : preg_replace('/[\\\\]+(?=[0-9])/', '\\\\\\\\', $regexp);
    #*
}
# }}}
# JAVASCRIPT FUNCS {{{
if (QUERY_STRING == 'js_funcs' || QUERY_STRING == 'js_funcs_framed') {
    ?>
//<script>

// JAVASCRIPT FUNCS: DECODING {{{
<?php 
    js_proxenc();
    ?>

<?php 
    echo COOK_PREF;
    ?>
_pe.b64d=function(string){
	var binrep="",decstr="";
	var charnum,charbin;
	string=string.replace(/[=]*$/,"");
	for(var i=0;i<string.length;i++){
		charnum=string.charCodeAt(i);
		if(charnum>=97) charnum-=71;
		else if(charnum>=65) charnum-=65;
		else if(charnum>=48) charnum+=4;
		else if(charnum==43) charnum=62;
Example #2
0
function js_proxenc()
{
    ?>
//<script>
<?php 
    echo COOK_PREF;
    ?>
_pe={
expon:function(a,b){
	var num;
	if(b==0) return 1;
	num=a; b--;
	while(b>0){ num*=a; b--; }
	return num;
},

dectobin:function(){
	var dec=arguments[0],chars=arguments[1]||8,binrep="";
	for(j=chars-1;j>=0;j--){
		if(dec>=this.expon(2,j)){
			binrep+="1"; dec-=this.expon(2,j);
		}
		else binrep+="0";
	}
	return binrep;
},

bintodec:function(){
	var bin=arguments[0],chars=arguments[1]||8,dec=0;
	for(var j=0;j<chars;j++) if(bin.substring(j,j+1)=="1") dec+=this.expon(2,chars-1-j);
	return dec;
},

b64e:function(string){
	var encstr="",binrep="";
	var charbin,charnum;
	for(var i=0;i<string.length;i++){
		charnum=string.charCodeAt(i);
		binrep+=this.dectobin(charnum);
	}
	while(binrep.length%6) binrep+="00";
	for(var i=1;i*6<=binrep.length;i++){
		charbin=binrep.substring((i-1)*6,i*6);
		charnum=this.bintodec(charbin,6);
		if(charnum<=25) charnum+=65;
		else if(charnum<=51) charnum+=71;
		else if(charnum<=61) charnum-=4;
		else if(charnum==62) charnum=43;
		else if(charnum==63) charnum=47;
		encstr+=String.fromCharCode(charnum);
	}
	while(encstr.length%8) encstr+="=";
	return encstr;
},

proxenc:function(url){
	var new_url="";
	var charnum;
	if(url.substring(0,1)=="~" || url.substring(0,3).toLowerCase()=="%7e") return url;
	url=encodeURIComponent(url);
	var sess_pref="<?php 
    echo SESS_PREF;
    ?>
";
	for(i=0;i<url.length;i++){
		charnum=url.charCodeAt(i);
		charnum+=sess_pref.charCodeAt(i%sess_pref.length);
		while(charnum>126) charnum-=94;
		new_url+=String.fromCharCode(charnum);
	}
	return "~"+encodeURIComponent(this.b64e(new_url));
}
}
<? }

# }}}

# FIRST PAGE DISPLAYED WHEN ACCESSING PROXY {{{

if(PAGETYPE_ID===PAGETYPE_FORCE_MAIN || (substr(QUERY_STRING,0,3)!='js_' && ORIG_URL==null)){

$useragentinfo=null;
if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')!==false || stristr($_SERVER['HTTP_USER_AGENT'],'win32')!==false) $useragentinfo.='Windows';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'macintosh')!==false || stristr($_SERVER['HTTP_USER_AGENT'],'mac_powerpc')!==false) $useragentinfo.='Macintosh';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'linux')!==false) $useragentinfo.='Linux';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'bsd')!==false) $useragentinfo.='BSD';
else $useragentinfo.='Unknown';

$useragentinfo.=' / ';

if(stristr($_SERVER['HTTP_USER_AGENT'],'msie')!==false) $useragentinfo.='Internet Explorer';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'firefox')!==false) $useragentinfo.='Firefox';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'netscape')!==false) $useragentinfo.='Netscape';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'opera')!==false) $useragentinfo.='Opera';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'konqueror')!==false) $useragentinfo.='Konqueror';
elseif(stristr($_SERVER['HTTP_USER_AGENT'],'seamonkey')!==false) $useragentinfo.='SeaMonkey';
else $useragentinfo.='Unknown';

$useragent_array=array(
	array(null,"Actual ({$useragentinfo})"),
	array('-1',' [ Don\'t Send ] '),
	array('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0','Windows XP / Firefox 2.0'),
	array('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1)','Windows XP / Internet Explorer 7'),
	array('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)','Windows XP / Internet Explorer 6'),
	array('Opera/9.02 (Windows NT 5.1; U; en)','Windows XP / Opera 9.02'),
	array('Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0','Mac OS X / Firefox 2.0'),
	array('Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/521.25 (KHTML, like Gecko) Safari/521.24','Mac OS X / Safari 3.0'),
	array('Opera/9.02 (Macintosh; PPC Mac OS X; U; en)','Mac OS X / Opera 9.02'),
	array('Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0','Linux / Firefox 2.0'),
	array('Opera/9.02 (X11; Linux i686; U; en)','Linux / Opera 9.02'),
	array('Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko)','Linux / Konqueror 3.5.5'),
	array('Links (2.1pre19; Linux 2.6 i686; x)','Linux / Links (2.1pre19)'),
	array('Lynx/2.8.5rel.1','Any / Lynx 2.8.5rel.1'),
	array('Dillo/0.8.6','Any / Dillo 0.8.6'),
	array('Wget/1.10.2','Any / Wget 1.10.2'),
	array('1',' [ Custom ] <noscript><b>**</b></noscript>')
);

define('IPREGEXP','/^((?:[0-2]{0,2}[0-9]{1,2}\.){3}[0-2]{0,2}[0-9]{1,2})\:([0-9]{1,5})$/');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>Surrogafier</title>
<meta name="robots" content="index, nofollow" />
<style>
	body{font-family: bitstream vera sans, trebuchet ms}
	input{border: 1px solid #000000}
	select{border: 1px solid #000000}
	a{color: #000000}
	a:hover{text-decoration: none}
	.advanced_stuff{display: <?php 
    echo SIMPLE_MODE ? 'none' : 'table-row';
    ?>
}
	.simple_stuff{display: <?php 
    echo SIMPLE_MODE ? 'table-row' : 'none';
    ?>
}
	.url{width: <?php 
    echo SIMPLE_MODE ? SIMPLE_MODE_URLWIDTH : '99%';
    ?>
}
	.signature{float: left}
<?php 
    if (FORCE_SIMPLE) {
        ?>
	.noscript_stuff{display: none}
	.signature{text-align: center; float: none}
<?php 
    }
    ?>
</style>
<?php 
    if (!FORCE_SIMPLE) {
        ?>
<noscript><style>
	.advanced_stuff{display: table-row}
	.simple_stuff{display: none}
	.noscript_stuff{display: none}
	.noscripturl{width: 99%}
	.url{display: none}
	.signature{text-align: center; float: none}
</style></noscript><?php 
    }
    ?>
<script language="javascript">
<!--

<?php 
    js_proxenc();
    ?>

function useragent_check(focus){
	if(document.getElementsByName('<?php 
    echo COOK_PREF;
    ?>
_useragent')[0].value=='1'){
		document.getElementById('useragent_texttr').style.display="";
		if(focus) document.getElementById('<?php 
    echo COOK_PREF;
    ?>
_useragenttext').focus();
	}
	else document.getElementById('useragent_texttr').style.display='none';
}

<?php 
    if (!FORCE_SIMPLE) {
        ?>
advanced_mode=true;
function toggle_mode(){
	document.getElementById("mode_toggler").innerHTML=(advanced_mode?"Advanced Mode":"Simple Mode");
	var advanced_stuff=document.getElementsByTagName("tr");
	for(var i=1;i<=12;i++) advanced_stuff[i].style.display=(advanced_mode?"none":"");
	document.getElementById("simple_submit").style.display=(advanced_mode?"inline":"none");
	document.getElementById("url").style.width=(advanced_mode?"<?php 
        echo SIMPLE_MODE_URLWIDTH;
        ?>
":"99%");
	advanced_mode=!advanced_mode;
	if(advanced_mode) useragent_check(false);
	setTimeout("document.getElementById('url').focus();",100);
}
<?php 
    }
    ?>

function submit_code(){
	document.forms[0].<?php 
    echo COOK_PREF;
    ?>
.disabled=false;
	if(document.forms[0].<?php 
    echo COOK_PREF;
    ?>
_encrypt_urls.checked)
		document.forms[0].<?php 
    echo COOK_PREF;
    ?>
.value=<?php 
    echo COOK_PREF;
    ?>
_pe.proxenc(document.getElementById('url').value);
	else
		document.forms[0].<?php 
    echo COOK_PREF;
    ?>
.value=document.getElementById('url').value;
	return true;
}

//-->
</script>
</head>
<body<?php 
    echo SIMPLE_MODE ? ' onload="toggle_mode();"' : null;
    ?>
>
<center>
<span style="font-size: 18pt; font-weight: bold; margin-bottom: 5px">Surrogafier</span>
<form method="post" onsubmit="return submit_code();" style="margin: 0px; padding: 0px">
<input type="hidden" name="<?php 
    echo COOK_PREF;
    ?>
_set_values" value="1" />
<input type="hidden" name="<?php 
    echo COOK_PREF;
    ?>
" disabled="disabled" />
<table>
<tr>
<td style="text-align: left">URL:&nbsp;&nbsp;</td>
<td>
	<input type="text" class="url" id="url" value="<?php 
    echo ORIG_URL;
    ?>
" />
	<noscript><input type="text" class="noscripturl" name="<?php 
    echo COOK_PREF;
    ?>
" id="url" value="<?php 
    echo ORIG_URL;
    ?>
" /></noscript>
	<input type="submit" class="simple_stuff" id="simple_submit" value="Surrogafy" style="background-color: #F0F0F0" />
</td>
</tr>
<tr class="advanced_stuff"<?php 
    if (FORCE_DEFAULT_TUNNEL) {
        ?>
 style="display: none"><?php 
    }
    ?>
<td style="text-align: left">Tunnel Proxy:</td>
<td><table cellspacing="0" cellpadding="0">
<tr>
	<td style="width: 100%"><input type="text" name="<?php 
    echo COOK_PREF;
    ?>
_pip" onkeyup="if(this.value.match(<?php 
    echo IPREGEXP;
    ?>
)){ document.forms[0].<?php 
    echo COOK_PREF;
    ?>
_pport.value=this.value.replace(<?php 
    echo IPREGEXP;
    ?>
,'\$2'); this.value=this.value.replace(<?php 
    echo IPREGEXP;
    ?>
,'\$1'); document.forms[0].<?php 
    echo COOK_PREF;
    ?>
_pport.focus(); };" style="width: 100%; text-align: left" value="<?php 
    echo empty($_COOKIE[COOK_PREF . '_pip']) ? DEFAULT_TUNNEL_PIP : $_COOKIE[COOK_PREF . '_pip'];
    ?>
" /></td>
	<td style="width: 5px">&nbsp;&nbsp;</td>
	<td style="width: 50px"><input type="text" name="<?php 
    echo COOK_PREF;
    ?>
_pport" maxlength="5" size="5" style="width: 50px" value="<?php 
    echo empty($_COOKIE[COOK_PREF . '_pport']) ? DEFAULT_TUNNEL_PPORT : $_COOKIE[COOK_PREF . '_pport'];
    ?>
" /></td>
</tr>
</table></td>
</tr>
<tr class="advanced_stuff">
<td style="text-align: left">User-Agent:</td>
<td><select name="<?php 
    echo COOK_PREF;
    ?>
_useragent" style="width: 100%" onchange="useragent_check(true);">
<?php 
    foreach ($useragent_array as $useragent) {
        ?>
	<option value="<?php 
        echo $useragent[0];
        ?>
"<?php 
        if ($_COOKIE[COOK_PREF . '_useragent'] == $useragent[0]) {
            echo ' selected="selected"';
        }
        ?>
><?php 
        echo $useragent[1];
        ?>
</option>
<?php 
    }
    ?>
</select></td>
</tr>
<tr class="advanced_stuff" id="useragent_texttr"<?php 
    echo $_COOKIE[COOK_PREF . '_useragent'] == '1' ? null : ' style="display: none"';
    ?>
>
	<td>&nbsp;</td>
	<td><input type="text" id="<?php 
    echo COOK_PREF;
    ?>
_useragenttext" name="<?php 
    echo COOK_PREF;
    ?>
_useragenttext" value="<?php 
    echo $_COOKIE[COOK_PREF . '_useragenttext'];
    ?>
" style="width: 99%" /></td>
</tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_url_form" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_url_form'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Persistent URL Form</td></tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_remove_cookies" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_remove_cookies'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Remove Cookies</td></tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_remove_referer" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_remove_referer'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Remove Referer Field</td></tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_remove_scripts" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_remove_scripts'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Remove Scripts (JS, VBS, etc)</td></tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_remove_objects" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_remove_objects'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Remove Objects (Flash, Java, etc)</td></tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_encrypt_urls" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_encrypt_urls'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Encrypt URLs<noscript><b>**</b></noscript></td></tr>
<tr class="advanced_stuff"><td>&nbsp;</td><td style="text-align: left"><input type="checkbox" name="<?php 
    echo COOK_PREF;
    ?>
_encrypt_cooks" style="border: 0px" <?php 
    if (!empty($_COOKIE[COOK_PREF . '_encrypt_cooks'])) {
        echo 'checked="checked" ';
    }
    ?>
/>&nbsp;Encrypt Cookies<noscript><b>**</b></noscript></td></tr>
<tr class="advanced_stuff"><td colspan="2"><input type="submit" value="Surrogafy" style="width: 100%; background-color: #F0F0F0" /></td></tr>
<tr><td style="font-size: 8pt" colspan="2">
<div class="signature"><a href="http://bcable.net/">Surrogafier v<?php 
    echo VERSION;
    ?>
 <b>&middot;</b> Brad Cable</a></div>
<div class="noscript_stuff" style="float: right"><a href="#" onclick="toggle_mode();" id="mode_toggler"><?php 
    echo SIMPLE_MODE ? 'Advanced' : 'Simple';
    ?>
 Mode</a></div>
</td></tr>
</table>
<noscript>
<br />
<b>**</b> Surrogafier has detected that your browser does not have Javascript enabled. <b>**</b>
<br />
<b>**</b> Surrogafier requires Javascript in order to function to its full potential. <b>**</b>
</noscript>
</form>
</center>
</body>
</html>

<?php 
    exit;
}