elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: [1] 2 3 4 5 6 7
1  Programación / Programación Visual Basic / Detras de un firewall!! en: 31 Julio 2007, 23:36 pm
Al tener IP falsa es posible decirle al Pc que tengo en mi casa que se conecte a mi, tengo el puerto 80 y el 21 de mi RED abiertos....sugerencias...

Gracias de antemano...
2  Programación / Ingeniería Inversa / Aclarenme esto pls!! en: 31 Julio 2007, 23:22 pm
Bueno gente a lo que voy si yo estoy por detras de un firewall (IP FALSA, logicamente) puedo de alguna manera hacer que el Pc que esta en mi casa de conecte a mi....

Tengo el puerto 21 y el 80 abiertos.....

Ideas.... Pls no tengo ni el 22 ni el 443 abiertos.... arriba estan los 2 unicos..


Gracias cualquier respuesta siempre ayuda a idear ideas...

Thx
3  Programación / Ingeniería Inversa / Re: Tengo un programa compilado en Microsoft Visual C++ v6.0 necesito un desambl en: 28 Junio 2007, 20:55 pm
Con el Olly podre ver el codigo fuente???

Saludos
4  Programación / Ingeniería Inversa / Tengo un programa compilado en Microsoft Visual C++ v6.0 necesito un desambl.... en: 28 Junio 2007, 19:40 pm
Que desamblador me recomiendan...GRacias...
5  Programación / Programación Visual Basic / Re: Cliente--Proxy--Servidor HTTP Pa' ABAJO!! en: 28 Junio 2007, 18:08 pm
Bueno vamos haber señores que esto no puede ser el fin del mundo, voy a dar mas informacion, hay varios programas www.your-freedom.net, http://www.totalrc.net/main_ref.jsp?menu=11 entre otros segun lo que dicen es que convierten peticiones Socks en HTTP ahora bien antes de que empiezen hablar mal de mi, sigue siendo lo mismo pues estos programas hace vamos a decir mucho menos de 5 peticiones HTTP, casi siempre 1 o 2... y ya, se conectan, te habilitan 1 puerto SOCKS el tipico 1080 para las aplicaciones como el YAHOO, Internet Explorer, y todos los demas y todo el trafico que generan estas ultimas aplicaciones pasan por esa 1 y primera conexion un TUNNEL....que me dicen de esto, haber si han chocado con algun proyecto sobre esto...

GRacias por sus respuesta tienen razon, aunque si pasan determinados parametros al proxy como el KEEP-ALIVE, si configuran en un SERVER APACHE el KEEP-ALIVE-TIME-OUT para un tiempo X puede durar el tiempo que desees siempre y cuando estes pasando datos, claro que no evito el trafico en el proxy....que es lo que yo necesito...

Gracias y sigan mirando el tema que creo es interensante, nos sirve para burlar nuestro proxy y bueno para lo que lo busco yo por lios de trabajo....Bye
6  Programación / Programación Visual Basic / Cliente--Proxy--Servidor HTTP Pa' ABAJO!! en: 22 Junio 2007, 00:19 am
Ya tengo casi echa una aplicacion cliente--proxy--servidor donde se comunican logicamente usando HTTP, el asunto es que necesito mantener una unica conexion entre ellos y no tengo la menor idea de como, lo que busco exactamente que parametros le tengo que pasar al proxy para que no me cierre esa conexion....o si necesito de SOCKETS o alguna otra cosa...IDEAS SOLUCIONES tirenme algoooo....

Thx

Por favor si alguien me responde (que se lo agradezco mucho XD) que las respuesta sean fundadas, pruebenla o basense en algo solido para no perder tiempo y aprovechar al maximo cada escrito....

GRacias espero haber sido claro...respecto a mi duda!!!
7  Programación / PHP / Ssh con PHP!!! en: 21 Junio 2007, 23:49 pm
Vale ya he logrado conectarme a mi SERVER SSH he pasado algunos comandillos, entre otras boberias....

A lo que voy es posible hacer tunneling (forwarding), o sea navegar por internet, chatear, cmo si fuera un tipico soft como el putty entre otros..

Estuve mirando la opcion del Tunnel pero no encuentro una idea para usarlo...

Una vez que me logueo en el Server SSH...y por ejemplo ejecuto algun comando la conexion se cierra o se mantiene??????

GRacias!!!
8  Programación / PHP / Re: Mi contribucion!! ahh muchas gracias al zezudo que lo hizo!!! Web Proxy!! en: 19 Junio 2007, 21:19 pm
Si haber creo que tengo la interrogante casi completa..

Estos Web Proxys estan echos para abrir Sitios que a los que no tenemos acceso, ahora por ejemplo si abro la pagina http://es.mail.yahoo.com y pongo mis credenciales el Script se marea no hay manera de que entre como a la pagina www.meebo.com, sin embargo desde el demo que tienen en la pagina oficial http://surrogafier.bypasser.org/ creo que a la hora de tramitar con opciones del Sitio Web como los de registro, inicio de sesion y cosas de esas, presenta problemas al ejercerlas....

Espero haber sido un poco mas claro...

Gracias de antemano...

Si conocen de alguno que si me permita entrar a sitios como estos se los agradecere...

bye
9  Programación / PHP / Re: Mi contribucion!! ahh muchas gracias al zezudo que lo hizo!!! Web Proxy!! en: 19 Junio 2007, 00:37 am
Hla espero q algunos les alla gustado el tema, bueno a lo que iba una amistad mia tiene montado la web en su Server y cuando le pido la pagina www.meebo.com no me la abre correctamente que puede ser la causa de esto....

No me carga ningun elemento interno como tal..

Help!!!
10  Programación / PHP / Mi contribucion!! ahh muchas gracias al zezudo que lo hizo!!! Web Proxy!! en: 18 Junio 2007, 21:39 pm
Aqui les dejo sobre el tema que yo estaba hablando sobre decirle al servidor que abriera un X web y me la mostrara sin yo meterme en eso, puesto que mi firewall es un dolor de ass...

Este es el Script

<?php

#
# Surrogafier v1.0-rc3
#
# Author: Brad Cable
# Email: brad@bcable.net
# License: Modified BSD
# License Details:
# http://bcable.net/license.php
#


# CONFIG {{{

# Default to simple mode when the page is loaded. [false]
define('DEFAULT_SIMPLE',false);
# Force the page to always be in simple mode (no advanced mode option). [false]
define('FORCE_SIMPLE',false);
# Width for the URL box when in simple mode (CSS "width" attribute). [300px]
define('SIMPLE_MODE_URLWIDTH','300px');

