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:
parent
85f7e474e2
commit
3efcd0a482
6
dbfp.py
6
dbfp.py
|
@ -29,6 +29,9 @@ def compareFingerprint(file_in, file_json):
|
||||||
def createFingerprint(file_in, verbose, app_name, app_ver, notes):
|
def createFingerprint(file_in, verbose, app_name, app_ver, notes):
|
||||||
db = FingerprintDB()
|
db = FingerprintDB()
|
||||||
retVal = db.scanDBFile(file_in)
|
retVal = db.scanDBFile(file_in)
|
||||||
|
|
||||||
|
print "GOT HERE BITCHES: file_in=={}, retVal=={}".format(file_in, str(retVal))
|
||||||
|
|
||||||
if (retVal > 0):
|
if (retVal > 0):
|
||||||
if verbose:
|
if verbose:
|
||||||
db.debugFingerprint()
|
db.debugFingerprint()
|
||||||
|
@ -95,7 +98,8 @@ def androidData(data_dir):
|
||||||
dir_names = []
|
dir_names = []
|
||||||
try:
|
try:
|
||||||
dirs = os.listdir(data_dir)
|
dirs = os.listdir(data_dir)
|
||||||
except:
|
except Exception, ex:
|
||||||
|
print "ERROR opening Android data directory [{}]\n{}".format(data_dir, ex)
|
||||||
return
|
return
|
||||||
|
|
||||||
out_dir = FP_BASE_DIR + "_" + ToolBox.getTimestampStr()
|
out_dir = FP_BASE_DIR + "_" + ToolBox.getTimestampStr()
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"Creating... FINISHED."
|
"Creating... FINISHED."
|
||||||
"168 fingerprints in the new index"
|
"168 fingerprints in the new index"
|
||||||
|
|
||||||
|
|
||||||
[ Android Data ]
|
[ Android Data ]
|
||||||
-Processing of android data
|
-Processing of android data
|
||||||
-removed verbose messsage for each fingerprint
|
-removed verbose messsage for each fingerprint
|
||||||
|
|
|
@ -61,7 +61,7 @@ class FingerprintDB:
|
||||||
try:
|
try:
|
||||||
(self.conn, self.cur) = self.__openDB(filein)
|
(self.conn, self.cur) = self.__openDB(filein)
|
||||||
except Exception, ex:
|
except Exception, ex:
|
||||||
print ex
|
logging.error(ex)
|
||||||
return -2
|
return -2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -75,7 +75,7 @@ class FingerprintDB:
|
||||||
# concat all the table create statements, then md5
|
# concat all the table create statements, then md5
|
||||||
self.__createMD5DB()
|
self.__createMD5DB()
|
||||||
except Exception, ex:
|
except Exception, ex:
|
||||||
print ex
|
logging.error(ex)
|
||||||
return -3
|
return -3
|
||||||
|
|
||||||
# flag is used to determine if the class has data
|
# flag is used to determine if the class has data
|
||||||
|
@ -89,6 +89,7 @@ class FingerprintDB:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
print "FILE=={}".format(self.filein)
|
||||||
filename = ToolBox.getTimestampFilename(self.filein)
|
filename = ToolBox.getTimestampFilename(self.filein)
|
||||||
fh = open(filename, "w")
|
fh = open(filename, "w")
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -27,9 +27,13 @@ class ToolBox:
|
||||||
#
|
#
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parseFilename(fqfilepath):
|
def parseFilename(fqfilepath):
|
||||||
results = re.search(r'.*[\\/](\S*)\..*', fqfilepath)
|
filename = 'fingerprint'
|
||||||
if len(results.group(1)) != 0:
|
try:
|
||||||
filename = results.group(1)
|
results = re.search(r'.*[\\/](\S*)\..*', fqfilepath)
|
||||||
|
if len(results.group(1)) != 0:
|
||||||
|
filename = results.group(1)
|
||||||
|
except:
|
||||||
|
filename = fqfilepath
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -44,9 +48,9 @@ class ToolBox:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getTimestampFilename(fqfilename):
|
def getTimestampFilename(fqfilename):
|
||||||
""" return output file name """
|
""" return output file name """
|
||||||
timestr = getTimestampStr()
|
timestr = ToolBox.getTimestampStr()
|
||||||
filename = ToolBox.parseFilename(fqfilename)
|
filename = ToolBox.parseFilename(fqfilename)
|
||||||
fileout = filename + "_" + timestr + '.json'
|
fileout = filename + "__" + timestr + '.json'
|
||||||
return fileout
|
return fileout
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue