wdcpのすべてのphpファイルを手動で復号

1144 ワード

<?php
/**
 *     wd_decode
 *  perl    
 */
function wd_decode($filename) {
        $data = unpack('C*', substr(file_get_contents($filename), 9));
        $key = array(0xB8, 0x35, 0x6, 0x2, 0x88, 0x1, 0x5B, 0x7, 0x44, 0x0);//   
        $j = count($data);
        foreach($data as $k => &$v) {
                $v = $key [ 2 * ($j % 5) ] ^ ~$v;
                // $v = sprintf('%u', $v);
                $v &= 0xFF;
                $v = pack('C*', $v);
                -- $j;
        }
        return gzuncompress(join('', $data));
}
/**
 *         
 *  glob      
 */
function get_filetree($path){ 
$tree = array(); 
foreach(glob($path.'/*') as $single){ 
if(is_dir($single)){ 
$tree = array_merge($tree,get_filetree($single)); 
} 
else{ 
if(substr($single,-3) == "php")//     php  ,     php   
 {  
    $tree[] = $single;  
   } 
} 
} 
return $tree; 
} 

$path = "D:\\WWW\\wdcp\\"; //    
$r = get_filetree($path); 
foreach ($r as $age) {
     $page=wd_decode($age);
	 $fp = fopen($age,"w");//    
	 fwrite($fp,$page);
	 fclose($fp);
}
?>