def Plugin_Start_Standalone(input_files_list, output_params): log.info("Module Started as standalone") for input_path in input_files_list: log.debug("Input file passed was: " + input_path) safari_items = [] if input_path.endswith('.plist'): try: plist = readPlist(input_path) if input_path.lower().endswith('com.apple.safari.plist'): ReadSafariPlist(plist, safari_items, input_path, '') elif input_path.endswith('History.plist'): ReadHistoryPlist(plist, safari_items, input_path, '') elif input_path.endswith('Downloads.plist'): ReadDownloadsPlist(plist, safari_items, input_path, '') elif input_path.endswith('Bookmarks.plist'): ReadBookmarksPlist(plist, safari_items, input_path, '') elif input_path.endswith('TopSites.plist'): ReadTopSitesPlist(plist, safari_items, input_path, '') elif input_path.endswith('LastSession.plist'): ReadLastSessionPlist(plist, safari_items, input_path, '') elif input_path.endswith('Extensions.plist'): ReadExtensionsPlist(plist, safari_items, input_path, '') elif input_path.endswith('RecentlyClosedTabs.plist'): ReadRecentlyClosedTabsPlist(plist, safari_items, input_path, '') else: log.error("Unknown plist type encountered: {}".format(os.path.basename(input_path))) except ValueError as ex: log.exception('Failed to open file: {}'.format(input_path)) elif input_path.endswith('History.db'): log.info ("Processing file " + input_path) try: conn = CommonFunctions.open_sqlite_db_readonly(input_path) log.debug ("Opened database successfully") ReadHistoryDb(conn, safari_items, input_path, '') except (sqlite3.Error, OSError) as ex: log.exception ("Failed to open database, is it a valid SQLITE DB?") elif input_path.endswith('CloudTabs.db'): log.info ("Processing file " + input_path) try: conn = CommonFunctions.open_sqlite_db_readonly(input_path) log.debug ("Opened database successfully") ReadCloudTabsDb(conn, safari_items, input_path, '') except (sqlite3.Error, OSError) as ex: log.exception ("Failed to open database, is it a valid SQLITE DB?") elif input_path.endswith('BrowserState.db'): log.info ("Processing file " + input_path) try: conn = CommonFunctions.open_sqlite_db_readonly(input_path) log.debug ("Opened database successfully") ReadBrowserStateDb(conn, safari_items, input_path, '') except (sqlite3.Error, OSError) as ex: log.exception ("Failed to open database, is it a valid SQLITE DB?") else: log.error('Input file {} is not a recognized name of a Safari artifact!'.fromat(input_path)) if len(safari_items) > 0: PrintAll(safari_items, output_params, input_path) else: log.info('No safari items found in {}'.format(input_path))
def OpenDb(inputPath): log.info("Processing file " + inputPath) try: conn = CommonFunctions.open_sqlite_db_readonly(inputPath) log.debug("Opened database successfully") return conn except sqlite3.Error: log.exception("Failed to open database, is it a valid DB?") return None