Open-AudIT https://www.open-audit.org/phpBB3/ |
|
Domain Audits https://www.open-audit.org/phpBB3/viewtopic.php?f=5&t=1343 |
Page 1 of 1 |
Author: | d.l.dave [ Wed Aug 30, 2006 3:47 am ] |
Post subject: | Domain Audits |
Currently failed audits etc are not dealt with very well. I propose we change the [code]'''''''''''''''''''''''''''''''''''''''' ' Audit the local domain, if requested ' '''''''''''''''''''''''''''''''''''''''' [/code] section code to something similar to below. This would mean each audit.vbs exitcode can be recorded (and infact the stdout, stderror if required). This can be then used to create the failed audit list. Then audit.vbs can be updated so that different error codes are raised (i.e. WScript.quit(errorcode)) depending on the error. These can then be included in the failed audit file. Any comments on the code/idea [code] Const maxThreads = 2 Const noOfProcessors = 7 Dim WshShell Dim theThreads(), processResults(), threadNum Dim i Set WshShell = CreateObject("WScript.Shell") redim theThreads(maxThreads,1) redim processResults(noOfProcessors) i = 0 Do While i < noOfProcessors While getNextThread = -1 WScript.Sleep 1000 Wend threadNum = getNextThread if (not isempty(theThreads(threadNum,0))) then 'record exit code WScript.echo "Process Number:" & theThreads(threadNum,1) processResults(theThreads(threadNum,1)) = theThreads(threadNum,0).ExitCode end if set theThreads(threadNum,0) = WshShell.Exec("cscript audit.vbs computer" & i) theThreads(threadNum,1) = i i = i + 1 Loop waitForThreads() for i = 0 to UBound(processResults) WScript.echo processResults(i) next sub waitForThreads() Dim i for i = 0 to UBound(theThreads,1) while theThreads(i,0).status = 0 WScript.Sleep 1000 wend WScript.echo "Process Number:" & theThreads(i,1) processResults(theThreads(i,1)) = theThreads(i,0).ExitCode next end sub function getNextThread() Dim i getNextThread = -1 for i = 0 to UBound(theThreads,1) if (isempty(theThreads(i,0))) then getNextThread = i elseif (theThreads(i,0).status <> 0) then getNextThread = i end if next end function [/code] |
Author: | A_Hull [ Wed Aug 30, 2006 6:11 pm ] |
Post subject: | |
Certainly an improvement. This is a necessity. Only trouble is, how does the new audit.vbs handle inablilty to connect to WMI. so far as I am aware this is one of the major problems we have. If you attempt a connection to WMI and it fails for a known reason, thats fine, but if you attempt a connection and it times out.... it doesn't, ever actually time out. This is the reason that when I look on the machine doing my audits, I invariably have two command windows open, one for a server with WMI screwed up on it (this is a production terminal server, so scheduling time to fix this is also a problem), and one for a workstation with an unknown WMI problem which we are going to bin soon anyway.. We need to be able to spawn a WMI connection test first, if this fails to talk to us within say 2 mins, we kill it, post the failure and then move on to the next box. I like the idea, and think this should be priority number one, however I also think we need to release something stable soon. I suspect that if we start some a major re-write of audit.vbs, we need to do so in another branch, or after we finish the current cleanup and relaease cycle. If you want to make a start on this idea, I am always willing to assist with the testing. |
Author: | d.l.dave [ Wed Aug 30, 2006 9:45 pm ] |
Post subject: | |
Hmm, maybe this isn't the best way to go. The child process freezes if it writes out more than 4k on the stderr or stdout. This means that the above program has to be updated to keep clearing the stderr and stdout on the WshScriptExec object. Or we need some guarantee that the audit script will never write out more than 4k (hmm, not a great idea) I updated the code to keep reading the streams but came accross another problem. I created a loop to read the stderr and stdout on each WshScriptExec object in turn. The problem is the AtEndOfStream property hangs if nothing has been written to the stream. So if nothing is ever written to stderr stream then the program will hang forever. |
Page 1 of 1 | All times are UTC + 10 hours |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |