洞悉互聯網前沿資訊,探尋網站營銷規律
作者:狐靈科技 | 2019-10-15 13:17 |點擊:
// 一個開源加密混淆 PHP 代碼項目
// a Open Source PHP Code Confusion + Encryption Project
GITHUB:https://github.com/djunny/enphp
GITEE:https://gitee.com/mz/enphp_opensource
曾經,作者也是商業軟件開發者中小將一名,軟件總是被人破解,于是花了幾個月研究了 EnPHP。
這套項目也有償提供過給很多人,不過,應該網上存在不少破解了。
項目主要貴在為大家提供一個加密混淆和還原的思路。
// 嚴禁用于非法用途。
include './func_v2.php';
$options = array(
//混淆方法名 1=字母混淆 2=亂碼混淆
'ob_function' => 2,
//混淆函數產生變量最大長度
'ob_function_length' => 3,
//混淆函數調用 1=混淆 0=不混淆 或者 array('eval', 'strpos') 為混淆指定方法
'ob_call' => 1,
//隨機插入亂碼
'insert_mess' => 0,
//混淆函數調用變量產生模式 1=字母混淆 2=亂碼混淆
'encode_call' => 2,
//混淆class
'ob_class' => 0,
//混淆變量 方法參數 1=字母混淆 2=亂碼混淆
'encode_var' => 2,
//混淆變量最大長度
'encode_var_length' => 5,
//混淆字符串常量 1=字母混淆 2=亂碼混淆
'encode_str' => 2,
//混淆字符串常量變量最大長度
'encode_str_length' => 3,
// 混淆html 1=混淆 0=不混淆
'encode_html' => 2,
// 混淆數字 1=混淆為0x00a 0=不混淆
'encode_number' => 1,
// 混淆的字符串 以 gzencode 形式壓縮 1=壓縮 0=不壓縮
'encode_gz' => 0,
// 加換行(增加可閱讀性)
'new_line' => 1,
// 移除注釋 1=移除 0=保留
'remove_comment' => 1,
// debug
'debug' => 1,
// 重復加密次數,加密次數越多反編譯可能性越小,但性能會成倍降低
'deep' => 1,
// PHP 版本
'php' => 7,
);
$file = 'code_test/1.php';
$target_file = 'encoded/2.php';
enphp_file($file, $target_file, $options);
可以將你要測試的代碼放至 code_test 中,運行命令:
php code_test.php
程序會自動進行回歸測試,我也放了一些之前要測試的腳本在里邊
P.S.
本來,還實現了 goto + xor 變種,不過兼容性和性能有點差,等有時間精力的時候再研究罷...
interface i {
function init($a, $b);
}
class ii implements i {
// PHP 中繼承的參數名可以不一樣
function init($b, $c) {
echo $b, $c;
}
}
namespace a{
class b{
}
# 正確
$b = new \a\b();
# 錯誤
#$b = new b():
}
//格式:/*<encode>*/要二次混淆的內容/*</encode>*/
$a = /*<encode>*/"明文數據1"/*</encode>*/;
echo /*<encode>*/2/*</encode>*/;
print(/*<encode>*/"明文數據3"/*</encode>*/);
echo 1;
/*<hide>*/
echo 2;
/*</hide>*/
echo 3;
//格式:/*<hide>*/要隱藏的代碼/*</hide>*/