当前位置:网站首页>Several schemes of PHP code encryption
Several schemes of PHP code encryption
2022-06-24 08:39:00 【An unreliable programmer】
How to protect your PHP Code :
Code obfuscation + encryption
Actual encryption is not , The specific implementation idea is to put the code base64 encryption , Then on base64 String mapping for strings in ( Randomly generated dictionaries are confused ) then eval perform This kind of 100% can be cracked and restored
The representative code is as follows :
<?php
function RandAbc($length = "") {
// Returns a random string
$str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
return str_shuffle($str);
}
$filename = 'index.php'; // Files to be encrypted
$T_k1 = RandAbc(); // Random key 1
$T_k2 = RandAbc(); // Random key 2
$vstr = file_get_contents($filename);
$v1 = base64_encode($vstr);
$c = strtr($v1, $T_k1, $T_k2); // Replace the corresponding characters according to the key .
$c = $T_k1.$T_k2.$c;
$q1 = "O00O0O";
$q2 = "O0O000";
$q3 = "O0OO00";
$q4 = "OO0O00";
$q5 = "OO0000";
$q6 = "O00OO0";
$s = '$'.$q6.'=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%64%679%5F%65%68%63%73%77%6F4%2B%6637%6A");$'.$q1.'=$'.$q6.'{3}.$'.$q6.'{6}.$'.$q6.'{33}.$'.$q6.'{30};$'.$q3.'=$'.$q6.'{33}.$'.$q6.'{10}.$'.$q6.'{24}.$'.$q6.'{10}.$'.$q6.'{24};$'.$q4.'=$'.$q3.'{0}.$'.$q6.'{18}.$'.$q6.'{3}.$'.$q3.'{0}.$'.$q3.'{1}.$'.$q6.'{24};$'.$q5.'=$'.$q6.'{7}.$'.$q6.'{13};$'.$q1.'.=$'.$q6.'{22}.$'.$q6.'{36}.$'.$q6.'{29}.$'.$q6.'{26}.$'.$q6.'{30}.$'.$q6.'{32}.$'.$q6.'{35}.$'.$q6.'{26}.$'.$q6.'{30};eval($'.$q1.'("'.base64_encode('$'.$q2.'="'.$c.'";eval(\'?>\'.$'.$q1.'($'.$q3.'($'.$q4.'($'.$q2.',$'.$q5.'*2),$'.$q4.'($'.$q2.',$'.$q5.',$'.$q5.'),$'.$q4.'($'.$q2.',0,$'.$q5.'))));').'"));';
$s = '<?php '."\n".$s."\n".' ?>';
//echo $s;
// Generate Encrypted PHP file
$fpp1 = fopen('temp_'.$filename, 'w');
fwrite($fpp1, $s) or die(' Error writing file ');
?>
Confusing garbled characters
Code obfuscate variables and other things and 1 The principle is similar , Just change the string to ascii 127 To 255 There are also characters that non-human editors cannot understand , The result is that 100% can be cracked and restored , It's just a matter of time .
issue opcode
Do not distribute code , But the first PHP Code precompile , distribution opcode,PHP7 in the future opcache Deep integration PHP7 You can use this method to protect the source code in the future , But also opcode Decompile back Will also be cracked .
confusion + encryption + Write PHP Expand
confusion + encryption + Write PHP Expand , But as long as it is open source PHP Extensions will be cracked , Unless you write your own encryption algorithm , hold PHP Code encryption , Then take it yourself C Voice write extension closed source , Others don't know your encryption and cracking ideas , The possibility of being cracked is very small .
Swoole Compiler
swoole The one that came out , It's generated opcode Confuse encryption later , Then this one is awesome , It is very obvious to implement this zend The engine is unlikely to recognize the confusion after encryption opcode, So he actually needs to rewrite zend, So the matching zend The engine has to be changed . According to hantianfeng, there is no possibility of being cracked But I found a successful solution on the Internet , I haven't tried .
边栏推荐
- ZUCC_ Principles of compiling language and compilation_ Experiment 05 regular expression, finite automata, lexical analysis
- AUTO PWN
- JS to get the last element of the array
- LabVIEW finds prime numbers in an array of n elements
- 数据库,查询本月借出书的数量,如果高于10本时,显示“本月借出书大于10本”,否则显示“本月借出书小于10本”
- "Wechat cloud hosting" first practical battle | introduction to minimalist demo
- Building a static website with eleventy
- 487. number of maximum consecutive 1 II ●●
- ZUCC_编译语言原理与编译_实验08 语法分析 LR 分析
- Three categories of financial assets under the new standards: AMC, fvoci and FVTPL
猜你喜欢
Two methods of QT exporting PDF files
小黑ai4code代码baseline啃食1
Introduction to RCNN, fast RCNN and fast RCNN
[micro services ~nacos] Nacos service providers and service consumers
uniapp 热更新后台管理
独立站运营中如何提升客户留存率?客户细分很重要!
Longhorn installation and use
jwt(json web token)
ZUCC_ Principles of compiling language and compilation_ Experiment 04 language and grammar
ZUCC_编译语言原理与编译_实验04 语言与文法
随机推荐
2021-03-09 comp9021 class 7 Notes
【生活思考】计划与自律
App Startup
How to handle the problem that calling easycvr address integration cannot be played through easyplayer player?
5 minutes, excellent customer service chat handling skills
ZUCC_ Principles of compiling language and compilation_ Experiment 05 regular expression, finite automata, lexical analysis
Pat 1157: school anniversary
RuntimeError: Missing dependencies:XXX
[real estate opening online house selection, WiFi coverage temporary network] 500 people are connected to WiFi at the same time
LabVIEW finds prime numbers in an array of n elements
图片工具
Redis cluster data skew
Building a static website with eleventy
"Wechat cloud hosting" first practical battle | introduction to minimalist demo
[graduation season] Hello stranger, this is a pink letter
ZUCC_编译语言原理与编译_实验06 07 语法分析 LL 分析
Shell basic operator -- arithmetic operator
Battle history between redis and me under billion level traffic
Common date formatter and QT method for obtaining current time
[acnoi2022] I have done it, but I can't