FIX: bug fixes to the -db feature to allow for single filename, improved error messages in the command line tool

This commit is contained in:
JohnE 2016-01-23 15:44:21 -08:00
parent 85f7e474e2
commit 3efcd0a482
4 changed files with 18 additions and 8 deletions

View File

@ -29,6 +29,9 @@ def compareFingerprint(file_in, file_json):
def createFingerprint(file_in, verbose, app_name, app_ver, notes):
db = FingerprintDB()
retVal = db.scanDBFile(file_in)
print "GOT HERE BITCHES: file_in=={}, retVal=={}".format(file_in, str(retVal))
if (retVal > 0):
if verbose:
db.debugFingerprint()
@ -95,7 +98,8 @@ def androidData(data_dir):
dir_names = []
try:
dirs = os.listdir(data_dir)
except:
except Exception, ex:
print "ERROR opening Android data directory [{}]\n{}".format(data_dir, ex)
return
out_dir = FP_BASE_DIR + "_" + ToolBox.getTimestampStr()

View File

@ -24,6 +24,7 @@
"Creating... FINISHED."
"168 fingerprints in the new index"
[ Android Data ]
-Processing of android data
-removed verbose messsage for each fingerprint

View File

@ -61,7 +61,7 @@ class FingerprintDB:
try:
(self.conn, self.cur) = self.__openDB(filein)
except Exception, ex:
print ex
logging.error(ex)
return -2
try:
@ -75,7 +75,7 @@ class FingerprintDB:
# concat all the table create statements, then md5
self.__createMD5DB()
except Exception, ex:
print ex
logging.error(ex)
return -3
# flag is used to determine if the class has data
@ -89,6 +89,7 @@ class FingerprintDB:
return
try:
print "FILE=={}".format(self.filein)
filename = ToolBox.getTimestampFilename(self.filein)
fh = open(filename, "w")
try:

View File

@ -27,9 +27,13 @@ class ToolBox:
#
@staticmethod
def parseFilename(fqfilepath):
results = re.search(r'.*[\\/](\S*)\..*', fqfilepath)
if len(results.group(1)) != 0:
filename = results.group(1)
filename = 'fingerprint'
try:
results = re.search(r'.*[\\/](\S*)\..*', fqfilepath)
if len(results.group(1)) != 0:
filename = results.group(1)
except:
filename = fqfilepath
return filename
#
@ -44,9 +48,9 @@ class ToolBox:
@staticmethod
def getTimestampFilename(fqfilename):
""" return output file name """
timestr = getTimestampStr()
timestr = ToolBox.getTimestampStr()
filename = ToolBox.parseFilename(fqfilename)
fileout = filename + "_" + timestr + '.json'
fileout = filename + "__" + timestr + '.json'
return fileout
#