NEW: fingerprint index module, create sqlite database and table
This commit is contained in:
parent
dbfebf636f
commit
2d6ad6ae56
6
dbfp.py
6
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):
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue