From 70415aaf8d5249c6af08206b28e7ff42db654c65 Mon Sep 17 00:00:00 2001 From: Alban Diquet Date: Sat, 9 Nov 2013 22:53:45 +0800 Subject: [PATCH] Add sanity check on DB path The current error message is a bit cryptic --- analyzer/DBParser.py | 2 +- analyzer/introspy.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/analyzer/DBParser.py b/analyzer/DBParser.py index 2032ecd..cd6f66c 100644 --- a/analyzer/DBParser.py +++ b/analyzer/DBParser.py @@ -32,7 +32,7 @@ def __init__(self, dbPath): argsAndReturnValue = self._sanitize_args_dict(plistlib.readPlistFromString(row[2].encode('utf-8'))))) rowid += 1 except sqlite3.Error as e: - print "Fatal error: %s" % e + #print "Fatal error: %s" % e raise finally: if SqlConn: diff --git a/analyzer/introspy.py b/analyzer/introspy.py index d09456f..c6af7b0 100644 --- a/analyzer/introspy.py +++ b/analyzer/introspy.py @@ -8,6 +8,7 @@ __copyright__ = "Copyright 2013, iSEC Partners, Inc." from sys import argv +import os from argparse import ArgumentParser from re import match from DBAnalyzer import DBAnalyzer @@ -68,6 +69,10 @@ def main(argv): # Process the DB + # Make sure it's there + if not os.path.exists(db_path): # Nice race condition + print 'Error: Could not find the DB file.' + return analyzedDB = DBAnalyzer(db_path)