Open-AudIT
https://www.open-audit.org/phpBB3/

my code for nmap.vbs all IP classes compatibility mod
https://www.open-audit.org/phpBB3/viewtopic.php?f=10&t=2452
Page 1 of 1

Author:  exmachina [ Fri Nov 02, 2007 5:48 am ]
Post subject:  my code for nmap.vbs all IP classes compatibility mod

i post here my mod for scanning all Ip classes with nmap.vbs

for use modify audit.config file
like this :
nmap_ip_start = "172.25.0.5"
nmap_ip_end = "172.25.6.24"

and copy following code in nmap.vbs new file


[code]'''''''''''''''''''''''''''''''''''
' Open Audit '
' Software and Hardware Inventory '
' Outputs into MySQL '
' (c) Mark Unwin 2003 with exmachina all class compatibility mod '
'''''''''''''''''''''''''''''''''''


''''''''''''''''''''''''''''''''''''
' User defined settings below here '
''''''''''''''''''''''''''''''''''''

' Below calls the file audit_include.vbs to setup the variables.
ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile("audit.config").ReadAll


'nmap_ip_start = "192.168.0.1"
'nmap_ip_end = "192.168.0.24"

'nmap_ie_form_page = "http://192.168.10.28/oa/admin_nmap_input.php"
'nmap_ie_visible = "n"
'nmap_ie_auto_close = "y"


''''''''''''''''''''''''''''''''''''''''
' Don't change the settings below here '
''''''''''''''''''''''''''''''''''''''''
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const ForAppending = 8


Set oShell = CreateObject("Wscript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "\" & oFS.GetTempName


sTempFile = "temp.txt"

'-----------------------------IP START TRAITEMENT------------------------------------------------
ip_start_A = Left(nmap_ip_start,(InStr(1,nmap_ip_start,".")-1))

ip_start_B = Mid(nmap_ip_start,InStr(1,nmap_ip_start,".")+1,InStr(InStr(1,nmap_ip_start,".")+1,nmap_ip_start,".")-InStr(1,nmap_ip_start,".")-1)

ip_start_C = Mid(nmap_ip_start,InStr(InStr(1,nmap_ip_start,".")+1,nmap_ip_start,".")+1,InStr(InStr(InStr(1,nmap_ip_start,".")+1,nmap_ip_start,".")+1,nmap_ip_start,".")-InStr(InStr(1,nmap_ip_start,".")+1,nmap_ip_start,".")-1)

ip_start_D = Right(nmap_ip_start,Len(nmap_ip_start)-InStr(InStr(InStr(1,nmap_ip_start,".")+1,nmap_ip_start,".")+1,nmap_ip_start,"."))
'-----------------------------IP END TRAITEMENT------------------------------------------------

ip_end_A = left(nmap_ip_end,(InStr(1,nmap_ip_end,".")-1))

ip_end_B = Mid(nmap_ip_end,InStr(1,nmap_ip_end,".")+1,InStr(InStr(1,nmap_ip_end,".")+1,nmap_ip_end,".")-InStr(1,nmap_ip_end,".")-1)


ip_end_C = Mid(nmap_ip_end,InStr(InStr(1,nmap_ip_end,".")+1,nmap_ip_end,".")+1,InStr(InStr(InStr(1,nmap_ip_end,".")+1,nmap_ip_end,".")+1,nmap_ip_end,".")-InStr(InStr(1,nmap_ip_end,".")+1,nmap_ip_end,".")-1)

ip_end_D = Right(nmap_ip_end,Len(nmap_ip_end)-InStr(InStr(InStr(1,nmap_ip_end,".")+1,nmap_ip_end,".")+1,nmap_ip_end,"."))


nmap = "nmap.exe -O -v -oN " & sTempFile & " "


'''''''''''''''''''''''''''''''''''
' Script loop starts here '
'''''''''''''''''''''''''''''''''''

for ipA = ip_start_A to ip_end_A
for ipB = ip_start_B to ip_end_B
for ipC = ip_start_C to ip_end_C
for ipD = ip_start_D to ip_end_D
Dim ie
Dim oDoc
scan = nmap & ipA & "." & ipB & "." & ipC & "." & ipD
wscript.echo scan
Set sh=WScript.CreateObject("WScript.Shell")
sh.Run scan, 6, True
set sh = nothing
set form_input = nothing
set file_read = nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(sTempFile, 1)
Do Until objTextFile.AtEndOfStream
strText = objTextFile.ReadAll
Loop
objTextFile.Close
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate nmap_ie_form_page
Do Until IE.readyState = 4 : WScript.sleep(200) : Loop
if nmap_ie_visible = "y" then
ie.visible= True
else
ie.visible = False
end if
Set oDoc = IE.document
Set oAdd = oDoc.getElementById("add")
' oAdd.value = oAdd.value + strText
oAdd.value = strText
IE.Document.All("submit").Click
if nmap_ie_auto_close = "y" then
Do Until IE.readyState = 4 : WScript.sleep(5000) : Loop
WScript.sleep(5000)
ie.Quit
end if
next
next
next
next
wscript.quit
[/code]

Page 1 of 1 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/