2006-05-31 01:20:18 +00:00
|
|
|
#! /usr/bin/php -dopen_basedir=
|
2006-05-09 10:58:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$srcdir = dirname(__FILE__);
|
2012-07-17 08:35:45 +00:00
|
|
|
require_once("$srcdir/../lib/Decompiler.class.php");
|
2006-05-09 10:58:38 +00:00
|
|
|
if (file_exists("$srcdir/phpdc.debug.php")) {
|
|
|
|
include("$srcdir/phpdc.debug.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($argv)) {
|
|
|
|
$argv = $_SERVER['argv'];
|
|
|
|
$argc = $_SERVER['argc'];
|
|
|
|
}
|
|
|
|
|
2008-02-17 16:49:46 +00:00
|
|
|
$dc = new Decompiler();
|
2011-06-08 02:51:59 +00:00
|
|
|
if (isset($argv[2])) {
|
2013-07-10 07:13:14 +00:00
|
|
|
eval('$dc->decompileDasm(' . file_get_contents($argv[2]) . ');');
|
2011-06-08 02:51:59 +00:00
|
|
|
}
|
|
|
|
else if (isset($argv[1])) {
|
2013-07-10 07:13:14 +00:00
|
|
|
if ($dc->decompileFile($argv[1]) === false) {
|
|
|
|
exit(2);
|
|
|
|
}
|
2006-05-09 10:58:38 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$phpcode = '';
|
|
|
|
if (!defined('stdin')) {
|
|
|
|
define('stdin', fopen('php://stdin', 'rb'));
|
|
|
|
}
|
|
|
|
while (!feof(stdin)) {
|
|
|
|
$phpcode .= fgets(stdin);
|
|
|
|
}
|
2013-07-10 07:13:14 +00:00
|
|
|
if ($dc->decompileString($phpcode) === false) {
|
|
|
|
exit(2);
|
|
|
|
}
|
2006-05-09 10:58:38 +00:00
|
|
|
}
|
|
|
|
$dc->output();
|
|
|
|
|