NEW: added app name, app version, notes, to the fingerprint metadata to support multiple fingerprint files

This commit is contained in:
JohnE 2015-08-27 19:48:42 -07:00
parent 967a028106
commit 7fa40e6c9c
7 changed files with 103 additions and 2131 deletions

66
dbfp.py
View File

@ -8,27 +8,61 @@ from libs import toolbox
def main(): def main():
(filein, fileout, filejson, verbose) = parseArgs() parseArgs()
# db = fingerprint.DBSchema()
# if (filein and filejson):
# db.scanDBFile(filein)
# db.compareDB(filejson)
# elif (filein):
# retVal = db.scanDBFile(filein)
# if (retVal > 0):
# fh = open(fileout, "w")
# if verbose:
# db.debugFingerprint()
# if title:
# db.setTitle(title)
# if notes:
# db.setNotes(notes)
# db.writeFingerprint(fh)
# fh.close()
# else:
# print db.getErrorString(retVal)
# elif (filejson):
# db.importJson(filejson)
# db.debugFingerprint()
#
def compareFingerprintDir(filein, filejson, fpdir):
db = fingerprint.DBSchema() db = fingerprint.DBSchema()
if (filein and filejson): #
def compareFingerprint(filein, filejson):
db = fingerprint.DBSchema()
db.scanDBFile(filein) db.scanDBFile(filein)
db.compareDB(filejson) db.compareDB(filejson)
elif (filein):
#
def createFingerprint(filein, fileout, verbose, app_name, app_ver, notes):
db = fingerprint.DBSchema()
retVal = db.scanDBFile(filein) retVal = db.scanDBFile(filein)
if (retVal > 0): if (retVal > 0):
fh = open(fileout, "w") fh = open(fileout, "w")
if verbose:
db.debugFingerprint() db.debugFingerprint()
if app_name:
db.setAppName(app_name)
if app_ver:
db.setAppVer(app_ver)
if notes:
db.setNotes(notes)
db.writeFingerprint(fh) db.writeFingerprint(fh)
fh.close() fh.close()
else: else:
print db.getErrorString(retVal) print db.getErrorString(retVal)
elif (filejson):
db.importJson(filejson)
db.debugFingerprint()
#
def parseArgs(): def parseArgs():
print '***** ***** ***** *****' print '***** ***** ***** *****'
print ' DB Fingerprint' print ' DB Fingerprint'
@ -37,19 +71,33 @@ def parseArgs():
timestr = time.strftime('%Y-%m-%d_%H%M%S', time.localtime(time.time())) timestr = time.strftime('%Y-%m-%d_%H%M%S', time.localtime(time.time()))
parser = argparse.ArgumentParser(description='Fingerprint a sqlite database based on its schema') parser = argparse.ArgumentParser(description='Fingerprint a sqlite database based on its schema')
parser.add_argument('-f', '--file', required=False) parser.add_argument('-f', '--file', required=False)
parser.add_argument('-fd', '--fpdir', required=False)
parser.add_argument('-j', '--json', required=False) parser.add_argument('-j', '--json', required=False)
parser.add_argument('-an', '--app_name', required=False)
parser.add_argument('-av', '--app_version', required=False)
parser.add_argument('-n', '--notes', required=False)
parser.add_argument('-v', '--verbose', action='store_true') parser.add_argument('-v', '--verbose', action='store_true')
# parser.add_argument('-t', '--title', required=False)
args = parser.parse_args() args = parser.parse_args()
if (args.file is None) and (args.json is None): if (args.file is None) and (args.json is None):
parser.print_help() parser.print_help()
exit() exit()
if (args.file):
# compare a sqlite database file to all fingerprints
if (args.json and args.fpdir):
compareFingerprints(args.file, args.json, args.fpdir)
# compare a sqlite database file to a fingerprint
if (args.json):
compareFingerprint(args.file, args.json)
# create a fingerprint from the sqlite file
filename = toolbox.ToolBox.parseFilename(args.file) filename = toolbox.ToolBox.parseFilename(args.file)
fileout = filename + "_" + timestr + '.json' fileout = filename + "_" + timestr + '.json'
createFingerprint(args.file, fileout, args.verbose, args.app_name, args.app_version, args.notes)
return (args.file, fileout, args.json, args.verbose) # return (args.file, fileout, args.json, args.verbose, args.title, args.notes,
# args.fpdir)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -42,6 +42,9 @@ class DBSchema:
self.tableNames = [] self.tableNames = []
self.tables = {} self.tables = {}
self.tablesJson = {} self.tablesJson = {}
self.app_name = ""
self.app_ver = ""
self.notes = ""
# self.jsonData = None # self.jsonData = None
return return
@ -68,16 +71,17 @@ class DBSchema:
return 1 return 1
# import fingerprint from a json file
def importJson(self, filejson): def importJson(self, filejson):
self.tablesJson = self.__importJsonDBSchema(filejson) self.tablesJson = self.__importJsonDBSchema(filejson)
#
def compareDB(self, filejson): def compareDB(self, filejson):
self.tablesJson = self.__importJsonDBSchema(filejson) self.tablesJson = self.__importJsonDBSchema(filejson)
result = self.__DBSchemaCompare() result = self.__DBSchemaCompare()
return result return result
# import fingerprint from a json file
def __importJsonDBSchema(self, filejson): def __importJsonDBSchema(self, filejson):
tables = {} tables = {}
try: try:
@ -85,12 +89,12 @@ class DBSchema:
jsonData = json.load(fh) jsonData = json.load(fh)
dbmt = jsonData['db-metadata'] dbmt = jsonData['db-metadata']
tb = jsonData['tables'] tb = jsonData['tables']
keys = tb.keys() all_tables = tb.keys()
for key in keys: for table_name in all_tables:
print "[[ Table <" + key + "> imported ]]" print "[[ Table <" + table_name + "> imported ]]"
newTable = TableDefinition() newTable = TableDefinition()
newTable.importTable(key, dbmt[key], tb[key]) newTable.importTable(table_name, dbmt[table_name], tb[table_name])
tables[key] = newTable tables[table_name] = newTable
except Exception, e: except Exception, e:
print "ERROR: problem loading json file: " + filein print "ERROR: problem loading json file: " + filein
@ -158,7 +162,8 @@ class DBSchema:
cur = conn.cursor() cur = conn.cursor()
return (conn, cur) return (conn, cur)
# read a sqlite database by parsing the create table strings
# sqlmaster = "SELECT name, sql FROM sqlite_master WHERE type='table'"
def __readDatabase(self): def __readDatabase(self):
for row in self.cur.execute(self.sqlmaster): for row in self.cur.execute(self.sqlmaster):
newTable = TableDefinition() newTable = TableDefinition()
@ -190,10 +195,10 @@ class DBSchema:
dmhash = {} dmhash = {}
shash = {} shash = {}
mhash = {} mhash = {}
ahash['tables'] = thash ahash['_file-metadata'] = mhash
ahash['sql-hashes'] = shash
ahash['db-metadata'] = dmhash ahash['db-metadata'] = dmhash
ahash['file-metadata'] = mhash ahash['db-metadata-hashes'] = shash
ahash['tables'] = thash
try: try:
timestr = time.strftime('%Y-%m-%d_%H%M%S', time.localtime(time.time())) timestr = time.strftime('%Y-%m-%d_%H%M%S', time.localtime(time.time()))
@ -205,6 +210,9 @@ class DBSchema:
mhash['scanner-ver'] = self.scanner_ver mhash['scanner-ver'] = self.scanner_ver
mhash['scanner-name'] = 'dbfp' mhash['scanner-name'] = 'dbfp'
mhash['dn-name'] = self.dbName mhash['dn-name'] = self.dbName
mhash['app-name'] = self.app_name
mhash['app-ver'] = self.app_ver
mhash['notes'] = self.notes
# tables # tables
tables = self.tables.keys() tables = self.tables.keys()
@ -215,7 +223,19 @@ class DBSchema:
json.dump(ahash, filehandle, sort_keys=True, indent=4) json.dump(ahash, filehandle, sort_keys=True, indent=4)
#
def setAppName(self, name):
self.app_name = name
#
def setAppVer(self, version):
self.app_ver = version
#
def setNotes(self, notes):
self.notes = notes
#
def getErrorString(self, errorCode): def getErrorString(self, errorCode):
retval = "ERROR: unknown error code: " + str(errorCode) retval = "ERROR: unknown error code: " + str(errorCode)
if (errorCode == -2): if (errorCode == -2):
@ -247,6 +267,7 @@ class TableDefinition:
self.tableName = tableName self.tableName = tableName
self.sqlStr = sqlStr self.sqlStr = sqlStr
print "[[ TABLE: <{}> ] loading]".format(tableName)
# hash the sql create string for quicker fingerprint matching # hash the sql create string for quicker fingerprint matching
try: try:
m = hashlib.md5() m = hashlib.md5()
@ -262,10 +283,10 @@ class TableDefinition:
for col in columns: for col in columns:
newField = self.__parseCreateStr(col.strip()) newField = self.__parseCreateStr(col.strip())
if newField: if newField:
print "[[ TABLE: <{}> ] imported]".format(tableName)
self.fields[newField['name']] = newField self.fields[newField['name']] = newField
del newField['name']
else: else:
print "[[ TABLE: <{}> ] failed]".format(tableName) print "WARN: <{}> ] failed to parse]".format(tableName)
# #
def importTable(self, tbName, sqlStr, fields): def importTable(self, tbName, sqlStr, fields):