# Default value for tunnel server. []
define('DEFAULT_TUNNEL_PIP','');
# Default value for tunnel port. []
define('DEFAULT_TUNNEL_PPORT','');
# Should the tunnel fields be displayed? "false" value here will force the defaults above [true]
define('FORCE_DEFAULT_TUNNEL',true);

# Default value for "Persistent URL" checkbox [true]
define('DEFAULT_URL_FORM',true);
# Default value for "Remove Cookies" checkbox [false]
define('DEFAULT_REMOVE_COOKIES',false);
# Default value for "Remove Referer Field" checkbox [false]
define('DEFAULT_REMOVE_REFERER',false);
# Default value for "Remove Scripts" checkbox [false]
define('DEFAULT_REMOVE_SCRIPTS',false);
# Default value for "Remove Objects" checkbox [false]
define('DEFAULT_REMOVE_OBJECTS',false);
# Default value for "Encrypt URLs" checkbox [false]
define('DEFAULT_ENCRYPT_URLS',false);
# Default value for "Encrypt Cookies" checkbox [false]
define('DEFAULT_ENCRYPT_COOKS',false);

/*/ Address Blocking Notes \*\

Formats for address blocking are as follows:

  1.2.3.4     - plain IP address
  1.0.0.0/16  - subnet blocking
  1.0/16      - subnet blocking
  1/8         - subnet blocking
  php.net     - domain blocking

Default Value: '10/8','172/8','192.168/16','127/8','169.254/16'

\*\ End Address Blocking Notes /*/

$blocked_addresses=array('10/8','172/8','192.168/16','126/8','169.254/16');

# }}}

# ADVANCED CONFIG {{{

# The following options alter the way documents are parsed on the page.  ONLY EDIT THIS STUFF IF YOU REALLY KNOW WHAT YOU ARE DOING!

# 500 is the most reasonable number I could come up with as a maximum URL length limit
# I ran into a 1200+ character long URL once and it nearly melted the processor on my laptop trying to parse it
# Honestly, who needs this long of a URL anyway?
define('MAXIMUM_URL_LENGTH',500);

# Time limit in seconds for a single request and parse. [10]
define('TIME_LIMIT',10);
# Time limit in minutes for a DNS entry to be kept in the cache. [10]
define('DNS_CACHE_EXPIRE',10);

# Use gzip (if possible) to compress the connection between the proxy and the user (less bandwidth, more CPU) [false]
define('GZIP_PROXY_USER',false);
# Use gzip (if possible) to compress the connection between the proxy and the server (less bandwidth, more CPU) [false]
define('GZIP_PROXY_SERVER',false);

# Protocol that proxy is running on.  Uncomment this line to define it manually.
# If you leave this line commented, the code detects if you are running on an
# HTTPS connection.  If you are, then 'https' is used as the PROTO value,
# otherwise 'http' is used.  If you need a different value here, then define it.
#define('PROTO','http');

# }}}


// DON'T EDIT ANYTHING AFTER THIS POINT \\


#
# (unless you absolutely know what you are doing...)
#

# COOKIE & SESSION SETUP {{{

//$totstarttime=microtime(true); # BENCHMARK
//$blocked_addresses=array(); # DEBUG

# set error level to not display notices
error_reporting(E_ALL^E_NOTICE);

# set time limit to the defined time limit, if not in safe mode
if(!ini_get('safe_mode')) set_time_limit(TIME_LIMIT);

# use gzip compression if available
if(GZIP_PROXY_USER && extension_loaded('zlib') && !ini_get('zlib.output_compression')) ob_start('ob_gzhandler'); # use gzip encoding to compress all data, if possible

# reverse magic quotes if enabled
if(get_magic_quotes_gpc()){
   function stripslashes_recurse($var){
      if(is_array($var)) $var=array_map('stripslashes_recurse',$var);
      else $var=stripslashes($var);
      return $var;
   }
   $_GET=stripslashes_recurse($_GET);
   $_POST=stripslashes_recurse($_POST);
   $_COOKIE=stripslashes_recurse($_COOKIE);
}

# script environment constants
if(!defined('PROTO')) define('PROTO',($_SERVER['HTTPS']=='on'?'https':'http'));
define('VERSION','1.0-rc3');
define('THIS_SCRIPT',PROTO."://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}");
define('SIMPLE_MODE',DEFAULT_SIMPLE || FORCE_SIMPLE);

# Randomized cookie prefixes #
function gen_randstr($len){
   $chars=null;
   for($i=0;$i<$len;$i++){
      $char=rand(0,25);
      $char=chr($char+97);
      $chars.=$char;
   }
   return $chars;
}

function dosetcookie($cookname,$cookval,$expire=null){
   $_COOKIE[$cookname]=$cookval;
   if($expire===null) setcookie($cookname,$cookval);
   else setcookie($cookname,$cookval,$expire);
}

define('FIRST_LOAD',empty($_COOKIE['PHPSESSID']));
session_start();
if(empty($_SESSION['sesspref'])){
   $sesspref=gen_randstr(30);
   $_SESSION['sesspref']=$sesspref;
}
else $sesspref=$_SESSION['sesspref'];

if(empty($_COOKIE['user'])){
   $cookpref=gen_randstr(12);
   dosetcookie('user',$cookpref);
}
else $cookpref=$_COOKIE['user'];

define('SESS_PREF',$sesspref);
define('COOK_PREF',$cookpref);
define('COOKIE_SEPARATOR','__'.COOK_PREF.'__');
unset($sesspref,$cookpref);

if(FIRST_LOAD){
   if(DEFAULT_URL_FORM) dosetcookie(COOK_PREF.'_url_form',true);
   if(DEFAULT_REMOVE_COOKIES) dosetcookie(COOK_PREF.'_remove_cookies',true);
   if(DEFAULT_REMOVE_REFERER) dosetcookie(COOK_PREF.'_remove_referer',true);
   if(DEFAULT_REMOVE_SCRIPTS) dosetcookie(COOK_PREF.'_remove_scripts',true);
   if(DEFAULT_REMOVE_OBJECTS) dosetcookie(COOK_PREF.'_remove_objects',true);
   if(DEFAULT_ENCRYPT_URLS) dosetcookie(COOK_PREF.'_encrypt_urls',true);
   if(DEFAULT_ENCRYPT_COOKS) dosetcookie(COOK_PREF.'_encrypt_cooks',true);
}

# }}}

# ENVIRONMENT SETUP {{{

global $postandget,$blocked_addresses,$dns_cache_array;
$postandget=array_merge($_GET,$_POST);

