Inspired by aemkei/jsfuck and based on splitline/PHPFuck
Using only 6 different characters to write and execute PHP.
Only support PHP 7+ currently.
The following source will execute phpinfo();
:
<?php ((([]^[]).[]^(([].[])[[]]^([].[])[[[]]]^[[]]).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).(([].[])[[[]]]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).(([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))^[[]]).[]^([].[])[[]]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))^[[]]).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[]]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[]]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[]).[]^(([].[])[[]]^([].[])[[[]]]^[[]]).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))^[[]]).[]^([].[])[[]]).(([]^[]).[]^([].[])[[]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).((([].[])[[]]^([].[])[[[]]]^[[]]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]])))).[]^([].[])[[]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]))(...(((([].[])[[]]^([].[])[[[]]]^[[]]).[]^([].[])[[]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))^[[]]).[]^([].[])[[]]).(([].[])[[[]]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))^[[]]).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).((([].[])[[]]^([].[])[[[]]]^[[]]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))^[[]]).[]^([].[])[[]]).(([]^[]).[]^(([].[])[[]]^([].[])[[[]]]^[[]]).[]^([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^([].[])[[[]]]^[[]]).[]^([].[])[[]]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[[]]]))(((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[[]]).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]).(([]^[[]]).[]^([].[])[[]]).(([]^[[]]).[]^([].[])[[]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[[]]).[]^([].[])[[]]).(([]^[]).[]^([].[])[[]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[]).[]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).((([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))).[]^([].[])[[]]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]]).((([].[])[[]]^([].[])[[[]]]^[[]]^(([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]])))).[]^([].[])[[]]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[]).[]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[[]]).[]^([].[])[([].[])[[]]^([].[])[[[]]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[]).[]^([].[])[[[]]]^([].[])[([].[])[[]]^(([]^[]).[].[])[([]^[[]]).([]^[])]^[]^(([]^[[]]).(([].[])[[]]^([].[])[[[]]]^[[]]))]).(([]^[[]]).[]^([].[])[[[]]]^([].[])[([].[])[[]]^([].[])[[[]]]])))() ?>
usage: phpfun.py [-h] [-O FILE] [-P] [-E {assert,create_function}] code
positional arguments:
code any string to encode.
optional arguments:
-h, --help show this help message and exit
-O FILE, --output-file FILE
write encoded string into some file.
-P, --plain-string encode as plain string (without eval it).
-E {assert,create_function}, --eval {assert,create_function}
choose eval mode. (`assert` mode only support PHP < 7.1)
You can just use it like this: python3 phpfun.py "system('id');"
- code (required)
- Any string or php code to encode.
- -O, --output-file
- Write encoded string into some file.
- -P, --plain-string
- Encode as plain string (without eval it).
- With this argument, I will not wrap your code into
assert
orcreate_function
to eval.
- -E, --eval
- You can choose your eval mode!
create_function
mode (default)create_function('', YOUR_CODE)();
assert
mode- Only support PHP < 7.1 (=7.0.x).
assert( '(function(){ YOUR_CODE; return 1; })()' );
- Don't use deprecated feature. (
create_function
has been DEPRECATED) - Compatible with PHP 8
- With
[^a-zA-Z0-9]
and len(set(encoded)) < 6