MCPcopy Index your code
hub / github.com/jipegit/OSXAuditor / DumpSQLiteDb

Function DumpSQLiteDb

osxauditor.py:573–596  ·  view source on GitHub ↗

Dump a SQLite database file

(SQLiteDbPath)

Source from the content-addressed store, hash-verified

571 PrintAndLog(EmailUserPath + u' does not exist', 'DEBUG')
572
573def DumpSQLiteDb(SQLiteDbPath):
574 ''' Dump a SQLite database file '''
575
576 PrintAndLog(SQLiteDbPath, 'DEBUG')
577 if os.path.isfile(SQLiteDbPath):
578 try:
579 DbConnection = sqlite3.connect(SQLiteDbPath)
580 DbCursor = DbConnection.cursor()
581 DbCursor.execute("SELECT * from sqlite_master WHERE type = 'table'")
582 Tables = DbCursor.fetchall()
583 for Table in Tables:
584 PrintAndLog(u'Table ' + Table[2].decode('utf-8'), 'DEBUG')
585 DbCursor.execute("SELECT * from " + Table[2])
586 Rows = DbCursor.fetchall()
587 if len(Rows) == 0:
588 PrintAndLog(u'Table ' + Table[2].decode('utf-8') + u' is empty', 'INFO')
589 else:
590 for Row in Rows:
591 PrintAndLog(str(Row).decode('utf-8') + u'\n', 'INFO_RAW')
592 DbConnection.close()
593 except Exception as e:
594 PrintAndLog(u'Error with ' + SQLiteDbPath.decode('utf-8') + u': ' + str(e.args).decode('utf-8'), 'ERROR')
595 else:
596 PrintAndLog(SQLiteDbPath.decode('utf-8') + u' not found\n', 'ERROR')
597
598def ParseFirefoxProfile(User, Profile):
599 ''' Parse the different SQLite databases in a Firefox profile '''

Callers 4

ParseFirefoxProfileFunction · 0.85
ParseSafariProfileFunction · 0.85
ParseChromeProfileFunction · 0.85
ParseUsersAccountsFunction · 0.85

Calls 1

PrintAndLogFunction · 0.85

Tested by

no test coverage detected