NEW: added create table metadata, used for application info
This commit is contained in:
parent
bb30cecee2
commit
39408902a7
5
dbfp.py
5
dbfp.py
|
@ -48,7 +48,7 @@ def indexFingerprints(fp_dir):
|
||||||
fp = FingerprintIndex()
|
fp = FingerprintIndex()
|
||||||
try:
|
try:
|
||||||
fp.openIndex(fp_dir)
|
fp.openIndex(fp_dir)
|
||||||
print "WARN: index already exists. remove, then reindex\n"
|
print "WARN: index already exists. remove, then reindex"
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
retVal = fp.createIndex(fp_dir)
|
retVal = fp.createIndex(fp_dir)
|
||||||
|
@ -56,9 +56,8 @@ def indexFingerprints(fp_dir):
|
||||||
print " {} fingerprints processed.".format(retVal[0])
|
print " {} fingerprints processed.".format(retVal[0])
|
||||||
print " {} fingprint processing errors.".format(retVal[1])
|
print " {} fingprint processing errors.".format(retVal[1])
|
||||||
print " {} files skipped (N/A, not a fingerprint file)".format(retVal[2])
|
print " {} files skipped (N/A, not a fingerprint file)".format(retVal[2])
|
||||||
print
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print "ERROR: issue creating the index\n{}".format(ex)
|
print ex
|
||||||
|
|
||||||
#
|
#
|
||||||
def compareFingerprintDir(file_in, fp_dir):
|
def compareFingerprintDir(file_in, fp_dir):
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
Action Items from the code review:
|
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)
|
-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
|
-more functionality can result from this information in the index
|
||||||
|
|
|
@ -152,9 +152,19 @@ class FingerprintIndex:
|
||||||
fp_list TEXT,
|
fp_list TEXT,
|
||||||
fp_count INTEGER);
|
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")
|
logging.info("Successfully created index table")
|
||||||
except Exception as ex:
|
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):
|
def __populateIndex(self, fp_dir):
|
||||||
|
|
Loading…
Reference in New Issue