当前位置:网站首页>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 .
边栏推荐
- 【无标题】
- 05-ubuntu安装mysql8
- Pyqt common system events
- 5 minutes, excellent customer service chat handling skills
- [real estate opening online house selection, WiFi coverage temporary network] 500 people are connected to WiFi at the same time
- 2021-06-24: find the length of the longest non repeating character substring in a string.
- Battle history between redis and me under billion level traffic
- 2022 tea artist (intermediate) work license question bank and online simulation examination
- 相机投影矩阵计算
- ZUCC_ Principles of compiling language and compilation_ Experiment 05 regular expression, finite automata, lexical analysis
猜你喜欢

2021-03-04 comp9021 class 6 notes

ZUCC_ Principles of compiling language and compilation_ Experiment 01 language analysis and introduction

jwt(json web token)

Question bank and simulation examination for operation certificate of refrigeration and air conditioning equipment in 2022

【微服务~Nacos】Nacos服务提供者和服务消费者

【关于运维和网工的差别,一文说透】

12-- merge two ordered linked lists

分布式 | 如何与 DBLE 进行“秘密通话”

Longhorn installation and use

2021-03-16 comp9021 class 9 notes
随机推荐
【微服务~Nacos】Nacos服务提供者和服务消费者
数据库,查询本月借出书的数量,如果高于10本时,显示“本月借出书大于10本”,否则显示“本月借出书小于10本”
LabVIEW finds prime numbers in an array of n elements
Vscode install the remote -wsl plug-in to connect to the local WSL
App Startup
获取屏幕宽高工具类
QPS, TPS, concurrent users, throughput relationship
11-- longest substring without repeated characters
Battle history between redis and me under billion level traffic
Common CVM transcribes audio using virtual sound card
OpenCV to realize the basic transformation of image
[untitled]
Pyqt common system events
[graduation season] Hello stranger, this is a pink letter
Variable declaration and some special variables in shell
【无标题】
PHP代码加密+扩展解密实战
dataX使用指南
Common misconceptions in Tencent conference API - signature error_ code 200003
jwt(json web token)