NEW: md5 serach complete
This commit is contained in:
parent
817530d135
commit
0239696efb
14
dbfp.py
14
dbfp.py
|
@ -121,6 +121,17 @@ def androidData(data_dir):
|
||||||
|
|
||||||
print "COMPLETED: created {} fingerprints\n".format(str(fin_count))
|
print "COMPLETED: created {} fingerprints\n".format(str(fin_count))
|
||||||
|
|
||||||
|
#
|
||||||
|
def queryMD5(fp_dir, md5_db):
|
||||||
|
try:
|
||||||
|
fp = FingerprintIndex()
|
||||||
|
fp.openIndex(fp_dir)
|
||||||
|
results = fp.findDB(md5_db)
|
||||||
|
print results
|
||||||
|
except Exception as ex:
|
||||||
|
print "ERROR: {}".format(ex)
|
||||||
|
|
||||||
|
|
||||||
# in_dir: fully qualified directory path to find sqlite files
|
# in_dir: fully qualified directory path to find sqlite files
|
||||||
def __createFingerprint(in_dir, out_dir, dir_name):
|
def __createFingerprint(in_dir, out_dir, dir_name):
|
||||||
fin_count = 0
|
fin_count = 0
|
||||||
|
@ -175,6 +186,7 @@ def parseArgs():
|
||||||
parser.add_argument('-ad', '--android_dir', required=False, help="path to a directory with android folder structure sqlite files")
|
parser.add_argument('-ad', '--android_dir', required=False, help="path to a directory with android folder structure sqlite files")
|
||||||
parser.add_argument('-dd', '--data_dir', required=False, help="path to a directory to search for sqlite files")
|
parser.add_argument('-dd', '--data_dir', required=False, help="path to a directory to search for sqlite files")
|
||||||
parser.add_argument('-idx', '--index_fingerprints', required=False, help="path to a directory with sqlite files")
|
parser.add_argument('-idx', '--index_fingerprints', required=False, help="path to a directory with sqlite files")
|
||||||
|
parser.add_argument('-md5', required=False, help="md5 hash to query the index`")
|
||||||
parser.add_argument('-an', '--app_name', required=False)
|
parser.add_argument('-an', '--app_name', required=False)
|
||||||
parser.add_argument('-av', '--app_version', required=False)
|
parser.add_argument('-av', '--app_version', required=False)
|
||||||
parser.add_argument('-n', '--notes', required=False)
|
parser.add_argument('-n', '--notes', required=False)
|
||||||
|
@ -199,6 +211,8 @@ def parseArgs():
|
||||||
compareFingerprint(args.database, args.fingerprint)
|
compareFingerprint(args.database, args.fingerprint)
|
||||||
elif (args.database and args.fpdir):
|
elif (args.database and args.fpdir):
|
||||||
compareFingerprintDir(args.database, args.fpdir)
|
compareFingerprintDir(args.database, args.fpdir)
|
||||||
|
elif (args.fpdir and args.md5):
|
||||||
|
queryMD5(args.fpdir, args.md5)
|
||||||
elif (args.android_dir):
|
elif (args.android_dir):
|
||||||
androidData(args.android_dir)
|
androidData(args.android_dir)
|
||||||
elif (args.index_fingerprints):
|
elif (args.index_fingerprints):
|
||||||
|
|
|
@ -19,6 +19,10 @@ http://stackoverflow.com/questions/11942762/get-application-version-name-using-a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
com.google.android.gms__node.db
|
||||||
|
0b48447805d645966439e1b4042d2625
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[ Regression Testing ]
|
[ Regression Testing ]
|
||||||
android pull, data dir, comparison
|
android pull, data dir, comparison
|
||||||
|
|
|
@ -59,9 +59,7 @@ class FingerprintIndex:
|
||||||
#
|
#
|
||||||
def findFP(self, md5_db, md5_tables):
|
def findFP(self, md5_db, md5_tables):
|
||||||
rows = self.__qDatabaseMD5(md5_db)
|
rows = self.__qDatabaseMD5(md5_db)
|
||||||
# rowcount will be -1 if nothing was returned
|
if len(rows) > 0:
|
||||||
if rows.rowcount > 0:
|
|
||||||
#print "***** __qDatabaseMD5 *****\n{}\n".format(rows)
|
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
for md5_table in md5_tables:
|
for md5_table in md5_tables:
|
||||||
|
@ -76,11 +74,8 @@ class FingerprintIndex:
|
||||||
return retval.keys()
|
return retval.keys()
|
||||||
|
|
||||||
#
|
#
|
||||||
def findTable(self, md5_db):
|
def findDB(self, md5_db):
|
||||||
rows = self.__qDatabaseMD5(md5_db)
|
rows = self.__qDatabaseMD5(md5_db)
|
||||||
# rowcount will be -1 if nothing was returned
|
|
||||||
if rows.rowcount > 0:
|
|
||||||
#print "***** __qDatabaseMD5 *****\n{}\n".format(rows)
|
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -92,10 +87,10 @@ class FingerprintIndex:
|
||||||
WHERE md5_db=?
|
WHERE md5_db=?
|
||||||
''', [md5_db])
|
''', [md5_db])
|
||||||
|
|
||||||
|
results = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
# normalize the data, go from tuple to array
|
results.append((row[0], row[1], row[2]))
|
||||||
# https://docs.python.org/2/library/sqlite3.html
|
return results
|
||||||
return rows
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logging.error(ex)
|
logging.error(ex)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue