现在的位置: 首页 > php > 正文
易盾解密
2014年09月20日 php ⁄ 共 1493字 暂无评论

易盾解密
==> call module_decode_hcache.php

 

<?php
ini_set("display_error","on");
error_reporting(9);

$root =$_SERVER['DOCUMENT_ROOT'];
$root='/';
$dir ="/sr/";
$output_dir = "/de/";

$temp_dir ='/hc/';

decode_dir($root.$dir);

function decode_dir($path)
{
global $temp_dir,$output_dir,$dir,$root;
$outdir = str_replace($root.$dir,$root.$output_dir,$path);
mkdir($outdir);

$fs = glob($path.'*');
foreach($fs as $f)
{
if(is_dir($f)) decode_dir($f.'/');
if(is_hcache_file($f))
{
decode_file($f);
}
else
{
$dest_file = str_replace($root.$dir,$root.$output_dir,$f);
copy($f,$dest_file);
}
}
}

function decode_file($filename)
{
global $temp_dir,$output_dir,$dir,$root;
del_temp();
decode ($filename);

save_decode_file($filename);
}

function is_hcache_file($f)
{
if(substr($f,-4,4) != '.php')
{
//echo $f,'skipped';
return false;
}
$data = file_get_contents($f);
if(substr($data,0,2) == '%%')
{
return true;
}
if(stripos('_myrun',$data) !== false) return true;

return false;
}

function del_temp()
{
global $temp_dir;
foreach(glob($temp_dir .'*.php') as $file)
{
unlink($file);
//echo "{$file}:unlinked<br/>";
}
}

function save_decode_file($filename)
{
global $temp_dir,$output_dir,$dir,$root;

$dest_file = str_replace($root.$dir,$root.$output_dir,$filename);

$i=0;
foreach(glob($temp_dir .'*.php') as $file)
{
$ext = ($i==0 ? '': $i);
$data = file_get_contents($file);

$pattern = '/\?><\?php.+?\$DomainArray.+?\?>/is';
$data = preg_replace($pattern,'',$data,1);

file_put_contents($dest_file.$ext,$data);
echo "{$file}:saved<br/>";
++$i;
}
}

function decode($fname)
{
require_once  'engine.php';
$hcache = new hcache_decoder();
$hcache->decode($fname);
}

?>

给我留言

您必须 [ 登录 ] 才能发表留言!

×