define('PAGETYPE_MINIREGEXP','(=[_\.\-]?\&=|=)?');
define('PAGETYPE_REGEXP','/^'.PAGETYPE_MINIREGEXP.'(.*)$/');
if(!empty($postandget[COOK_PREF])) $oenc_url=$postandget[COOK_PREF];
else{
   $pagetype_str=preg_replace(PAGETYPE_REGEXP,'\1',$_SERVER['QUERY_STRING']);
   define('QUERY_STRING',substr($_SERVER['QUERY_STRING'],strlen($pagetype_str),strlen($_SERVER['QUERY_STRING'])-strlen($pagetype_str)));
   define('PAGETYPE_NULL',0);
   define('PAGETYPE_FORCE_MAIN',1);
   define('PAGETYPE_FRAME_TOP',2);
   define('PAGETYPE_FRAMED_PAGE',3);
   define('PAGETYPE_FRAMED_CHILD',4); # framing children for crimes isn't very nice, but the script does it anyway
   switch($pagetype_str){
      case '=&=': define('PAGETYPE_ID',PAGETYPE_FRAME_TOP); break;
      case '=_&=': define('PAGETYPE_ID',PAGETYPE_FRAMED_PAGE); break;
      case '=-&=': define('PAGETYPE_ID',PAGETYPE_FORCE_MAIN); break;
      case '=.&=': define('PAGETYPE_ID',PAGETYPE_FRAMED_CHILD); break;
# this is one more unencoded string for future features
#      case '=*&=': define('PAGETYPE_ID',); break;
      default: define('PAGETYPE_ID',PAGETYPE_NULL); break;
   }
   unset($pagetype_str);

   define('NEW_PAGETYPE_FRAME_TOP',(PAGETYPE_ID===PAGETYPE_FRAMED_CHILD?PAGETYPE_FRAMED_CHILD:PAGETYPE_FRAME_TOP));
   define('NEW_PAGETYPE_FRAMED_PAGE',(PAGETYPE_ID===PAGETYPE_FRAMED_CHILD?PAGETYPE_FRAMED_CHILD:PAGETYPE_FRAMED_PAGE));

   $oenc_url=QUERY_STRING;
   //define('OENC_URL',urldecode(preg_replace('/^([^&]*).*?$/i','\1',QUERY_STRING)));
}
if(strpos(substr($oenc_url,0,6),'%')!==false || strpos($oenc_url,'%')<strpos($oenc_url,'/') || strpos($oenc_url,'%')<strpos($oenc_url,':')) $oenc_url=urldecode($oenc_url);
define('OENC_URL',preg_replace('/^([^\?\&]+)\&/i','\1?',$oenc_url));
unset($oenc_url);
define('ORIG_URL',proxdec(OENC_URL));
global $curr_url;
$curr_url=ORIG_URL;

function gethardattr($attr){
   global $postandget;
   return (empty($postandget[COOK_PREF.'_set_values'])?!empty($_COOKIE[COOK_PREF."_{$attr}"]):!empty($postandget[COOK_PREF."_{$attr}"]));
}
define('ENCRYPT_URLS',gethardattr('encrypt_urls'));
define('URL_FORM',gethardattr('url_form'));
define('PAGE_FRAMED',(PAGETYPE_ID===PAGETYPE_FRAMED_PAGE || PAGETYPE_ID===PAGETYPE_FRAMED_CHILD || QUERY_STRING=='js_regexps_framed' || QUERY_STRING=='js_funcs_framed'));
#define('URLVAR',(ENCRYPT_URLS?'e':null).'url');

# }}}

# PHP DECODING FUNCTIONS {{{

function my_base64_decode($string){ return base64_decode(str_replace(' ','+',urldecode($string))); }

function proxdec($url){
   if($url{0}!='~' && strtolower(substr($url,0,3))!='%7e') return $url;
   #while(strpos($url,'%')!==false) $url=urldecode($url);
   #$url=urldecode($url);
   while($url{0}=='~' || strtolower(substr($url,0,3))=='%7e'){
      $url=substr($url,1);
      $url=my_base64_decode($url);
      $new_url=null;
      for($i=0;$i<strlen($url);$i++){
         $char=ord($url{$i});
         $char-=ord(substr(SESS_PREF,$i%strlen(SESS_PREF),1));
         while($char<32) $char+=94;
         $new_url.=chr($char);
      }
      $url=$new_url;
   }
   return urldecode($url);
}

# }}}

# javascript ENCODING FUNCTIONS {{{

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.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(); }

# }}}