File diff suppressed because it is too large Load Diff

View File

@ -1,209 +0,0 @@
{
"db-config": {
"dn-name": "test-data/profilecache.db"
},
"db-metadata": {
"profiles": "CREATE TABLE `profiles` (`key` TEXT PRIMARY KEY, `value` TEXT)",
"profiletable": "CREATE TABLE `profiletable` (`itemUserId` TEXT PRIMARY KEY, `itemFirstName` TEXT NOT NULL, `itemLastName` TEXT NOT NULL, `itemBirthday` TEXT NOT NULL, `itemGender` TEXT NOT NULL, `itemStatus` TEXT NOT NULL, `itemLongitude` DOUBLE NOT NULL, `itemLatitude` DOUBLE NOT NULL, `itemDistance` DOUBLE NOT NULL, `itemAvatarUrl` TEXT NOT NULL, `itemThumbnailUrl` TEXT NOT NULL, `itemVideoUrl` TEXT NOT NULL, `itemVideoThumbnailUrl` TEXT NOT NULL, `itemBackgroundUrl` TEXT NOT NULL, `itemPrivacy` INTEGER NOT NULL, `itemIsLocationOn` INTEGER NOT NULL, `itemIsFriend` INTEGER NOT NULL, `itemIsBlocked` INTEGER NOT NULL, `itemFriendRequestType` TEXT NOT NULL, `itemReverseRelationships` TEXT NOT NULL, `itemFeedCount` INTEGER NOT NULL, `itemRefereneCount` INTEGER NOT NULL, `itemLevel1DataSyncTime` BIGINT NOT NULL, `itemLevel2DataSyncTime` BIGINT NOT NULL, `itemLevel3DataSyncTime` BIGINT NOT NULL, `itemLevel4DataSyncTime` BIGINT NOT NULL, `itemLevel5DataSyncTime` BIGINT NOT NULL, `itemLastLocalAccessTime` BIGINT NOT NULL, `itemLastServerModifyTime` BIGINT NOT NULL, `itemLastLocationServerModifyTime` BIGINT NOT NULL, `itemLastStatusServerModifyTime` BIGINT NOT NULL, `itemFriendRequestId` TEXT NOT NULL, `itemFriendRequestMessage` TEXT NOT NULL, `itemFriendRequestTime` BIGINT NOT NULL, `itemIsNewFriendRequest` INTEGER NOT NULL, `itemFriendRequestTCMessageId` INTEGER NOT NULL)"
},
"file-metadata": {
"format-ver": "0.90",
"scanner-name": "dbfp",
"scanner-ver": "0.50"
},
"tables": {
"profiles": {
"key": {
"datatype": "TEXT",
"name": "key",
"primarykey": true
},
"value": {
"datatype": "TEXT",
"name": "value"
}
},
"profiletable": {
"itemAvatarUrl": {
"datatype": "TEXT",
"name": "itemAvatarUrl",
"notnull": true
},
"itemBackgroundUrl": {
"datatype": "TEXT",
"name": "itemBackgroundUrl",
"notnull": true
},
"itemBirthday": {
"datatype": "TEXT",
"name": "itemBirthday",
"notnull": true
},
"itemDistance": {
"datatype": "DOUBLE",
"name": "itemDistance",
"notnull": true
},
"itemFeedCount": {
"datatype": "INTEGER",
"name": "itemFeedCount",
"notnull": true
},
"itemFirstName": {
"datatype": "TEXT",
"name": "itemFirstName",
"notnull": true
},
"itemFriendRequestId": {
"datatype": "TEXT",
"name": "itemFriendRequestId",
"notnull": true
},
"itemFriendRequestMessage": {
"datatype": "TEXT",
"name": "itemFriendRequestMessage",
"notnull": true
},
"itemFriendRequestTCMessageId": {
"datatype": "INTEGER",
"name": "itemFriendRequestTCMessageId",
"notnull": true
},
"itemFriendRequestTime": {
"datatype": "BIGINT",
"name": "itemFriendRequestTime",
"notnull": true
},
"itemFriendRequestType": {
"datatype": "TEXT",
"name": "itemFriendRequestType",
"notnull": true
},
"itemGender": {
"datatype": "TEXT",
"name": "itemGender",
"notnull": true
},
"itemIsBlocked": {
"datatype": "INTEGER",
"name": "itemIsBlocked",
"notnull": true
},
"itemIsFriend": {
"datatype": "INTEGER",
"name": "itemIsFriend",
"notnull": true
},
"itemIsLocationOn": {
"datatype": "INTEGER",
"name": "itemIsLocationOn",
"notnull": true
},
"itemIsNewFriendRequest": {
"datatype": "INTEGER",
"name": "itemIsNewFriendRequest",
"notnull": true
},
"itemLastLocalAccessTime": {
"datatype": "BIGINT",
"name": "itemLastLocalAccessTime",
"notnull": true
},
"itemLastLocationServerModifyTime": {
"datatype": "BIGINT",
"name": "itemLastLocationServerModifyTime",
"notnull": true
},
"itemLastName": {
"datatype": "TEXT",
"name": "itemLastName",
"notnull": true
},
"itemLastServerModifyTime": {
"datatype": "BIGINT",
"name": "itemLastServerModifyTime",
"notnull": true
},
"itemLastStatusServerModifyTime": {
"datatype": "BIGINT",
"name": "itemLastStatusServerModifyTime",
"notnull": true
},
"itemLatitude": {
"datatype": "DOUBLE",
"name": "itemLatitude",
"notnull": true
},
"itemLevel1DataSyncTime": {
"datatype": "BIGINT",
"name": "itemLevel1DataSyncTime",
"notnull": true
},
"itemLevel2DataSyncTime": {
"datatype": "BIGINT",
"name": "itemLevel2DataSyncTime",
"notnull": true
},
"itemLevel3DataSyncTime": {
"datatype": "BIGINT",
"name": "itemLevel3DataSyncTime",
"notnull": true
},
"itemLevel4DataSyncTime": {
"datatype": "BIGINT",
"name": "itemLevel4DataSyncTime",
"notnull": true
},
"itemLevel5DataSyncTime": {
"datatype": "BIGINT",
"name": "itemLevel5DataSyncTime",
"notnull": true
},
"itemLongitude": {
"datatype": "DOUBLE",
"name": "itemLongitude",
"notnull": true
},
"itemPrivacy": {
"datatype": "INTEGER",
"name": "itemPrivacy",
"notnull": true
},
"itemRefereneCount": {
"datatype": "INTEGER",
"name": "itemRefereneCount",
"notnull": true
},
"itemReverseRelationships": {
"datatype": "TEXT",
"name": "itemReverseRelationships",
"notnull": true
},
"itemStatus": {
"datatype": "TEXT",
"name": "itemStatus",
"notnull": true
},
"itemThumbnailUrl": {
"datatype": "TEXT",
"name": "itemThumbnailUrl",
"notnull": true
},
"itemUserId": {
"datatype": "TEXT",
"name": "itemUserId",
"primarykey": true
},
"itemVideoThumbnailUrl": {
"datatype": "TEXT",
"name": "itemVideoThumbnailUrl",
"notnull": true
},
"itemVideoUrl": {
"datatype": "TEXT",
"name": "itemVideoUrl",
"notnull": true
}
}
}
}

