WIP: updating the automated fingerprinting

This commit is contained in:
JohnE 2015-10-27 08:55:25 -07:00
parent d99d1d6a66
commit d94f5c8659
2 changed files with 35 additions and 5 deletions

37
dbfp.py
View File

@ -1,6 +1,7 @@
#
#
#
import os
import argparse
import time
import logging
@ -10,6 +11,7 @@ from libs import android
from subprocess import Popen, PIPE, check_call
BASE_DIR = "data"
FP_BASE_DIR = "fingerprints"
def main():
@ -54,16 +56,43 @@ def fingerprintDir():
print "ERROR: adb is not running as root, exec 'adb root'"
return
logging.info("isRoot == {}".format(isRoot))
if (not mkdir(BASE_DIR)):
return
if (not mkdir(FP_BASE_DIR)):
return
dir_names = ap.getAppsDir()
for dir_name in dir_names:
ap.pullApp(BASE_DIR, dir_name)
# logging.info("DIR:: {}".format(dir_names[0]))
# ap.pullApp(dir_names[0])
__createFingerprint(dir_name)
def __createFingerprint(dir_name):
try:
cdir = dir_name + os.path.sep + "databases"
files = os.listdir(cdir)
except:
return
db = fingerprint.DBSchema()
for filein in files:
count = 0
retVal = db.scanDBFile(filein)
if (retVal > 0):
cdir = FP_BASE_DIR + os.path.sep + dir_name
if (not mkdir(cdir)):
break
fname = dir_name + "_" + str(count) + ".json"
fh = open(fname, "w")
db.writeFingerprint(fh)
fh.close()
count = count + 1
def mkdir(fdir):
retval = False

View File

@ -35,6 +35,7 @@ class DBSchema:
scanner_ver = "0.90"
format_ver = "0.90"
#
def __init__(self):
self.conn = None
self.cur = None
@ -48,7 +49,7 @@ class DBSchema:
# self.jsonData = None
return
#
def scanDBFile(self, filein):
# try to open sqlite file
try: