当前位置:网站首页>简单解决phpjm加密问题 免费phpjm解密工具
简单解决phpjm加密问题 免费phpjm解密工具
2022-07-06 09:08:00 【办公模板库 素材蛙】
你们可能看到了最近发了几个基于帝国CMS开发的模板,都是些做了SEO优化处理的模板,最近又买了一个,但是在扫描后门的时候发现很多文件加密了,加密方式是phpjm加密
查看更多关于 phpjm加密 的文章,使用的时候是没问题的,但是为了查看是否有后门还是解密看看。
在网上搜了下,发现大部分phpjm解密 查看更多关于 phpjm解密 的文章的工具都是收费的,不过也不贵,但是想着以前也经常看到这种方式的加密文件,要不研究下有没有一劳永逸的解决phpjm加密方式的办法?于是在百度找到了这个免费phpjm解密 查看更多关于 phpjm解密 的文章代码。
使用方法就是通过浏览器运行此解密文件,然后就会会生成一个解密的php文件。
< !--?php $file = 'phpjm.php'; //要解密的文件名 $fp = fopen($file, 'r'); $str = fread($fp, filesize($file)); fclose($fp); copy($file, '0_'.$file); $n = 1; while($n < 10){ $code = strdecode($str); if($n == 1){ $code = str_replace("__FILE__", "'0_$file'", $code); } $replace = '$decode'.$n.'=trim'; if(strpos($code, 'eval(') > 0){ $code = str_replace('eval(', $replace.'(', $code); }else{ preg_match("/@$(.*)($(.*),(.*)(/isU", $code, $res); $code = str_replace($res[3], "'$replace", $code); } $code = preg_replace('/$(.*)=false;(.*?)();/', '', $code); //上一版本 $code = preg_replace('/||@$(.*?)();/', '|| print("ok");', $code); $code = destr($code); $tmp_file = 'detmp'.$n.'.php'; file_put_contents($tmp_file, $code); include($tmp_file); $val = 'decode'.$n; $str = $$val; unlink($tmp_file); if(strpos($str, ';?-->') === 0){
$decode = $str;
break;
}
$str = "< !--?phprn". $str; $n++; } $decode = preg_replace("/^(.*)exit('Access Denied'); /", "<?phprn", $decode); $del = strrchr($decode, 'unset'); $decode = str_replace($del, "rn?-->", $decode);
file_put_contents($file.'.de.php' ,$decode);
unlink('0_'.$file);
echo 'done';
function val_replace($code, $val, $deval){
$code = str_replace('$'.$val.',', '$'.$deval.',', $code);
$code = str_replace('$'.$val.';', '$'.$deval.';', $code);
$code = str_replace('$'.$val.'=', '$'.$deval.'=', $code);
$code = str_replace('$'.$val.'(', '$'.$deval.'(', $code);
$code = str_replace('$'.$val.')', '$'.$deval.')', $code);
$code = str_replace('$'.$val.'.', '$'.$deval.'.', $code);
$code = str_replace('$'.$val.'/', '$'.$deval.'/', $code);
$code = str_replace('$'.$val.'>', '$'.$deval.'>', $code);
$code = str_replace('$'.$val.'<', '$'.$deval.'<', $code);
$code = str_replace('$'.$val.'^', '$'.$deval.'^', $code);
$code = str_replace('$'.$val.'||', '$'.$deval.'||', $code);
$code = str_replace('($'.$val.' ', '($'.$deval.' ', $code);
return $code;
}
function fmt_code($code){
global $vals,$funs;
preg_match_all("/$[0-9a-zA-Z[]']+(,|;)/iesU", $code, $res);
foreach($res[0] as $v){
$val = str_replace(array('$',',',';'), '', $v);
$deval = destr($val, 1);
$vals[$val] = $deval;
$code = val_replace($code, $val, $deval);
}
preg_match_all("/$[0-9a-zA-Z[]']+=/iesU", $code, $res);
foreach($res[0] as $v){
$val = str_replace(array('$','='), '', $v);
$deval = destr($val, 1);
$vals[$val] = $deval;
$code = val_replace($code, $val, $deval);
}
preg_match_all("/functions[0-9a-zA-Z[]]+(/iesU", $code, $res);
foreach($res[0] as $v){
$val = str_replace(array('function ','('), '', $v);
$deval = destr($val, 1);
$funs[$val] = $deval;
$code = str_replace('function '.$val.'(', 'function '.$deval.'(', $code);
$code = str_replace('='.$val.'(', '='.$deval.'(', $code);
$code = str_replace('return '.$val.'(', 'return '.$deval.'(', $code);
}
return $code;
}
function strdecode($str){
$len = strlen($str);
$newstr = '';
for($i=0; $i<$len; $i++){ $n = ord($str[$i]); $newstr .= decode($n); } return $newstr; } function decode($dec){ if(($dec > 126 || $dec<32) && $dec<>13 && $dec<>10){
return '['.$dec.']';
}else{
return chr($dec);
}
}
function destr($str, $val=0){
$k = 0;
$num = '';
$n = strlen($str);
$code = '';
for($i=0; $i<$n; $i++){ if($str[$i] == '[' && ($str[$i+1]==1 || $str[$i+1]==2)){ $k = 1; }elseif($str[$i] == ']' && $k==1){ $num = intval($num); if($val==1){ $num = 97 + fmod($num, 25); } $code .= chr($num); $k = 0; $num = null; }else{ if($k == 1){ $num .= $str[$i]; }else{ $code .= $str[$i]; } } } return $code; } ?> 边栏推荐
猜你喜欢
![[CV] target detection: derivation of common terms and map evaluation indicators](/img/e8/04cc8336223c0ab2dea5638def88df.jpg)
[CV] target detection: derivation of common terms and map evaluation indicators

CANoe仿真功能之自动化序列(Automation Sequences )

The 32 year old programmer left and was admitted by pinduoduo and foreign enterprises. After drying out his annual salary, he sighed: it's hard to choose

The programming ranking list came out in February. Is the result as you expected?

四川云教和双师模式

CANoe不能自动识别串口号?那就封装个DLL让它必须行

AI的路线和资源

Redis distributed lock implementation redison 15 questions

Embedded development is much more difficult than MCU? Talk about SCM and embedded development and design experience

Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
随机推荐
Contrôle de l'exécution du module d'essai par panneau dans Canoe (primaire)
17 医疗挂号系统_【微信支付】
May brush question 03 - sorting
嵌入式開發中的防禦性C語言編程
五月刷题03——排序
MapReduce instance (IX): reduce end join
宝塔的安装和flask项目部署
[deep learning] semantic segmentation - source code summary
Interview shock 62: what are the precautions for group by?
Installation de la pagode et déploiement du projet flask
硬件工程师的真实前途我说出来可能你们不信
Bugku web guide
华南技术栈CNN+Bilstm+Attention
Canoe CAPL file operation directory collection
33岁可以学PLC吗
AI的路线和资源
Single chip microcomputer realizes modular programming: Thinking + example + system tutorial (the degree of practicality is appalling)
CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
Safety notes
Oom happened. Do you know the reason and how to solve it?