手动解密wdcp全部的php文件

<?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);
}
?>


你可能感兴趣的:(手动解密wdcp全部的php文件)