[quote="Malenx"]Line 2578 and 2579 of Audit.vbs
' Include customer specific audits ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile("audit_custom_software.inc").ReadAll
This calls audit_custom_software.inc which reads the registry and updates the xml. Couldn't we call all these categories one at a time using this method? Or would that break the IE side?
You could indeed, in fact, you could install a simple "shim" audit.vbs which asks for each part of the main audit.vbs file from the server as and when it needs it, using the method I used to grab the config from the server. Using this method, you would have greater control of the script, it would never be out of date (as it would always get the latest version of each section from the server), and the scripts could be tailored to the calling PC/Linux Box/Sandwich Toaster or whatever called it.
Something like...
audit.vbs becomes...
[code] Pseudocode.. audit.vbs ''''''''''''''''''''''''''''''''''' ' Open Audit ' ' Software and Hardware Inventory ' ' Outputs into MySQL ' ' (c) Open-Audit.org 2003-2007 ' ' Licensed under the GPL ' ''''''''''''''''''''''''''''''''''' ' this_main_url = "%host_url%" if (left(this_main_url,1) = "%") then this_main_url = "http://openaudit/openaudit/scripts/send_main.php" end if ' ' ' Find out the name of this script, usually audit.vbs but it depends where we were called form. full_script_name = WScript.ScriptFullName ' Strip off the .vbs and the path, so we can create files with the same suffix. ' No point in creating or overwriting audit.config if we aren't called audit.vbs script_prefix = Left(full_script_name,(InStrRev(full_script_name,".vbs")-1)) script_prefix = Right(script_prefix,(len(script_prefix) - (InStrRev(WScript.ScriptFullName,"\")))) ' We also need the Path sScriptPath=Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName,"\"))
this_main = sScriptPath & script_prefix & ".main"
dim filesys Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(this_main) then ' Do nothing, or panic, since we should destroy the old "main" once the script has run else 'wscript.echo("Downloading Main Audit Code") ' '
' Now we open the web page where the remote main lives Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Microsoft.XmlHttp") ' ...and we grab it.. http.open "GET",this_main_url, FALSE http.send "" ' Set main_file = CreateObject("Scripting.FileSystemObject") Set our_main = main_file.OpenTextFile( this_main, ForWriting, True) '... and post it to our local config. our_main.write http.responseText our_main.close End If ' End of web download script. ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile(this_main).ReadAll ' [/code]
/scripts/send_main.php then sends the actual main part of the code...
If send_main.php uses a similar handoff proceedure, then it can in theory send each section of the code separately, run it, load the next section etc ad infinitum.
You can do something similar using bash scripts, just as easily.
You do need to have write access somewhere on the target box in order to read in and save the script sections, and run them.
_________________ Andrew
[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home) LDAP: Active Directory[/size]
|