View File

@ -1,164 +0,0 @@
{
"db-config": {
"dn-name": "test-data/tc.db"
},
"db-metadata": {
"conversations": "CREATE TABLE `conversations` (`conv_id` TEXT PRIMARY KEY, `payload` BLOB, `last_msg_id` INTEGER, `unread_count` INTEGER, `last_read_sent_msg_id` INTEGER, `conv_type` INTEGER DEFAULT 0, `conv_del_status` INTEGER DEFAULT 0, `deleting_ts` BIGINT DEFAULT 0)",
"messages": "CREATE TABLE `messages` (`msg_id` INTEGER PRIMARY KEY, `conv_id` TEXT, `type` INTEGER, `media_id` TEXT, `share_id` TEXT, `create_time` BIGINT, `send_time` BIGINT, `direction` INTEGER, `status` INTEGER, `payload` BLOB, `del_status` INTEGER)",
"profiles": "CREATE TABLE `profiles` (`key` TEXT PRIMARY KEY, `value` TEXT)",
"receipts": "CREATE TABLE `receipts` (`conv_id` TEXT PRIMARY KEY, `msg_id` INTEGER, `sender_msg_id` INTEGER, `type` INTEGER, `create_time` BIGINT, `status` INTEGER, `payload` BLOB)",
"sms": "CREATE TABLE `sms` (`msg_id` INTEGER PRIMARY KEY, `phonenumber` TEXT, `text` TEXT)"
},
"file-metadata": {
"format-ver": "0.90",
"scanner-name": "dbfp",
"scanner-ver": "0.50"
},
"tables": {
"conversations": {
"conv_del_status": {
"datatype": "INTEGER",
"default": "0",
"name": "conv_del_status",
"notnull": true
},
"conv_id": {
"datatype": "TEXT",
"name": "conv_id",
"primarykey": true
},
"conv_type": {
"datatype": "INTEGER",
"default": "0",
"name": "conv_type",
"notnull": true
},
"deleting_ts": {
"datatype": "BIGINT",
"default": "0",
"name": "deleting_ts",
"notnull": true
},
"last_msg_id": {
"datatype": "INTEGER",
"name": "last_msg_id"
},
"last_read_sent_msg_id": {
"datatype": "INTEGER",
"name": "last_read_sent_msg_id"
},
"payload": {
"datatype": "BLOB",
"name": "payload"
},
"unread_count": {
"datatype": "INTEGER",
"name": "unread_count"
}
},
"messages": {
"conv_id": {
"datatype": "TEXT",
"name": "conv_id"
},
"create_time": {
"datatype": "BIGINT",
"name": "create_time"
},
"del_status": {
"datatype": "INTEGER",
"name": "del_status"
},
"direction": {
"datatype": "INTEGER",
"name": "direction"
},
"media_id": {
"datatype": "TEXT",
"name": "media_id"
},
"msg_id": {
"datatype": "INTEGER",
"name": "msg_id",
"primarykey": true
},
"payload": {
"datatype": "BLOB",
"name": "payload"
},
"send_time": {
"datatype": "BIGINT",
"name": "send_time"
},
"share_id": {
"datatype": "TEXT",
"name": "share_id"
},
"status": {
"datatype": "INTEGER",
"name": "status"
},
"type": {
"datatype": "INTEGER",
"name": "type"
}
},
"profiles": {
"key": {
"datatype": "TEXT",
"name": "key",
"primarykey": true
},
"value": {
"datatype": "TEXT",
"name": "value"
}
},
"receipts": {
"conv_id": {
"datatype": "TEXT",
"name": "conv_id",
"primarykey": true
},
"create_time": {
"datatype": "BIGINT",
"name": "create_time"
},
"msg_id": {
"datatype": "INTEGER",
"name": "msg_id"
},
"payload": {
"datatype": "BLOB",
"name": "payload"
},
"sender_msg_id": {
"datatype": "INTEGER",
"name": "sender_msg_id"
},
"status": {
"datatype": "INTEGER",
"name": "status"
},
"type": {
"datatype": "INTEGER",
"name": "type"
}
},
"sms": {
"msg_id": {
"datatype": "INTEGER",
"name": "msg_id",
"primarykey": true
},
"phonenumber": {
"datatype": "TEXT",
"name": "phonenumber"
},
"text": {
"datatype": "TEXT",
"name": "text"
}
}
}
}

View File

@ -1,171 +0,0 @@
{
"db-metadata": {
"conversations": "CREATE TABLE `conversations` (`conv_id` TEXT PRIMARY KEY, `payload` BLOB, `last_msg_id` INTEGER, `unread_count` INTEGER, `last_read_sent_msg_id` INTEGER, `conv_type` INTEGER DEFAULT 0, `conv_del_status` INTEGER DEFAULT 0, `deleting_ts` BIGINT DEFAULT 0)",
"messages": "CREATE TABLE `messages` (`msg_id` INTEGER PRIMARY KEY, `conv_id` TEXT, `type` INTEGER, `media_id` TEXT, `share_id` TEXT, `create_time` BIGINT, `send_time` BIGINT, `direction` INTEGER, `status` INTEGER, `payload` BLOB, `del_status` INTEGER)",
"profiles": "CREATE TABLE `profiles` (`key` TEXT PRIMARY KEY, `value` TEXT)",
"receipts": "CREATE TABLE `receipts` (`conv_id` TEXT PRIMARY KEY, `msg_id` INTEGER, `sender_msg_id` INTEGER, `type` INTEGER, `create_time` BIGINT, `status` INTEGER, `payload` BLOB)",
"sms": "CREATE TABLE `sms` (`msg_id` INTEGER PRIMARY KEY, `phonenumber` TEXT, `text` TEXT)"
},
"file-metadata": {
"dn-name": "test-data/tc.db",
"scan-date": "2015-08-06_105953",
"format-ver": "0.90",
"scanner-name": "dbfp",
"scanner-ver": "0.50"
},
"fingerprint-hashes": {
"--file--hash--": "2fb4d49311b816b07863a67fbcc96557",
"conversations": "d6b2bbcc608a312dc76612d33332bfb5",
"messages": "d6e27f167c6e5f5f00ac97a676628cda",
"profiles": "6b4029da986d475d72cd2fe805531814",
"receipts": "494a13c1ddb965d16c225f64b77f5f27",
"sms": "9a6169c8979ea50d8fd024c6df169e0e"
},
"tables": {
"conversations": {
"conv_del_status": {
"datatype": "INTEGER",
"default": "0",
"name": "conv_del_status",
"notnull": true
},
"conv_id": {
"datatype": "TEXT",
"name": "conv_id",
"primarykey": true
},
"conv_type": {
"datatype": "INTEGER",
"default": "0",
"name": "conv_type",
"notnull": true
},
"deleting_ts": {
"datatype": "BIGINT",
"default": "0",
"name": "deleting_ts",
"notnull": true
},
"last_msg_id": {
"datatype": "INTEGER",
"name": "last_msg_id"
},
"last_read_sent_msg_id": {
"datatype": "INTEGER",
"name": "last_read_sent_msg_id"
},
"payload": {
"datatype": "BLOB",
"name": "payload"
},
"unread_count": {
"datatype": "INTEGER",
"name": "unread_count"
}
},
"messages": {
"conv_id": {
"datatype": "TEXT",
"name": "conv_id"
},
"create_time": {
"datatype": "BIGINT",
"name": "create_time"
},
"del_status": {
"datatype": "INTEGER",
"name": "del_status"
},
"direction": {
"datatype": "INTEGER",
"name": "direction"
},
"media_id": {
"datatype": "TEXT",
"name": "media_id"
},
"msg_id": {
"datatype": "INTEGER",
"name": "msg_id",
"primarykey": true
},
"payload": {
"datatype": "BLOB",
"name": "payload"
},
"send_time": {
"datatype": "BIGINT",
"name": "send_time"
},
"share_id": {
"datatype": "TEXT",
"name": "share_id"
},
"status": {
"datatype": "INTEGER",
"name": "status"
},
"type": {
"datatype": "INTEGER",
"name": "type"
}
},
"profiles": {
"key": {
"datatype": "TEXT",
"name": "key",
"primarykey": true
},
"value": {
"datatype": "TEXT",
"name": "value"
}
},
"receipts": {
"conv_id": {
"datatype": "TEXT",
"name": "conv_id",
"primarykey": true
},
"create_time": {
"datatype": "BIGINT",
"name": "create_time"
},
"msg_id": {
"datatype": "INTEGER",
"name": "msg_id"
},
"payload": {
"datatype": "BLOB",
"name": "payload"
},
"sender_msg_id": {
"datatype": "INTEGER",
"name": "sender_msg_id"
},
"status": {
"datatype": "INTEGER",
"name": "status"
},
"type": {
"datatype": "INTEGER",
"name": "type"
}
},
"sms": {
"msg_id": {
"datatype": "INTEGER",
"name": "msg_id",
"primarykey": true
},
"phonenumber": {
"datatype": "TEXT",
"name": "phonenumber"
},
"text": {
"datatype": "TEXT",
"name": "text"
}
}
}
}