# FRAMED PAGE WITH URL FORM {{{
if(PAGETYPE_ID===PAGETYPE_FRAME_TOP && ORIG_URL!=null){ ?>
<html>
<head>
<title><?php echo(ORIG_URL); ?></title>
<style>
   body{font-family: bitstream vera sans, trebuchet ms; margin: 0px; padding: 0px; font-size: 12px; overflow: hidden}
   input{border: 1px solid #000000}
   td{font-size: 12px}
   a{text-decoration: none; color: #000000}
   a:hover{text-decoration: underline}
</style>
<script>
<!--

<?php echo(COOK_PREF); ?>=true;

<?php if(ENCRYPT_URLS) js_proxenc(); ?>

function submit_code(){
<?php if(ENCRYPT_URLS){ ?>
   document.forms[0].<?php echo(COOK_PREF); ?>.value=<?php echo(COOK_PREF); ?>_pe.proxenc(document.forms[0].<?php echo(COOK_PREF); ?>.value);
<?php } ?>
   return true;
}

//-->
</script>
</head>
<body>
<form method="get" onsubmit="return submit_code();">
<input type="hidden" name="" value="" />
<table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%; padding: 0px; margin: 0px">
<tr><td><table cellpadding="0" cellspacing="0" style="width: 100%; padding: 3px">
<tr>
   <td>&nbsp;<b><a id="proxy_link" href="<?php echo(THIS_SCRIPT.'?=-&='.OENC_URL); ?>">Surrogafier</a></b>&nbsp;&nbsp;</td>
   <td style="width: 100%"><input type="text" class="url" name="" style="width: 100%; padding-left: 4px" id="url" value="<?php echo(ORIG_URL); ?>" /></td>
   <td>&nbsp;</td>
   <td><input type="submit" class="simple_stuff" id="simple_submit" value="Surrogafy" style="background-color: #F0F0F0" /></td>
</tr>
</table></td></tr>
<tr><td style="height: 100%; border-top: 1px solid #000000">
<iframe name="<?php echo(COOK_PREF); ?>_top" src="<?php echo(THIS_SCRIPT.'?=_&='.OENC_URL); ?>" frameborder="0" style="border: 0px; width: 100%; height: 100%"></iframe>
</td></tr>
</table>
</form>
</body>
</html>
<?php exit(); }

# }}}

# PRE-javascript CONSTANTS & FUNCTIONS {{{
# these constants and functions must be defined before JS is output, but would be more readably located later

#define('AURL_LOCK_REGEXP','(?:(?:javascript|mailto|about):|~|%7e)');
define('FRAME_LOCK_REGEXP','/^(?:(?:javascript|mailto|about):|#)/i');
define('AURL_LOCK_REGEXP','/^(?:(?:javascript|mailto|about):|#|'.str_replace(array('/','.'),array('\/','\.'),addslashes(THIS_SCRIPT)).')/i');
define('URLREG','/^'.
   '(?:([a-z]*)?(?:\:?\/\/))'.      # proto
   '(?:([^\@\/]*)\@)?'.         # userpass
   '([^\/:\?\#\&]*)'.         # servername
   '(?:\:([0-9]+))?'.         # portval
   '(\/[^\&\?\#]*?)?'.         # path
   '([^\/\?\#\&]*(?:\&[^\?\#]*)?)'.   # file
   '(?:\?([\s\S]*?))?'.         # query
   '(?:\#([\s\S]*))?'.         # label
'$/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;
      else if(charnum==47) charnum=63;
      binrep+=this.dectobin(charnum,6);
   }
   for(var i=0;i+8<binrep.length;i+=8){
      charbin=binrep.substr(i,8);
      decstr+=String.fromCharCode(this.bintodec(charbin));
   }
   return decstr;
}

<?php echo(COOK_PREF); ?>_pe.proxdec=function(url){
   var new_url,charnum;
   if(url.substr(0,1)!='~' && url.substr(0,3).toLowerCase()!='%7e') return url;
   while(url.substr(0,1)=='~' || url.substr(0,3).toLowerCase()=='%7e'){
      url=url.substr(1,url.length-1);
      url=this.b64d(url);
      new_url="";
      for(i=0;i<url.length;i++){
         charnum=url.charCodeAt(i);
         charnum-="<?php echo(SESS_PREF); ?>".charCodeAt(i%"<?php echo(SESS_PREF); ?>".length);
         while(charnum<32) charnum+=94;
         new_url+=String.fromCharCode(charnum);
      }
      url=new_url;
   }
   return decodeURIComponent(url); // urldecode()
}

// }}}

// javascript FUNCS: COOK_PREF OBJECT {{{

<?php echo(COOK_PREF); ?>={

URLREG:<?php echo(substr(URLREG,0,strlen(URLREG)-1)); ?>,
THIS_SCRIPT:"<?php echo(THIS_SCRIPT); ?>",
COOK_PREF:"<?php echo(COOK_PREF); ?>",
pe:<?php echo(COOK_PREF); ?>_pe,
gen_curr_urlobj:function(){ this.curr_urlobj=new this.aurl(this.CURR_URL); },

getCookieArr:function(){ return document.cookie.split("; "); },

aurl:function(url,topurl){
   this.URLREG=<?php echo(COOK_PREF); ?>.URLREG;
   this.THIS_SCRIPT=<?php echo(COOK_PREF); ?>.THIS_SCRIPT;
   this.ENCRYPT_URLS=<?php echo(COOK_PREF); ?>.ENCRYPT_URLS;

   this.trim=function(str){ return str.replace(/^\s*([\s\S]*?)\s*$/,"$1"); }

   this.get_fieldreq=function(fieldno,value){
      var fieldreqs=new Array();
      fieldreqs[2]="://"+(value!=""?value+"@":"");
      fieldreqs[4]=(value!="" && parseInt(value)!=80?":"+parseInt(value):"");
      fieldreqs[7]=(value!=""?"?"+value:"");
      fieldreqs[8]=(value!=""?"#"+value:"");
      if(fieldreqs[fieldno]!=undefined) return value;
      // return (value!=""?null:value);
      else return fieldreqs[fieldno];
   }

   this.set_proto=function(proto){
      if(proto==undefined) proto="http";
      if(this.locked) return;
      this.proto=proto;
   }
   this.get_proto=function(){ return this.proto; }

   this.get_userpass=function(){ return this.userpass; }
   this.set_userpass=function(userpass){ if(userpass==undefined) userpass=""; this.userpass=userpass; }
   this.get_servername=function(){ return this.servername; }
   this.set_servername=function(servername){ if(servername==undefined) servername=""; this.servername=servername; }
   this.get_portval=function(){ return ((this.portval=="")?(this.get_proto()=="https"?"443":"80"):this.portval); }
   this.set_portval=function(port){ if(port==undefined) port=""; this.portval=((parseInt(port)!=80)?port:"").toString(); }
   this.get_path=function(){ // ***
      if(this.path.indexOf("/../")!=-1) this.path=this.path.replace(/(?:\/[^\/]+){0,1}\/\.\.\//g,"/");
      if(this.path.indexOf("/./")!=-1) while((path=this.path.replace("/./","/")) && path!=this.path) this.path=path;
      return this.path;
   }
   this.set_path=function(path){ if(path==undefined) path="/"; this.path=path; }
   this.get_file=function(){ return this.file; }
   this.set_file=function(file){ if(file==undefined) file=""; this.file=file; }
   this.get_query=function(){ return this.query; }
   this.set_query=function(query){ if(query==undefined) query=""; this.query=query; }
   this.get_label=function(){ return this.label; }
   this.set_label=function(label){ if(label==undefined) label=""; this.label=label; }

   this.get_url=function(){
      if(this.locked) return this.url;
      return this.get_proto()+"://"+
             (this.get_userpass()==""?"":this.get_userpass()+"@")+
             this.get_servername()+
             (parseInt(this.get_portval())==80?"":":"+parseInt(this.get_portval()))+
             this.get_path()+this.get_file()+
             (this.get_query()==""?"":"?"+this.get_query())+
             (this.get_label()==""?"":"#"+this.get_label())
      ;
   }

   this.surrogafy=function(){
      var url=this.get_url();
      if(this.locked || this.get_proto()+this.get_fieldreq(2,this.get_userpass())+this.get_servername()+this.get_path()+this.get_file()==this.THIS_SCRIPT) return url;
      var label=this.get_label();
      this.set_label();
      if(this.ENCRYPT_URLS && !this.locked) url=<?php echo(COOK_PREF); ?>.pe.proxenc(url);
      //url=this.THIS_SCRIPT+"?="+(!this.ENCRYPT_URLS?escape(url):url); // urlencode()d
      url=this.THIS_SCRIPT+"?="+url; // urlencode()d
      this.set_label(label);
      return url;
   }

   if(url.length><?php echo(MAXIMUM_URL_LENGTH)?>){
      //alert(this.url); // DEBUG
      //alert(this.url.length); // DEBUG
      this.url="";
   }
   else{
      //this.url=preg_replace("/&#([0-9]+);/e","chr(\\1)" // parse like PHP does for &#num; HTML entities? // TODO?
      this.url=this.trim(url.replace("&amp;","&").replace("\r","").replace("\n",""));
   }

   this.topurl=topurl;
   this.locked=url.match(<?php echo(AURL_LOCK_REGEXP); ?>); //*

   if(!this.locked){
      var urlwasvalid=true;
      if(!this.url.match(this.URLREG)){
         urlwasvalid=false;
         if(this.topurl==undefined) this.url="http://"+((this.url.charAt(0)==":" || this.url.charAt(0)=="/")?this.url.substring(1):this.url)+(this.url.indexOf("/")!=-1?"":"/");
         else{
            var newurl=this.topurl.get_proto()+"://"+this.get_fieldreq(2,this.topurl.get_userpass())+this.topurl.get_servername()+((this.topurl.get_portval()!=80 && (this.topurl.get_proto()=="https"?this.topurl.get_portval()!=443:true))?":"+this.topurl.get_portval():"");
            if(this.url.substring(0,1)!="/") newurl+=this.topurl.get_path();
            this.url=newurl+this.url;
         }
      }

      this.set_proto((urlwasvalid || this.topurl==undefined?this.url.replace(/^([^:]+).*$/,"\$1"):this.topurl.get_proto()));
      this.set_userpass(this.url.replace(this.URLREG,"\$2"));
      this.set_servername(this.url.replace(this.URLREG,"\$3"));
      this.set_portval(this.url.replace(this.URLREG,"\$4"));
      this.set_path(this.url.replace(this.URLREG,"\$5"));
      this.set_file(this.url.replace(this.URLREG,"\$6"));
      this.set_query(this.url.replace(this.URLREG,"\$7"));
      this.set_label(this.url.replace(this.URLREG,"\$8"));
   }

   //if(!this.locked && !this.url.match(this.URLREG)) havok(7,this.url); //*
},

surrogafy_url:function(url,topurl,addproxy){
   url=url.toString();
   if(!url.substring) return;
   if(addproxy==undefined) addproxy=true;
   var urlquote="";
   if((url.substring(0,1)=="\"" || url.substring(0,1)=="'") && url.substring(0,1)==url.substring(url.length-1,url.length)){
      urlquote=url.substring(0,1);
      url=url.substring(1,url.length-1);
   }
   if(topurl==undefined) topurl=this.curr_urlobj;
   var urlobj=new this.aurl(url,topurl);
   var new_url=(addproxy?urlobj.surrogafy():urlobj.get_url());
   if(urlquote!="") new_url=urlquote+new_url+urlquote;
   return new_url;
},

surrogafy_url_toobj:function(url,topurl,addproxy){
   url=url.toString();
   if(!url.substring) return;
   if(addproxy==undefined) addproxy=true;
   if((url.substring(0,1)=="\"" || url.substring(0,1)=="'") && url.substring(0,1)==url.substring(url.length-1,url.length)) url=url.substring(1,url.length-1);
   if(topurl==undefined) topurl=this.curr_urlobj;
   return new this.aurl(url,topurl);
},

de_surrogafy_url:function(url){
   if(url==undefined) return "";
   url=url.toString();
   if(url.match(<?php echo(FRAME_LOCK_REGEXP); ?>) || !url.match(<?php echo(AURL_LOCK_REGEXP); ?>)) return url;
   return this.pe.proxdec(decodeURIComponent(url.substring(url.indexOf('?')+1).replace(<?php echo(PAGETYPE_REGEXP); ?>,"\$2"))); // urldecode()
},

add_querystuff:function(url,querystuff){
   var pos=url.indexOf('?');
   return url.substr(0,pos+1)+querystuff+url.substr(pos+1,url.length-pos);
},

preg_match_all:function(regexpstr,string){
   var matcharr=new Array();
   var regexp=new RegExp(regexpstr);
   var result;
   while(true){
      result=regexp.exec(string);
      if(result!=null) matcharr.push(result);
      else break;
   }
   return matcharr;
},

framify_url:function(url,frame_type){
   if((frame_type!==<?php echo(PAGETYPE_FRAME_TOP); ?> || !this.URL_FORM) && (frame_type!==<?php echo(PAGETYPE_FRAMED_PAGE); ?> && !this.PAGE_FRAMED)) return url;
   var urlquote="";
   if((url.substring(0,1)=="\"" || url.substring(0,1)=="'") && url.substring(0,1)==url.substring(url.length-1,url.length)){
      urlquote=url.substring(0,1);
      url=url.substring(1,url.length-1);
   }
   if(!url.match(<?php echo(FRAME_LOCK_REGEXP); ?>)){
      var query;
      if(frame_type===<?php echo(PAGETYPE_FRAME_TOP); ?> && this.URL_FORM) query='&=';
      else if(frame_type===<?php echo(PAGETYPE_FRAMED_CHILD); ?>) query='.&=';
      else if(frame_type===<?php echo(PAGETYPE_FRAMED_PAGE); ?> || this.PAGE_FRAMED) query='_&=';
      else query='';
      url=url.replace(/^([^\?]*)[\?]?<?php echo(PAGETYPE_MINIREGEXP); ?>([^#]*?
  • ?.*?)$/,'\$1?='+query+'\$3');
   }
   if(urlquote!="") url=urlquote+url+urlquote;
   return url;
},

parse_html:function(regexp,partoparse,html,addproxy,framify){
   var match,begin,end,nurl;
   if(html.match(regexp)){
      var matcharr=this.preg_match_all(regexp,html);
      var newhtml="";
      for(var key in matcharr){
         /*match=matcharr;
         nurl=this.surrogafy_url(match[partoparse],undefined,addproxy);
         nhtml=match[0].replace(match[partoparse],nurl);
         html=html.replace(match[0],nhtml);*/
         match=matcharr[key];
         if(match[partoparse]!=undefined){
            begin=html.indexOf(match[partoparse]);
            end=begin+match[partoparse].length;
            nurl=this.surrogafy_url(match[partoparse],undefined,addproxy);
            if(framify) nurl=this.framify_url(nurl,framify);
            newhtml+=html.substring(0,begin)+nurl;
            html=html.substring(end);
         }
      }
      html=newhtml+html;
   }
   return html;
},

parse_all_html:function(){
   if(arguments[0]==null) return;
   var html=arguments[0].toString();
   var key;
   for(var key in regexp_arrays){
      if((arguments.length>1 && key!=arguments[1]) || key=='text/javascript') continue;
      arr=regexp_arrays[key];
      for(var regexp_arraykey in arr){
         regexp_array=arr[regexp_arraykey];
         if(regexp_array[0]==undefined) continue;
         if(regexp_array[0]==1) html=html.replace(regexp_array[1],regexp_array[2]);
         else if(regexp_array[0]==2){
            addproxy=(regexp_array.length>3?regexp_array[3]:true);
            framify=(regexp_array.length>4?regexp_array[4]:false);
            html=this.parse_html(regexp_array[1],regexp_array[2],html,addproxy,framify);
         }
      }
   }
   return html;
},

form_button:null,
form_encrypt:function(form){
   if(form.method=='post') return true;
   //action=form.<php echo(COOK_PREF); ?>.value;
   var action=form.getElementsByName(this.COOK_PREF)[0].value;
   for(var i=1;i<form.elements.length;i++){
      if(form.elements.disabled || form.elements.name=='' || form.elements.value=='' || form.elements.type=='reset') continue;
      if(form.elements.type=='submit'){
         if(form.elements.name!=this.form_button) continue;
         this.form_button=null;
      }
      var pref;
      if(!action.match(/\?/)) pref="?";
      else pref="&";
      action+=pref+form.elements.name+"="+form.elements.value;
   }
   location.href=this.surrogafy_url(action);
   return false;
},

setAttr:function(obj,attr,val){
   if(typeof(attr)!=typeof("")){
      attr=attr.toString();
      attr=attr.substr(1,attr.length-2);
   }

   if(attr=="innerHTML"){
      obj[attr]=this.parse_all_html(val);
      return obj[attr];
   }

   if(obj==location && attr=="hostname") return this.LOCATION_HOSTNAME;

   if(obj==document && attr=="cookie"){
      const COOK_REG=/^([^=]*)=([^;]*)(?:;[\s\S]*?)?$/i;
      var realhost=this.LOCATION_HOSTNAME.replace("/^www/i","").replace(".","_");
      var cookkey=val.replace(COOK_REG,"\$1");
      var cookval=val.replace(COOK_REG,"\$2");
      if(this.ENCRYPT_COOKS){
         cookkey=proxenc(cookkey);
         cookval=proxenc(cookval);
      }
      var newcookie=realhost+"<?php echo(COOKIE_SEPARATOR); ?>"+cookkey+"="+cookval+"; ";
      document.cookie=newcookie;
      return newcookie;
   }

   if(obj==location && attr=="search"){
      if(val.substr(0,1)=="?") val=val.substr(1);
      this.curr_urlobj.set_query(val);
      val=this.curr_urlobj.get_url();
      attr="href";
   }

   var proxurl=val;
   if(attr!="cookie" && attr!="search" && attr!="hostname"){
      proxurl=this.surrogafy_url(val);

      // tags framified  must match REGEXPS with regexp_array[5]
      if(obj.tagName=="A" || obj.tagName=="AREA")
         proxurl=this.framify_url(proxurl,<?php echo(NEW_PAGETYPE_FRAME_TOP); ?>);
      else if(obj.tagName=="FRAME" || obj.tagName=="IFRAME")
         proxurl=this.framify_url(proxurl,<?php echo(PAGETYPE_FRAMED_CHILD); ?>);
   }

   if(this.URL_FORM){
      if((obj==location && attr=="href") || attr=="location"){
         urlobj=this.surrogafy_url_toobj(val);
         if(!urlobj.locked) proxurl=this.add_querystuff(proxurl,"=&");
         this.thetop.location.href=proxurl;
      }
      else obj[attr]=proxurl;
   }
   else obj[attr]=proxurl;
},

getAttr:function(obj,attr){
   if(typeof(attr)!=typeof("")){
      attr=attr.toString();
      attr=attr.substr(1,attr.length-2);
   }

   if(obj==document && attr=="cookie"){
      var ocookies=this.getCookieArr();
      var cookies="",ocook;
      const COOK_REG=/^([\s\S]*)<?php echo(COOKIE_SEPARATOR); ?>([^=]*)=([\s\S]*)(?:; )?$/i;
      for(var key in ocookies){
         ocook=ocookies[key];
         if(typeof(ocook)!=typeof("")) continue;
         if(ocook.match(COOK_REG)==null) continue;
         var realhost=this.LOCATION_HOSTNAME.replace("/^www/i","").replace(".","_");
         var cookhost=ocook.replace(COOK_REG,"\$1");
         if(cookhost==realhost){
            if(this.ENCRYPT_COOKS){
               var cookkey=this.pe.proxdec(ocook.replace(COOK_REG,"\$2"));
               var cookval=this.pe.proxdec(ocook.replace(COOK_REG,"\$3"));
               cookies+=cookkey+"="+cookval+"; ";
            }
            else cookies+=ocook.replace(COOK_REG,"\$2=\$3; ");
         }
      }
      return cookies;
   }

   if(obj==navigator){
      if(this.USERAGENT=="-1" && (attr!="plugins" && attr!="mimeType")) return undefined;
      if(this.USERAGENT=="") return obj[attr];
      var msie=this.USERAGENT.match(/msie/i);
      const UA_REG=/^([^\/\(]*)\/?([^ \(]*)[ ]*(\(?([^;\)]*);?([^;\)]*);?([^;\)]*);?([^;\)]*);?([^;\)]*);?[^\)]*\)?)[ ]*([^ \/]*)\/?([^ \/]*).*$/i;
      switch(attr){
         case "userAgent": return this.USERAGENT;
         case "appCodeName": return this.USERAGENT.replace(UA_REG,"\$1");
         case "appVersion": return (msie?this.USERAGENT.replace(UA_REG,"\$2 \$3"):this.USERAGENT.replace(UA_REG,"\$2 (\$4; \$7)"));
         case "platform":
            var tempplatform=this.USERAGENT.replace(UA_REG,"\$4");
            return (tempplatform=="compatible" || tempplatform=="Windows"?"Win32":this.USERAGENT.replace(UA_REG,"\$6"));
         case "oscpu": return (msie?undefined:this.USERAGENT.replace(UA_REG,"\$6"));
         case "language": return (msie?undefined:this.USERAGENT.replace(UA_REG,"\$7"));
         case "appName":
            var tempappname=(msie?"Microsoft Internet Explorer":this.USERAGENT.replace(UA_REG,"\$1"));
            if(tempappname=="Opera" || tempappname=="Mozilla") tempappname="Netscape";
            return tempappname;
         case "product": return (msie?undefined:this.USERAGENT.replace(UA_REG,"\$9"));
         case "productSub": return (msie?undefined:this.USERAGENT.replace(UA_REG,"\$10"));
         case "plugins": return (<?php echo((empty($_COOKIE[COOK_PREF.'_remove_objects'])?'1':'0')); ?>==1?navigator.plugins:undefined);
         case "mimeType": return navigator.mimeType;
         default: return undefined;
      }
   }

   if(obj==location && attr=="search") url=location.href;
   else url=obj[attr];
   url=this.de_surrogafy_url(url);
   if(obj==location && attr=="search") url=url.replace(/^[^?]*/,"");
   return url;
},

