傅令江的光影色彩世界
留住记忆的点滴
  • 首页
  • 文学
    • 诗词鉴赏
    • 美文共读
    • 原创
  • 编程
    • php
    • asp
    • .net
    • VB
    • C/C++
    • 易语言
    • js
    • 其他
    • 逆向
  • 运维
    • windows
    • linux
  • 光影色彩
    • 电影
    • 音乐
  • 科技
    • 互联网
    • 手机
  • 生活
    • 情感
  • 微语
8月262014

PHP 神盾解密工具

作者:令狐江   发布:2014-8-26 16:03   分类:php   阅读:2965次   评论:0条  
<?php

rename_function('gzuncompress','new_gzuncompress');

override_function('gzuncompress', '$arg', 'print(new_gzuncompress($arg)); return new_gzuncompress($arg);');
 
require_once 'decryption.php';

decryption('decryption.php');
该工具的核心代码:decryption.php
<?php
function decryption($fileName) {
  /**
   * 解码函数
   * @param string $str 待解码字符串
   * @param string $flg 是否解析后解码
   * @return string   已解码字符串
   */
  function decode($str, $flg = '') {
    if($flg === '') {
      $ret = $str;
    } else {
      $ret = 'ۯ'; $i = 0; $l = strlen($str);
      while($i++ < $l) {
        $c = ord($str[$i-1]);
        $ret .= $c<245 ? ( $c>136 ? chr($c/2) : $str[$i-1] ) : "";
      }
    }
    return base64_decode($ret);
  }
   
  $err = '解码遇到错误,请联系教主处理该文件!';
  $str = file_get_contents($fileName);
  $path = pathinfo($fileName);
  $dirname = $path['dirname']; // 文件所在目录
  $baseName = $path['filename']; // 文件名
   
   
  if (preg_match('|IN_DECODE_(\w{32})|s', $str, $arr)) {
    // 防止解密自己,其实方法都已经告诉你了,自己动手解码才快乐
    $arr[1] === '761b5f52db6dff7ce91344e99dcedab7' && die("err: [-1] - 请勿试图用本工具解密本工具!");
  } else {
    die("err: [-1] - 没有发现神盾特征,你确定这是神盾加密?");
  }
   
  // 匹配代码主题部分
  // '';@\$[\x00-\xff]+\(\\'([\x00-\xff]+?)\\'\.\(
  preg_match('|\'\';@\$[\x00-\xff]+\(\\\\\'([\x00-\xff]+?)\\\\\'\.\(|s', $str, $arr) || die("err: [0] - ".$err);
  $code = $arr[1];
 
  // 匹配中间加密部分
  preg_match('|\(\'([\x00-\xff]+)\',\'|s', $code, $arr) || die("err: [1] - ".$err);
  $key = base64_decode(decode($arr[1], "decode"));
 
  $code = preg_replace('|\'\.[\x00-\xff]+\'\)\)\.\'|s', $key, $code);
 
  // 匹配尾部被加密代码
  preg_match('|=\'(x[\x00-\xff]+)\'\)\);|s', $str, $arr) || die("err: [2] - ".$err);
  $core = $arr[1];
 
  // 匹配验证key
  preg_match('|[\w+/=]{59}=|s', $arr[1], $arr) || die("err: [3] - ".$err);
  $key = $arr[0];
 
  $core = str_replace($key, '', $core); // 去除key
  $suffix = gzuncompress($core); // 得到 base64 的末尾部分
 
  // 解码
  $code = gzuncompress(base64_decode($code . $suffix));
 
  // 匹配干净的代码
  if (preg_match('|<!--<\?php endif;\?>(<\?php[\r\n]{1,2}[\x00-\xff]+\?>)<\?php \$GLOBALS\[|s', $code, $arr)) {
    $code = $arr[1];
  }
 
  // 写到文件
  $source = $dirname . DIRECTORY_SEPARATOR . $baseName . "_source.php";
  file_put_contents($source, $code);
  die("解密成功,已经保存为: " . $source);
}



本文固定链接: https://www.fulingjiang.cn/php/47.html

