#!/usr/local/bin/php $start,"end"=>$end,"attribs"=>$attribs,"newname"=>$newname); } } } //echo "
"; print_r($functions); echo "
"; function GetVarName($s) { $alphabet = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $name = ""; $var_end = 0; $char = substr($s,$var_end,1); if(substr($s,0,1)=="$") { $var_end++; $char = substr($s,$var_end,1); } while(is_numeric(strpos($alphabet,$char)) && strlen($char)) { $name .= $char; $var_end++; $char = substr($s,$var_end,1); } return $name; } function obscure_func($NewName,$Attribs,$code) { global $functions; $globals = array(); $globals[] = '$this'; $globals[] = '$_GET'; $globals[] = '$_FILES'; $globals[] = '$_POST'; $globals[] = '$_COOKIE'; $globals[] = '$_SERVER'; $variables = array(); $new_code = array(); for($x=0;$x<=count($code);$x++) { $line = $code[$x]; $line = ltrim($line); $line = str_replace("\t","",$line); $g = strpos($line,"global"); if(is_numeric($g)) { $vars = substr($line,$g+7); $vars = substr($vars,0,-2); $v = explode(",",$vars); for($z=0;$z$attr) { $line = $code[$x]; $code[$x] = str_replace($name,$attr["newname"],$line); } } $VarCount =0; if(strlen($Attribs)>3) { $a = explode(",",substr($Attribs,1,-2)); if (is_array($a)) { foreach($a as $attr) { $variables[$attr] = '$_'.md5($VarCount++); } } } for($x=0;$x0) { if(substr($line,$p,2)!="$$") { $name=GetVarName(substr($line,$p)); if(strlen($name)) { $name = "$".trim($name); if(!in_array($name,$globals) && !array_key_exists($name,$variables)) $variables[$name] = '$_'.md5($VarCount++); } } $p = strpos($line,"$",$p+1); } } for($x=0;$x$varname) { $p = strpos($code[$x],$v); while(is_numeric($p)) { $t = GetVarName(substr($code[$x],$p)); if('$'.$t == $v) { $code[$x] = substr_replace($code[$x],$varname,$p,strlen($t)+1); } $p = strpos($code[$x],$v,$p+1); } } } $o = "function $NewName"."("; if (is_array($a)) { foreach($a as $attr) { $av[] = $variables[$attr]; } } if(count($av)>0) $o .= implode(",",$av); $o .= ")"; $o .= implode(" ",$code); //$o = str_replace("\n","",$o); return $o; } $out = ""; $outline = 0; foreach($functions as $name =>$pos) { $dest = $pos["start"]; $newname = $pos["newname"]; if(!$outline) $outline = $dest; unset($code); for($x=$dest+1;$x<=$pos["end"];$x++) { $code[] = $php[$x]; } $newcode = obscure_func($newname,$pos["attribs"],$code); $out .= $newcode; } foreach($functions as $name=>$pos) { for($x=$pos["start"];$x<=$pos["end"];$x++) { $php[$x] = ""; } } $code =array(); for($x=0;$x$attr) { $line = str_replace($name,$attr["newname"],$line); } $code[$x] = $line; } $php = $code; $line=1; $tmp_file = fopen($argv[1].'_', 'w'); for($x=0;$x