Index: trunk/obscure.php =================================================================== diff -u -r13 -r1173 --- trunk/obscure.php (.../obscure.php) (revision 13) +++ trunk/obscure.php (.../obscure.php) (revision 1173) @@ -1,6 +1,16 @@ #!/usr/local/bin/php + $start,"end"=>$end,"attribs"=>$attribs,"newname"=>$newname); } } } + print_r($functions); //echo "
"; print_r($functions); echo "
"; function GetVarName($s) @@ -79,7 +90,7 @@ if(is_numeric($g)) { $vars = substr($line,$g+7); - $vars = substr($vars,0,-2); + $vars = substr($vars,0,-3); $v = explode(",",$vars); for($z=0;$z3) { - $a = explode(",",substr($Attribs,1,-2)); - if (is_array($a)) { + $Attribs = trim($Attribs); + $Attribs = str_replace("\t","",$Attribs); + $a = explode(",",substr($Attribs,1,-1)); + echo "got attribs for func [$Attribs]:\n"; + var_dump($a); + if (is_array($a) && $a[0] != '') { foreach($a as $attr) { - $variables[$attr] = '$_'.md5($VarCount++); + $variables[$attr] = '$_'.gen_name($VarCount++); } } } @@ -123,7 +138,7 @@ { $name = "$".trim($name); if(!in_array($name,$globals) && !array_key_exists($name,$variables)) - $variables[$name] = '$_'.md5($VarCount++); + $variables[$name] = '$_'.gen_name($VarCount++); } } $p = strpos($line,"$",$p+1); @@ -132,8 +147,10 @@ for($x=0;$x$varname) { + //echo "strpos ".$code[$x].', '.$v."\n"; $p = strpos($code[$x],$v); while(is_numeric($p)) { @@ -164,8 +181,15 @@ $out = ""; $outline = 0; - foreach($functions as $name =>$pos) - { + + $shuffled = array_rand($functions, count($functions)); + print_r($shuffled); + + foreach ($shuffled as $name) { + $pos = $functions[$name]; + + //foreach($functions as $name =>$pos) + //{ $dest = $pos["start"]; $newname = $pos["newname"]; if(!$outline) @@ -216,6 +240,6 @@ $line++; } fclose($tmp_file); - rename($argv[1].'_', $argv[1]); + //rename($argv[1].'_', $argv[1]); -?> \ No newline at end of file +?> \ No newline at end of file