eventify:function(a1,a2){
   document.getElementsByTagName("head")[0].addEventListener("load",function(){<?php echo(COOK_PREF); ?>.setParentStuff(a1,a2);},false);
   window.addEventListener("load",function(){<?php echo(COOK_PREF); ?>.setParentStuff(a1,a2);},false);
   this.setParentURL(this.CURR_URL);
},

setParentURL:function(url){
   if(this.thetop!=null && this.thetop!=window){
      this.thetop.document.getElementById('url').value=url;
      this.thetop.document.getElementById('proxy_link').href=this.add_querystuff(this.surrogafy_url(url),"=-&");
   }
},

setParentStuff:function(proto,server){ // amazing creativity with the name on my part
   var topdoc=this.thetop.document;
   topdoc.title=document.title;

   // find and set shortcut icon
   var tophead=topdoc.getElementsByTagName("head")[0];
   var links=tophead.getElementsByTagName("link");
   var link=null;
   for(var i=0; i<links.length; i++){ if(links.type=="image/x-icon" && links.rel=="shortcut icon") link=links; }

   if(tophead.getElementsByTagName("link").length>0) tophead.removeChild(topdoc.getElementsByTagName("link")[0]);

   var favicon=topdoc.createElement("link");
   favicon.type="image/x-icon";
   favicon.rel="shortcut icon";
   favicon.href=(link==null?this.surrogafy_url(proto+"://"+server+"/favicon.ico"):link.href);
   tophead.appendChild(favicon);
},

