欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

微盾PHP脚本加密专家php解密算法

程序员文章站 2023-10-17 22:41:21
复制代码 代码如下:
复制代码 代码如下:

<?php
/***********************************
*威盾php加密专家解密算法 by:neeao
*http://neeao.com
*2009-09-10
***********************************/

$filename="play-js.php";//要解密的文件
$lines = file($filename);//0,1,2行

//第一次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;

//直接还原密文输出
echo "<?php\n".base64_decode(strtr($secret,$decode_key,'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/'))."?>";
?>

微盾php脚本破解
复制代码 代码如下:

<?php
function get_filetree($path){
$tree = array();
foreach(glob($path . '/*') as $single){
if(is_dir($single)){
$tree = array_merge($tree,get_filetree($single));
} else {
$tree[] = $single;
}
}
return $tree;
}
function eval_decode($file)
{
$lines = file($file);
$content;
if(preg_match("/o0o0000o0\('.*'\)/", $lines[1], $s)){
$content = str_replace("o0o0000o0('", "", $s[0]);
$content = str_replace("')", "", $content);
$content = base64_decode($content);
} else {
return "file not encode!";
}
$key;
if(preg_match("/\),'.*',/", $content, $k)){
$key = str_replace("),'", "", $k[0]);
$key = str_replace("',", "", $key);
} else {
return "not decode key!";
}
$length;
if(preg_match("/,\d*\),/", $content, $k)){
$length = str_replace("),", "", $k[0]);
$length = str_replace(",", "", $length);
} else {
return "not decode base64 string!";
}
$secret = substr($lines[2], $length);
$decode = "<?php".base64_decode(strtr($secret,$key,'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/')) ."?>";
file_put_contents($file, $decode);
return "file decode success!";
}

$filelist = get_filetree("d:/phpnow/htdocs/1");
foreach($filelist as $value){
echo $value." :\t\t".eval_decode($value) . "\n\r<br>";
}
?>