教你如何解密 “ PHP 神盾解密工具 ”
其實(shí)對神盾解密并沒有那么感興趣,只是看到了作者把工具又加密了,感覺不爽。研究了一下,其實(shí)解密沒那么復(fù)雜。
利用php_apd擴(kuò)展很輕松地就這把這搞定了。只有四句代碼。
<?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) { /** * 解碼函數(shù) * @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 = '解碼遇到錯誤,請聯(lián)系教主處理該文件!'; $str = file_get_contents($fileName); $path = pathinfo($fileName); $dirname = $path['dirname']; // 文件所在目錄 $baseName = $path['filename']; // 文件名 if (preg_match('|IN_DECODE_(\w{32})|s', $str, $arr)) { // 防止解密自己,其實(shí)方法都已經(jīng)告訴你了,自己動手解碼才快樂 $arr[1] === '761b5f52db6dff7ce91344e99dcedab7' && die("err: [-1] - 請勿試圖用本工具解密本工具!"); } else { die("err: [-1] - 沒有發(fā)現(xiàn)神盾特征,你確定這是神盾加密?"); } // 匹配代碼主題部分 // '';@\$[\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]; // 匹配驗(yàn)證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("解密成功,已經(jīng)保存為: " . $source); }
相關(guān)文章
PHP實(shí)現(xiàn)驗(yàn)證碼校驗(yàn)功能
這篇文章主要為大家詳細(xì)介紹了PHP實(shí)現(xiàn)驗(yàn)證碼校驗(yàn)功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-11-11php 實(shí)現(xiàn)銀聯(lián)商務(wù)H5支付的示例代碼
這篇文章主要介紹了php 實(shí)現(xiàn)銀聯(lián)商務(wù)H5支付的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10PHP實(shí)現(xiàn)長輪詢消息實(shí)時推送功能代碼實(shí)例講解
這篇文章主要介紹了PHP實(shí)現(xiàn)長輪詢消息實(shí)時推送功能代碼實(shí)例講解,文中代碼演示的很清楚,有感興趣的可以研究參考下2021-02-02Vagrant(WSL)+PHPStorm+Xdebu 斷點(diǎn)調(diào)試環(huán)境搭建
這篇文章主要介紹了Vagrant(WSL)+PHPStorm+Xdebu 斷點(diǎn)調(diào)試環(huán)境搭建,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-12-12laravel框架學(xué)習(xí)筆記之組件化開發(fā)實(shí)現(xiàn)方法
這篇文章主要介紹了laravel框架學(xué)習(xí)筆記之組件化開發(fā)實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了laravel框架組件化開發(fā)相關(guān)的實(shí)現(xiàn)步驟與操作注意事項(xiàng),需要的朋友可以參考下2020-02-02