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

audit.vbs w/command switches (alternate configs, etc.)
https://www.open-audit.org/phpBB3/viewtopic.php?f=5&t=2171
Page 2 of 2

Author:  jpmorgan [ Sat Jul 21, 2007 5:02 am ]
Post subject:  Re: audit.vbs w/command switches (alternate configs, etc.)

I've made some changes to audit.vbs that allow all options listed in audit.config to be used as command line options. Audit.vbs first reads the audit.config file then overwrites the variables with those passed on the command line

Replace the existing argument code:

[code]
' If any command line args given - use the first one as strComputer
If Wscript.Arguments.Count > 0 Then
strComputer = wscript.arguments(0)
end if
If Wscript.Arguments.Count > 1 Then
strUser = wscript.arguments(1)
end if
If Wscript.Arguments.Count > 2 Then
strPass = wscript.arguments(2)
end if
[/code]

With this code:

[code]
' Parse the arguments using Split function
For Each sArg In Wscript.Arguments
a = Split(sArg, "=", 2)
sName = a(0)
If UBound(a) >= 1 Then
sValue = a(1)
ExecuteGlobal sName & "=" & "sValue"
Else
sValue = ""
End If
Next
[/code]

Then replace:

[code]
command1 = "cscript " & script_name & " " & comparray(i)
[/code]

With :

[code]
command1 = "cscript " & script_name & " " & "strComputer=" & comparray(i)
[/code]

And Replace this:
[code]
command1 = "cscript " & script_name & " " & comparray(i) & " " & userarray(i) & " " & passarray(i)
[/code]

With this:
[code]
command1 = "cscript " & script_name & " " & "strComputer=" & comparray(i) & " " & "strUser=" & userarray(i) & " " & "strPass=" & passarray(i)
[/code]

With these changes you can run audit.vbs and pass the computer name, username and password as well as all other options available in audit.config. For example:

cscript audit.vbs audit_location="r" non_ie_page="http://inv/admin_pc_add_2.php" strcomputer="." audit_local_domain="n" verbose="n"

cscript audit.vbs strComputer="Computer1" strUser="Username1" strPass="password"

cscript audit.vbs audit_location="r" non_ie_page="http://inv/admin_pc_add_2.php" input_file="input.txt" strcomputer=""

Author:  qc_metal [ Wed Nov 14, 2007 7:42 am ]
Post subject:  Re: audit.vbs w/command switches (alternate configs, etc.)

I've updated my audit.vbs to work with the newest version of Open-Audit (as of 10/12/07).

I've left most code intact, but have changed the command line switches as my modifications will allow you to use the switches in any order. Did not add the above command line switches though (the ones that replace the audit.config variables)...

See my previous post with the link in it.

Seems to be working OK so far.

Rob

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