Created
November 5, 2015 13:36
-
-
Save kost/869608061679a5e5b8e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Netsparker batch invocation | |
REM Copyright (C) Vlatko Kosturjak - Kost | |
On Error Resume Next | |
Set args = Wscript.Arguments | |
REM iterate through each argument/file | |
For Each arg in args | |
filename = arg | |
WScript.echo "[i] Using file: " & filename | |
Set fso = CreateObject("Scripting.FileSystemObject") | |
Set f = fso.OpenTextFile(filename) | |
if Err.Number <> 0 Then | |
WScript.Echo "[!] File " & filename & " Open Error: " & Err.Description | |
Err.Clear | |
Exit For | |
End if | |
Do Until f.AtEndOfStream | |
line = f.ReadLine | |
WScript.Echo "[i] URL: " & line | |
if Len(line)>0 then | |
filename=replace4file(line) | |
WScript.Echo "[i] Filename: " & filename | |
Call runCommand(line,filename) | |
end if | |
Loop | |
f.Close | |
Next | |
REM replace specific URL characters to fit in filename | |
Function replace4file(str) | |
filename=str | |
filename=Replace(filename,"/","-") | |
filename=Replace(filename,":","-") | |
replace4file=filename | |
end Function | |
REM run command on URL with output to file | |
Function runCommand(url,file) | |
Dim objShell | |
Set objShell = WScript.CreateObject ("WScript.shell") | |
cmdns="""C:\Program Files (x86)\Netsparker\Netsparker.exe"" " | |
cmdopts=" /auto /url " & url & " /report " & file & " /silent /reporttemplate XML" | |
cmdline=cmdns & cmdopts | |
WScript.Echo "[i] Executing: " & cmdline | |
Call objShell.run(cmdline, 4, true) | |
if Err.Number <> 0 Then | |
WScript.Echo "[!] Execute Error: " & Err.Description | |
Err.Clear | |
End if | |
Set objShell = Nothing | |
end Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment