OSXAuditor icon indicating copy to clipboard operation
OSXAuditor copied to clipboard

NSRangeException index 0 beyond bounds for SessionWindow

Open brodjieski opened this issue 10 years ago • 2 comments

When running OSXAuditor on a system in which a user does not have any saved Session data from Safari, an error is generated. The error is:

IndexError: NSRangeException - -[__NSCFArray objectAtIndex:]: index (0) beyond bounds (0)

The contents of the LastSession.plist are:

{ SessionVersion = "1.0"; SessionWindows = ( ); }

From what I can gather, this section (line 713) is not validating there are objects within the SessionWindows key of the plist.

if "SessionWindows" in LastSessionPlist:
    LastSession = LastSessionPlist["SessionWindows"][0]["TabStates"][0]
    PrintAndLog(LastSession["TabURL"].decode("utf-8") + u" - " + binascii.hexlify(LastSession["SessionState"]).decode("hex").decode("utf-8", "ignore"), "INFO")

Once I open some tabs in Safari and quit, the LastSession.plist file contains data in the SessionWindows key, and the osxauditor.py script runs without issue.

brodjieski avatar Mar 20 '14 19:03 brodjieski

Had the same error and this fixed things if that helps in any way. Perhaps check the length of SessionWindows?

ActionScripted avatar Sep 16 '14 17:09 ActionScripted

Can't reproduce.

jipegit avatar Oct 31 '15 11:10 jipegit