Home >Backend Development >PHP Problem >How many types of php obfuscation are there?
Obfuscation method:
The two files use 4 obfuscation methods to code Obfuscation
1. Append garbled characters to local variables (Recommended learning: PHP video tutorial)
For local variables, after conversion After being a meaningless single character, append multiple '\xEF\xBD\xBD' characters after the variable name, and mix some other invisible characters (after 7E) into it, giving people the feeling of garbled characters. In fact, the single character does not no effect. Local variables can be named whatever you want, as long as they can be distinguished.
2. Use unicode plus escape characters to display strings, using decimal and hexadecimal formats to avoid visual viewing.
php can be used such as "\150\157\155\145\120\141\164\150" (decimal) or "\x73\x79\x73\x74\x65\x6d\x4c \x6f\x67" (hex) as variable names in files. This method directly
3, Use PHP strings to be used as function names, hiding commonly used function names
Used
$GLOBALS global variables
define macro function
base64_decode function
and custom irreversible function _kstr2() function
4 , use string connection symbols to connect the split and converted strings
The result after the _kstr2() code is restored is as follows
function _kstr2($str) { $len = strlen($str); $result = ''; $baseChar = ord($str[0]) - 30; for ($str = 1; $str < $len; $str+= 2) { if ($str + 1 < $len) { $result.= chr(ord($str[$str + 1]) + $baseChar ); $result.= chr(ord($str[$str]) + $baseChar ); } else { $result.= chr(ord($str[$str]) + $baseChar ); } } return $result; } }
The above is the detailed content of How many types of php obfuscation are there?. For more information, please follow other related articles on the PHP Chinese website!