- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
<?php
$zero = '!![]';
$nums = ['![]','${![]}','${!![]}','$${[]}','$${![]}','$${!![]}','$$${[]}','${[].[]}'];
$initChr = "\${[]}=([].[])[![]+![]+![]];\${[]}++;\${[]}++;\${+![]}=\${[]};" .
"\${[]}++;\${[]}++;\${[]}++;\${[]}++;\${[]}++;\${+![]}.=\${[]};" .
"\${[]}=\${+![]}.([].[])[![]];";
$chr = '${[]}';
function initNumbers() {
global $nums;
$n = $nums[0];
$code = '';
foreach ($nums as $v => $num) {
if (!$v) continue;
$v = join('+', array_fill(0, 2, $n));
$code .= "$num=$v;";
$n = $num;
}
return $code;
}
function number($n) {
global $nums, $zero;
if ($n < 0 || $n > 255) die("Invalid number: $n.");
if (!$n) return $zero[0];
$i = 0;
while($n) {
$d = $n % 2;
if($d) $code[] = join('+', array_fill(0, $d, $nums[$i]));
$n /= 2;
$i++;
}
return join('+', $code);
}
function char($c) {
global $chr;
$c = number(ord($c));
return "$chr($c)";
}
function str($s) {
return join('.', array_map('char', str_split($s)));
}
function prettify($fucked) {
$line = '';
$ops = preg_split('/([;.])/', $fucked, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach($ops as $op) {
if(strlen($line) + strlen($op) + 1 > 80) {
$lines[] = $line;
$line = '';
}
$line .= $op;
}
$lines[] = $line;
return join("\n", $lines);
}
function fuckify($code) {
global $chr, $initChr;
$nums = initNumbers();
$php = '$$$${[]}';
$initPHP = $php . '=(' . str('popen') . ')(' . str('php') . ',' . char('w') . ');';
$fputs = str('fputs');
$pclose = str('pclose');
$code = str($code);
return prettify("<?php\n$initChr$nums$initPHP($fputs)($php,$code);($pclose)($php);");
}
$code = '';
while ($line = fgets(STDIN)) $code .= $line;
print(fuckify($code));
HACTEHbKA 25.02.2018 23:15 # 0
запускаем https://ideone.com/8iECEZ
SemaReal 25.02.2018 23:38 # +1
bormand 26.02.2018 06:02 # 0
inho 26.02.2018 00:16 # 0