diff --git a/Decompiler.class.php b/Decompiler.class.php index b9e900b..4a441dc 100644 --- a/Decompiler.class.php +++ b/Decompiler.class.php @@ -905,6 +905,20 @@ class Decompiler $this->endComplexBlock($EX); return; } + if ($firstOp['opcode'] == XC_JMPZ && !empty($firstOp['jmpouts']) + && $firstOp['jmpouts'][0] - 1 == $range[1] && $opcodes[$firstOp['jmpouts'][0] - 1]['opcode'] == XC_RETURN) { + $this->beginComplexBlock($EX); + $this->removeJmpInfo($EX, $range[0]); + $condition = $this->getOpVal($opcodes[$range[0]]['op1'], $EX); + + echo $indent, 'if (', str($condition, $EX), ') ', '{', PHP_EOL; + $this->beginScope($EX); + $this->recognizeAndDecompileClosedBlocks($EX, $range); + $this->endScope($EX); + echo $indent, '}', PHP_EOL; + $this->endComplexBlock($EX); + return; + } // }}} // {{{ try/catch if (!empty($firstOp['jmpins']) && !empty($opcodes[$firstOp['jmpins'][0]]['isCatchBegin'])) { diff --git a/phpdop.phpr b/phpdop.phpr index 692312c..2f6960c 100755 --- a/phpdop.phpr +++ b/phpdop.phpr @@ -94,7 +94,12 @@ if (!isset($argv[1])) { die("Usage: $argv[0] \n"); } $decompiler = new Decompiler(); -$pk = xcache_dasm_file($argv[1]); +if (isset($argv[2])) { + eval('$pk = ' . file_get_contents($argv[2]) . ';'); +} +else { + $pk = xcache_dasm_file($argv[1]); +} $op_array = $funcs = $classes = null; if (isset($pk['op_array'])) { $op_array = $pk['op_array'];