View File

@ -1,345 +0,0 @@
{
"db-config": {
"dn-name": "test-data/test1.db"
},
"db-metadata": {
"chat_settings": "CREATE TABLE chat_settings(uid INTEGER PRIMARY KEY, participants BLOB)",
"chats": "CREATE TABLE chats(uid INTEGER PRIMARY KEY, name TEXT, data BLOB)",
"contacts": "CREATE TABLE contacts(uid INTEGER PRIMARY KEY, mutual INTEGER)",
"dialogs": "CREATE TABLE dialogs(did INTEGER PRIMARY KEY, date INTEGER, unread_count INTEGER, last_mid INTEGER)",
"enc_chats": "CREATE TABLE enc_chats(uid INTEGER PRIMARY KEY, user INTEGER, name TEXT, data BLOB, g BLOB, authkey BLOB, ttl INTEGER)",
"enc_tasks": "CREATE TABLE enc_tasks(date INTEGER, data BLOB)",
"media": "CREATE TABLE media(mid INTEGER PRIMARY KEY, uid INTEGER, date INTEGER, data BLOB)",
"media_counts": "CREATE TABLE media_counts(uid INTEGER PRIMARY KEY, count INTEGER)",
"messages": "CREATE TABLE messages(mid INTEGER PRIMARY KEY, uid INTEGER, read_state INTEGER, send_state INTEGER, date INTEGER, data BLOB, out INTEGER, ttl INTEGER)",
"params": "CREATE TABLE params(id INTEGER PRIMARY KEY, seq INTEGER, pts INTEGER, date INTEGER, qts INTEGER, lsv INTEGER, sg INTEGER, pbytes BLOB)",
"pending_read": "CREATE TABLE pending_read(uid INTEGER PRIMARY KEY, max_id INTEGER)",
"randoms": "CREATE TABLE randoms(random_id INTEGER PRIMARY KEY, mid INTEGER)",
"sent_files_v2": "CREATE TABLE sent_files_v2(uid TEXT, type INTEGER, data BLOB, PRIMARY KEY (uid, type))",
"user_contacts_v6": "CREATE TABLE user_contacts_v6(uid INTEGER PRIMARY KEY, fname TEXT, sname TEXT)",
"user_phones_v6": "CREATE TABLE user_phones_v6(uid INTEGER, phone TEXT, sphone TEXT, deleted INTEGER, PRIMARY KEY (uid, phone))",
"user_photos": "CREATE TABLE user_photos(uid INTEGER, id INTEGER, data BLOB, PRIMARY KEY (uid, id))",
"users": "CREATE TABLE users(uid INTEGER PRIMARY KEY, name TEXT, status INTEGER, data BLOB)",
"wallpapers": "CREATE TABLE wallpapers(uid INTEGER PRIMARY KEY, data BLOB)"
},
"file-metadata": {
"format-ver": "0.90",
"scanner-name": "dbfp",
"scanner-ver": "0.50"
},
"tables": {
"chat_settings": {
"participants": {
"datatype": "BLOB",
"name": "participants"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"chats": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"name": {
"datatype": "TEXT",
"name": "name"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"contacts": {
"mutual": {
"datatype": "INTEGER",
"name": "mutual"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"dialogs": {
"date": {
"datatype": "INTEGER",
"name": "date"
},
"did": {
"datatype": "INTEGER",
"name": "did",
"primarykey": true
},
"last_mid": {
"datatype": "INTEGER",
"name": "last_mid"
},
"unread_count": {
"datatype": "INTEGER",
"name": "unread_count"
}
},
"enc_chats": {
"authkey": {
"datatype": "BLOB",
"name": "authkey"
},
"data": {
"datatype": "BLOB",
"name": "data"
},
"g": {
"datatype": "BLOB",
"name": "g"
},
"name": {
"datatype": "TEXT",
"name": "name"
},
"ttl": {
"datatype": "INTEGER",
"name": "ttl"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
},
"user": {
"datatype": "INTEGER",
"name": "user"
}
},
"enc_tasks": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"date": {
"datatype": "INTEGER",
"name": "date"
}
},
"media": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"date": {
"datatype": "INTEGER",
"name": "date"
},
"mid": {
"datatype": "INTEGER",
"name": "mid",
"primarykey": true
},
"uid": {
"datatype": "INTEGER",
"name": "uid"
}
},
"media_counts": {
"count": {
"datatype": "INTEGER",
"name": "count"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"messages": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"date": {
"datatype": "INTEGER",
"name": "date"
},
"mid": {
"datatype": "INTEGER",
"name": "mid",
"primarykey": true
},
"out": {
"datatype": "INTEGER",
"name": "out"
},
"read_state": {
"datatype": "INTEGER",
"name": "read_state"
},
"send_state": {
"datatype": "INTEGER",
"name": "send_state"
},
"ttl": {
"datatype": "INTEGER",
"name": "ttl"
},
"uid": {
"datatype": "INTEGER",
"name": "uid"
}
},
"params": {
"date": {
"datatype": "INTEGER",
"name": "date"
},
"id": {
"datatype": "INTEGER",
"name": "id",
"primarykey": true
},
"lsv": {
"datatype": "INTEGER",
"name": "lsv"
},
"pbytes": {
"datatype": "BLOB",
"name": "pbytes"
},
"pts": {
"datatype": "INTEGER",
"name": "pts"
},
"qts": {
"datatype": "INTEGER",
"name": "qts"
},
"seq": {
"datatype": "INTEGER",
"name": "seq"
},
"sg": {
"datatype": "INTEGER",
"name": "sg"
}
},
"pending_read": {
"max_id": {
"datatype": "INTEGER",
"name": "max_id"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"randoms": {
"mid": {
"datatype": "INTEGER",
"name": "mid"
},
"random_id": {
"datatype": "INTEGER",
"name": "random_id",
"primarykey": true
}
},
"sent_files_v2": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"type": {
"datatype": "INTEGER",
"name": "type"
},
"uid": {
"datatype": "TEXT",
"name": "uid",
"primarykey": true
}
},
"user_contacts_v6": {
"fname": {
"datatype": "TEXT",
"name": "fname"
},
"sname": {
"datatype": "TEXT",
"name": "sname"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"user_phones_v6": {
"deleted": {
"datatype": "INTEGER",
"name": "deleted"
},
"phone": {
"datatype": "TEXT",
"name": "phone"
},
"sphone": {
"datatype": "TEXT",
"name": "sphone"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"user_photos": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"id": {
"datatype": "INTEGER",
"name": "id"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"users": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"name": {
"datatype": "TEXT",
"name": "name"
},
"status": {
"datatype": "INTEGER",
"name": "status"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
},
"wallpapers": {
"data": {
"datatype": "BLOB",
"name": "data"
},
"uid": {
"datatype": "INTEGER",
"name": "uid",
"primarykey": true
}
}
}
}