diff --git a/dbfp.py b/dbfp.py index ca903b6..cea3390 100644 --- a/dbfp.py +++ b/dbfp.py @@ -48,7 +48,7 @@ def indexFingerprints(fp_dir): fp = FingerprintIndex() try: fp.openIndex(fp_dir) - print "WARN: index already exists. remove, then reindex\n" + print "WARN: index already exists. remove, then reindex" except: try: retVal = fp.createIndex(fp_dir) @@ -56,9 +56,8 @@ def indexFingerprints(fp_dir): print " {} fingerprints processed.".format(retVal[0]) print " {} fingprint processing errors.".format(retVal[1]) print " {} files skipped (N/A, not a fingerprint file)".format(retVal[2]) - print except Exception as ex: - print "ERROR: issue creating the index\n{}".format(ex) + print ex # def compareFingerprintDir(file_in, fp_dir): diff --git a/docs/devnotes b/docs/devnotes index 216196b..19b643b 100644 --- a/docs/devnotes +++ b/docs/devnotes @@ -3,9 +3,9 @@ Action Items from the code review: --Add function to query the index for a specific MD5 table (database schema) +xx-Add function to query the index for a specific MD5 table (database schema) --Add a feature to add a fingerprint to the existing index (it currently recreates an index) +xx-Add a feature to add a fingerprint to the existing index (it currently recreates an index) -Add a table to the Index to list all the applications that have a fingerprint (include the app version) -more functionality can result from this information in the index diff --git a/libs/fingerprint_index.py b/libs/fingerprint_index.py index 209724a..5dc0ba8 100644 --- a/libs/fingerprint_index.py +++ b/libs/fingerprint_index.py @@ -152,9 +152,19 @@ class FingerprintIndex: fp_list TEXT, fp_count INTEGER); ''') + self.db_conn.execute(''' + CREATE TABLE metadata ( + md5_db TEXT PRIMARY KEY, + app_name TEXT, + app_ver TEXT, + file_name TEXT, + fp_file TEXT, + scan_date NUMERIC); + ''') logging.info("Successfully created index table") except Exception as ex: - raise FingerprintIndexWrite("Error creating index file\n{}".format(ex)) + raise + # raise FingerprintIndexWrite("Error creating index file\n{}".format(ex)) # def __populateIndex(self, fp_dir):