php的vidun混淆的批量解密

可完全解密,但是没加代码美化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
function decode($filename){//要解密的文件
$lines = file($filename);//0,1,2行

if(preg_match("/O0O0000O0\('.*'\)/",$lines[1],$y)){
//第一次base64解密
$content="";
if(preg_match("/O0O0000O0\('.*'\)/",$lines[1],$y))
{
$content=str_replace("O0O0000O0('","",$y[0]);
$content=str_replace("')","",$content);
$content=base64_decode($content);
}
//第一次base64解密后的内容中查找密钥
$decode_key="";
if(preg_match("/\),'.*',/",$content,$k))
{
$decode_key=str_replace("),'","",$k[0]);
$decode_key=str_replace("',","",$decode_key);
}
//查找要截取字符串长度
$str_length="";
if(preg_match("/,\d*\),/",$content,$k))
{
$str_length=str_replace("),","",$k[0]);
$str_length=str_replace(",","",$str_length);
}
//截取文件加密后的密文
$Secret=substr($lines[2],$str_length);
//echo $Secret;

file_put_contents($filename, "<?php\n" . base64_decode(strtr(
$Secret,
$decode_key,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
)) ."?>");
}
}


function file_list($path)
{
$files = array();
if(is_dir($path)){
if ($handle = opendir($path))//打开路径成功
{
while (false !== ($file = readdir($handle)))//循环读取目录中的文件名并赋值给$file
{
if ($file != "." && $file != "..")//排除当前路径和前一路径
{
if (is_dir($path."/".$file)){
// echo $path.": ".$file."<br>";//去掉此行显示的是所有的非目录文件
file_list($path."/".$file);
}else{
$fileType = pathinfo($file, PATHINFO_EXTENSION);
if($fileType == "php"){
$realpath = $path. "/" .$file;
echo "success!file decoding:" .$realpath. "<br>";
decode($realpath);
}
}
}
}
closedir($handle);
}
}
}

$mulu = $_REQUEST['dir'];
file_list($mulu);
?>