XMLHttpRequest_wrap:function(xmlhttpobj){
   xmlhttpobj.<?php echo(COOK_PREF); ?>_open=xmlhttpobj.open;
   xmlhttpobj.open=<?php echo(COOK_PREF); ?>.XMLHttpRequest_open;
   return xmlhttpobj;
},

XMLHttpRequest_open:function(){
   if(arguments.length<2) return;
   arguments[1]=<?php echo(COOK_PREF); ?>.surrogafy_url(arguments[1]);
   return this.<?php echo(COOK_PREF); ?>_open.apply(this,arguments);
},

// WRAPPED FUNCTIONS AND OBJECTS
thetop:top,
theparent:parent,
setTimeout:window.setTimeout,
setInterval:window.setInterval,
document_write_queue:"",
purge:function(){
   thehtml=this.document_write_queue;
   if(thehtml=="") return;
   thehtml=this.parse_all_html(thehtml);
   this.document_write_queue="";
   //alert(thehtml); // DEBUG
   document.write_<?php echo(COOK_PREF); ?>(thehtml);
},

purge_noparse:function(){
   thehtml=this.document_write_queue;
   if(thehtml=="") return;
   this.document_write_queue="";
   document.write_<?php echo(COOK_PREF); ?>(thehtml);
}

}

