Dump a SQLite database file
(SQLiteDbPath)
| 571 | PrintAndLog(EmailUserPath + u' does not exist', 'DEBUG') |
| 572 | |
| 573 | def 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 | |
| 598 | def ParseFirefoxProfile(User, Profile): |
| 599 | ''' Parse the different SQLite databases in a Firefox profile ''' |
no test coverage detected