[PHP] PHP 神盾解密工具 →→→→→进入此内容的聊天室

来自 , 2020-04-02, 写在 PHP, 查看 96 次.
URL http://www.code666.cn/view/415585bd
  1. <?php
  2.  
  3. rename_function('gzuncompress','new_gzuncompress');
  4.  
  5. override_function('gzuncompress', '$arg', 'print(new_gzuncompress($arg)); return new_gzuncompress($arg);');
  6.  
  7. require_once 'decryption.php';
  8.  
  9. decryption('decryption.php');
  10. 该工具的核心代码:decryption.php
  11. <?php
  12. function decryption($fileName) {
  13.   /**
  14.    * 解码函数
  15.    * @param string $str 待解码字符串
  16.    * @param string $flg 是否解析后解码
  17.    * @return string   已解码字符串
  18.    */
  19.   function decode($str, $flg = '') {
  20.     if($flg === '') {
  21.       $ret = $str;
  22.     } else {
  23.       $ret = 'ۯ'; $i = 0; $l = strlen($str);
  24.       while($i++ < $l) {
  25.         $c = ord($str[$i-1]);
  26.         $ret .= $c<245 ? ( $c>136 ? chr($c/2) : $str[$i-1] ) : "";
  27.       }
  28.     }
  29.     return base64_decode($ret);
  30.   }
  31.    
  32.   $err = '解码遇到错误,请联系教主处理该文件!';
  33.   $str = file_get_contents($fileName);
  34.   $path = pathinfo($fileName);
  35.   $dirname = $path['dirname']; // 文件所在目录
  36.   $baseName = $path['filename']; // 文件名
  37.    
  38.    
  39.   if (preg_match('|IN_DECODE_(\w{32})|s', $str, $arr)) {
  40.     // 防止解密自己,其实方法都已经告诉你了,自己动手解码才快乐
  41.     $arr[1] === '761b5f52db6dff7ce91344e99dcedab7' && die("err: [-1] - 请勿试图用本工具解密本工具!");
  42.   } else {
  43.     die("err: [-1] - 没有发现神盾特征,你确定这是神盾加密?");
  44.   }
  45.    
  46.   // 匹配代码主题部分
  47.   // '';@\$[\x00-\xff]+\(\\'([\x00-\xff]+?)\\'\.\(
  48.   preg_match('|\'\';@\$[\x00-\xff]+\(\\\\\'([\x00-\xff]+?)\\\\\'\.\(|s', $str, $arr) || die("err: [0] - ".$err);
  49.   $code = $arr[1];
  50.  
  51.   // 匹配中间加密部分
  52.   preg_match('|\(\'([\x00-\xff]+)\',\'|s', $code, $arr) || die("err: [1] - ".$err);
  53.   $key = base64_decode(decode($arr[1], "decode"));
  54.  
  55.   $code = preg_replace('|\'\.[\x00-\xff]+\'\)\)\.\'|s', $key, $code);
  56.  
  57.   // 匹配尾部被加密代码
  58.   preg_match('|=\'(x[\x00-\xff]+)\'\)\);|s', $str, $arr) || die("err: [2] - ".$err);
  59.   $core = $arr[1];
  60.  
  61.   // 匹配验证key
  62.   preg_match('|[\w+/=]{59}=|s', $arr[1], $arr) || die("err: [3] - ".$err);
  63.   $key = $arr[0];
  64.  
  65.   $core = str_replace($key, '', $core); // 去除key
  66.   $suffix = gzuncompress($core); // 得到 base64 的末尾部分
  67.  
  68.   // 解码
  69.   $code = gzuncompress(base64_decode($code . $suffix));
  70.  
  71.   // 匹配干净的代码
  72.   if (preg_match('|<!--<\?php endif;\?>(<\?php[\r\n]{1,2}[\x00-\xff]+\?>)<\?php \$GLOBALS\[|s', $code, $arr)) {
  73.     $code = $arr[1];
  74.   }
  75.  
  76.   // 写到文件
  77.   $source = $dirname . DIRECTORY_SEPARATOR . $baseName . "_source.php";
  78.   file_put_contents($source, $code);
  79.   die("解密成功,已经保存为: " . $source);
  80. }
  81. //php/9022

回复 "PHP 神盾解密工具"

这儿你可以回复上面这条便签

captcha