diff --git a/dbfp.py b/dbfp.py index 8bb6e3f..9277e54 100644 --- a/dbfp.py +++ b/dbfp.py @@ -4,9 +4,11 @@ import os import argparse import logging +from subprocess import Popen, PIPE, check_call +# our libs from libs import fingerprint from libs import android -from subprocess import Popen, PIPE, check_call +from libs.fingerprint_index import FingerprintIndex BASE_DIR = "data" FP_BASE_DIR = "fingerprints" @@ -20,6 +22,8 @@ def main(): # def compareFingerprintDir(filein, fpdir): db = fingerprint.DBSchema() + fp = FingerprintIndex() + fp.createIndex() # def compareFingerprint(filein, filejson): diff --git a/libs/fingerprint_index.py b/libs/fingerprint_index.py new file mode 100644 index 0000000..63a270a --- /dev/null +++ b/libs/fingerprint_index.py @@ -0,0 +1,50 @@ +# +# +# [ md5_all, md5_list, file_name ] +# +# +import logging +import sqlite3 as sql +from libs import fingerprint + + +class FingerprintIndex: + """ + Create and use an index to + """ + + # + def __init__(self): + return + + def openIndex(self): + pass + + def createIndex(self): + try: + conn = sql.connect('test123.db') + conn.execute(''' + CREATE TABLE md5_index ( + md5_all TEXT PRIMARY KEY, + md5_list TEXT, + file_name TEXT); + ''') + logging.info("Successfully created index table") + except: + logging.error("Error creating index table") + finally: + if conn: + conn.close() + + def checkIntegrity(self): + """ Sanity check the number of files against the index rows """ + pass + + # + def dirCompare(self, folder): + pass + + + def compareFingerprint(self, fp1, fp2): + pass +