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

New Command Line Options
https://www.open-audit.org/phpBB3/viewtopic.php?f=10&t=2273
Page 1 of 1

Author:  jpmorgan [ Fri Jul 06, 2007 4:49 am ]
Post subject:  New Command Line Options

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=""

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