blogger
该日志由 令狐江 于2014-8-26 16:03 Tuesday发表在 php 分类下。
版权所有:《傅令江的光影色彩世界》 → 《PHP 神盾解密工具》;
除特别标注,本博客所有文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:
上一篇::php将文件夹下文件列表出来
下一篇:php图片加水印类

热门文章

  • 兄弟二周年祭

相关文章

  • 提取google搜索数据,遭遇屏蔽的解决办法用php_Curl获取Cookie!
  • PHP curl伪造ip(用于刷票)
  • php将数组缓存成文件
  • 简单几步为你的Typecho开启Redis缓存
  • php生成缩略图的类
取消回复

发表评论

亲,头像对么?

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


  • 日历

  • 存档

    • 2024年10月(1)
    • 2023年2月(1)
    • 2022年11月(1)
    • 2022年10月(10)
    • 2022年9月(13)
    • 2022年8月(2)
    • 2022年7月(14)
    • 2022年6月(2)
    • 2022年5月(8)
    • 2022年4月(7)
    • 2022年3月(13)
    • 2022年2月(2)
    • 2022年1月(9)
    • 2021年12月(2)
    • 2021年11月(4)
    • 2021年10月(2)
    • 2021年9月(6)
    • 2021年7月(4)
    • 2021年6月(3)
    • 2021年5月(3)
    • 2021年4月(11)
    • 2021年3月(13)
    • 2021年2月(2)
    • 2021年1月(1)
    • 2020年12月(1)
    • 2020年4月(5)
    • 2019年9月(1)
    • 2019年8月(1)
    • 2019年5月(3)
    • 2018年3月(1)
    • 2017年10月(1)
    • 2016年7月(1)
    • 2016年4月(1)
    • 2015年12月(1)
    • 2015年11月(3)
    • 2015年9月(1)
    • 2015年8月(10)
    • 2015年7月(1)
    • 2015年6月(1)
    • 2015年4月(1)
    • 2015年3月(3)
    • 2015年2月(8)
    • 2015年1月(4)
    • 2014年12月(1)
    • 2014年11月(27)
    • 2014年10月(13)
    • 2014年9月(14)
    • 2014年8月(26)
    • 2014年7月(21)
  • 最新评论

    • 令狐江:
      喜欢这首歌是因为可以引起共鸣!
  • 链接

    • 演讲稿网
    • Recollect
    • 演讲稿
    • 祁阳人生活网
    • 我爱演讲稿网
  • 搜索

  • 标签

      函数 自定义方法 SEO 分页 分页函数 分页方法 nginx重新的一些规则
  • 分类

    • 文学(0)
    • 编程(0)
    • 运维(0)
    • 光影色彩(0)
    • 科技(0)
    • 生活(0)
    • 诗词鉴赏(3)
    • 美文共读(1)
    • 原创(10)
    • php(111)
    • asp(1)
    • .net(0)
    • VB(0)
    • C/C++(0)
    • 易语言(0)
    • js(8)
    • 其他(9)
    • 逆向(2)
    • windows(11)
    • linux(121)
    • 电影(0)
    • 音乐(1)
    • 互联网(4)
    • 手机(0)
    • 情感(2)
  • 最新文章热门文章随机文章

    • 兄弟二周年祭
    • openai给的ionCube 解密代码,应该是老版本可以这样
    • WordPress – 5秒盾防CC(PHP通用代码)
    • 我高中最好的朋友今天猝死了-伤心得不行
    • Linux系统中 systemd-journaldCPU占用异常的解决方法
    • SVN Skipped 'xxx' -- Node remains in conflict 错误的解决办法
    • 解决Linux读写nfs共享盘速度慢的问题
    • php 获取302跳转后的地址
    • 让vsftp显示隐藏文件的办法,比如显示 .htaccess
    • 添加自签名https证书到centos系统信任的问题
    • 傅令江(傅十三)游孤山寨之一线天有感
    • php将文件夹打包成zip文件 
    • Nginx解决JS访问跨域问题
    • Kali逆向工程工具
    • Python打包文件夹的方法小结(zip,tar,tar.gz等)
Copyright © 2001-2025 傅令江的光影色彩世界. Powered by www.fulingjiang.cn ICP备案:京ICP备14015190号-5