// }}}

// javascript FUNCS: WRAPPING {{{

document.write_<?php echo(COOK_PREF); ?>=document.write;
document.writeln_<?php echo(COOK_PREF); ?>=document.writeln;
document.write=function(html){ <?php echo(COOK_PREF); ?>.document_write_queue+=html; }
document.writeln=function(html){ <?php echo(COOK_PREF); ?>.document_write_queue+=html+"\n"; }

window.open_<?php echo(COOK_PREF); ?>=window.open;
window.open=document.open=function(){
   if(arguments.length<1) return;
   var url=<?php echo(COOK_PREF); ?>.surrogafy_url(arguments[0]);
   if((url.substring(0,1)=="\"" || url.substring(0,1)=="'") && url.substring(0,1)==url.substring(url.length-1,url.length)) url=url.substring(1,url.length-1);
   arguments[0]=url;
   return window.open_<?php echo(COOK_PREF); ?>.apply(this.caller,arguments);
}

setTimeout=function(){
   if(arguments.length<2) return;
   arguments[0]=<?php echo(COOK_PREF); ?>.parse_all_html(arguments[0],"application/x-javascript");
   return <?php echo(COOK_PREF); ?>.setTimeout.apply(this,arguments);
}

setInterval=function(){
   if(arguments.length<2) return;
   arguments[0]=<?php echo(COOK_PREF); ?>.parse_all_html(arguments[0],"application/x-javascript");
   return <?php echo(COOK_PREF); ?>.setInterval.apply(this,arguments);
}

/* hooking for eval(), not necessary anymore, but worked relatively well in the past
/*eval_<?php echo(COOK_PREF); ?>=eval;
eval=function(){
   if(arguments.length<1) return;
   arguments[0]=<?php echo(COOK_PREF); ?>.parse_all_html(arguments[0],"application/x-javascript");
   return eval_<?php echo(COOK_PREF); ?>.apply(this.caller,arguments);
}*/

// wrap top and parent objects for anti-frame breaking
if(<?php echo(COOK_PREF); ?>.PAGE_FRAMED){
   if(parent==top) parent=self;
   if(top!=self) top=<?php echo(COOK_PREF); ?>.thetop.frames[0];
}

// }}}

//</script><?php exit(); }

# }}}

# REGEXPS {{{

# This is where all the parsing is defined.  If a site isn't being
# parsed properly, the problem is more than likely in this section.
# The rest of the code is just there to set up this wonderful bunch
# of incomprehensible regular expressions.


# REGEXPS: CONVERSION TO javascript {{{

function bool_to_js($bool){ return ($bool?'true':'false'); }
function convertarray_to_javascript(){
   global $regexp_arrays;
   $js='regexp_arrays=new Array('.count($regexp_arrays).");\n";
   reset($regexp_arrays);
   while(list($key,$arr)=each($regexp_arrays)){
      $js.="regexp_arrays[\"$key\"]=new Array(".count($arr).");\n";
      for($i=0;$i<count($arr);$i++){
         $js.="regexp_arrays[\"$key\"][$i]=new Array(";
         if($arr[$i][0]==1) $js.='1,'.escape_regexp($arr[$i][2]).'g,"'.escape_regexp($arr[$i][3],true).'"';
         elseif($arr[$i][0]==2) $js.='2,'.escape_regexp($arr[$i][2])."g,{$arr[$i][3]}".(count($arr[$i])<5?null:','.bool_to_js($arr[$i][4])).(count($arr[$i])<6?null:",{$arr[$i][5]}");
         $js.=");\n";
      }
   }
   return stripslashes($js);
}

