mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
First pass at id/path swapping.
This commit is contained in:
parent
1facc62c3e
commit
cbb8cc1a3f
@ -268,6 +268,7 @@ class TskDbDiff(object):
|
||||
class TskDbDiffException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def replace_id(line, table):
|
||||
"""Remove the object id from a line.
|
||||
|
||||
@ -275,15 +276,19 @@ def replace_id(line, table):
|
||||
line: a String, the line to remove the object id from.
|
||||
table: a map from object ids to file paths.
|
||||
"""
|
||||
index = line.find('INSERT INTO "tsk_files"')
|
||||
if (index != -1):
|
||||
files_index = line.find('INSERT INTO "tsk_files"')
|
||||
path_index = line.find('INSERT INTO "tsk_files_path"')
|
||||
# take the portion of the string between the open parenthesis and the comma (ie, the object id)
|
||||
obj_id = line[line.find('(') + 1 : line.find(',')]
|
||||
if files_index != -1:
|
||||
# takes everything from the beginning of the string up to the opening
|
||||
# parenthesis, the path associated with the object id, and everything after
|
||||
# the first comma, and concactenate it
|
||||
newLine = (line[:line.find('('):] + '(' + table[int(obj_id)] + line[line.find(','):])
|
||||
return newLine
|
||||
elif path_index != -1:
|
||||
newLine = (line[:line.find('('):] + '(' + table[int(obj_id)] + line[line.find(','):])
|
||||
return newLine
|
||||
else:
|
||||
return line
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user