# }}}

# REGEXPS: VARIABLES {{{

global $regexp_arrays;

# 'img' was in $jsattrs... what's that for?
$jsattrs='(?:href|src|location|action|backgroundImage|pluginspage|codebase|location\.href|innerHTML)';
$jshookattrs="(?:{$jsattrs}|cookie|search|hostname)";
$jshookgetattrs="(?:{$jshookattrs}|userAgent|platform|appCodeName|appName|appVersion|language|oscpu|product|productSub|plugins)";
//$jshtmlattrs='(innerHTML)';
$jsmethods='(location\.(?:replace|assign))';
$jslochost='(location\.host(?:name){0,1})';
//$jslocsearch='(location\.search)';
//$jsrealpage='((?:(?:document|window)\.){0,1}location(?:(?=[^\.])|\.href)|document\.documentURI|[a-z]+\.referrer)';
$htmlattrs='(data|href|src|background|pluginspage|codebase|action)';

$justspace="[\t ]*";
$plusjustspace="[\t ]+";
$anyspace="[\t\r\n ]*";
$plusspace="[\t\r\n ]+";
$operands='[\+\-\/\*]';
$notoperands='[^\+\-\/\*]';

$quoteseg='(?:"(?:[^"]|[\\\\]")*?"|\'(?:[^\']|[\\\\]\')*?\'';
$regseg='\/(?:[^\/]|[\\\\]\/)*?\/';

//$jsobjsect="{$jsvarsect}(?:\((?:{$quoteseg}|{$jsvarsect}|))\))?";
//$jsobjsect="{$jsvarsect}(?:\({$anyspace}(?:{$quoteseg}|{$jsvarsect}|))(?:{$anyspace},{$anyspace}{$quoteseg}|{$jsvarsect}|))*{$anyspace}\))?(?:\[(?:{$quoteseg}|{$jsvarsect}|))\])?";
//$jsobjsect="{$jsvarsect}(?:\((?:[^\(\)\"']*(?:{$quoteseg}|(?R))))\))?(?:\[(?:[^\[\]\"']*(?:{$quoteseg}|(?R))))\])?";
//$jsvarobj='(?:[a-zA-Z0-9\._\(\)\[\]\+\-]+)';
$jsvarsect='[a-zA-Z0-9_\$](?:[a-zA-Z0-9\$\._\/\[\]\+-]*[a-zA-Z0-9_\/\]])?';
$jsobjsect="{$jsvarsect}(?:\((?:{$quoteseg}|{$jsvarsect}|))\))?(?:\[(?:{$quoteseg}|{$jsvarsect}|))\])?";
$jsvarobj="{$jsobjsect}(?:\.{$jsobjsect})*";
//$jsquotereg="((?:(?:{$anyspace}{$quoteseg}|{$jsvarobj}){$anyspace}\+)*){$anyspace}{$quoteseg}|{$jsvarobj}){$justspace}(?=[;\}\n\r]))"; # HUH?
$jsquotesect="(?:{$anyspace}{$quoteseg}|{$jsvarobj}))";
$jsquotereg="{$jsquotesect}(?:\+{$jsquotesect})*";

//$notjsvarsect='[^a-zA-Z0-9\._\[\]\+-]';
//$notjsvarsect='[^a-zA-Z0-9\._\[\]\/]';
$notjsvarsect='[^a-zA-Z0-9\._\[\]]';

//$jsend="(?={$anyspace}[;\}\n\r\'\"])";
//$jsend="(?={$anyspace}(?:[;\}]|{$notoperands}[\n\r]))";
$jsend="(?={$justspace}(?:[;\}\n\r]|{$notoperands}[\n\r]))";
$notjsend="(?!{$justspace}(?:[;\}\n\r]|{$notoperands}[\n\r]))";
$jsbegin="((?:[;\{\}\n\r\(\)]|[\!=]=){$anyspace})";
//$jsbeginright="((?:[;\{\}\n\r\(\)=\+\-\/\*]){$anyspace})";
$jsbeginright="((?:[;\{\}\(\)=\+\-\/\*]){$justspace})";

$htmlnoquot='(?:[^"\'\\\\][^> ]*)';
$htmlnoquotnoqm='(?:[^\?"\'\\\\][^\?> ]*)';
$htmlreg="({$quoteseg}|{$htmlnoquot}))";
$xmlhttpreq="(?:XMLHttpRequest{$anyspace}(?:\({$anyspace}\)|)|ActiveXObject{$anyspace}\({$anyspace}[^\)]+\.XMLHTTP['\"]{$anyspace}\))(?=;)";
$jsnewobj="(?:{$anyspace}new{$plusspace}|{$anyspace})";
$formnotpost="(?:(?!method{$anyspace}={$anyspace}(?:'|\")?post)[^>])";
$frametargets='_(?:top|parent|self)';

$js_string_methods='(?:anchor|big|blink|bold|charAt|charCodeAt|concat|fixed|fontcolor|fontsize|fromCharCode|indexOf|italics|lastIndexOf|link|match|replace|search|slice|small|split|strike|sub|substr|substring|sup|toLowerCase|toUpperCase|toSource|valueOf)';
$js_string_attrs='(?:constructor|length|prototype)';

# }}}

# REGEXPS: javascript PARSING {{{

$js_regexp_arrays=array(
   array(1,2,"/{$jsbegin}({$jsvarobj})\.({$jshookgetattrs}){$anyspace}\+=/i",'\1\2.\3='.COOK_PREF.'.getAttr(\2,/\3/)+'),
   array(1,2,"/{$jsbegin}({$jsvarobj})\.(({$jshookattrs}){$anyspace}=(?:{$anyspace}{$jsvarobj}{$anyspace}=)*{$anyspace})((?!\=)({$notjsend}.)*){$jsend}/i",'\1'.COOK_PREF.'.setAttr(\2,/\4/,\5)'),
   array(1,2,"/{$jsbeginright}({$jsvarobj})\.({$jshookgetattrs})([^\.=a-z0-9_\[\]\t\r\n]|\.{$js_string_methods}\(|\.{$js_string_attrs}{$notjsvarsect})/i",'\1'.COOK_PREF.'.getAttr(\2,/\3/)\4'),
Páginas: [1] 2 3 4 5 6 7
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines