mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
fixed regression.py
This commit is contained in:
parent
acbda72e4a
commit
7e47af8b00
@ -160,7 +160,7 @@ class TestAutopsy:
|
|||||||
# Paths:
|
# Paths:
|
||||||
self.input_dir = Emailer.make_local_path("..","input")
|
self.input_dir = Emailer.make_local_path("..","input")
|
||||||
self.output_dir = ""
|
self.output_dir = ""
|
||||||
self.gold = Emailer.make_local_path("..", "output", "gold", "tmp")
|
self.gold = Emailer.make_path("..", "output", "gold", "tmp")
|
||||||
# Logs:
|
# Logs:
|
||||||
self.antlog_dir = ""
|
self.antlog_dir = ""
|
||||||
self.common_log = ""
|
self.common_log = ""
|
||||||
@ -328,11 +328,12 @@ class Database:
|
|||||||
for type_id in range(1, length):
|
for type_id in range(1, length):
|
||||||
autopsy_cur.execute("SELECT COUNT(*) FROM blackboard_artifacts WHERE artifact_type_id=%d" % type_id)
|
autopsy_cur.execute("SELECT COUNT(*) FROM blackboard_artifacts WHERE artifact_type_id=%d" % type_id)
|
||||||
self.autopsy_artifacts.append(autopsy_cur.fetchone()[0])
|
self.autopsy_artifacts.append(autopsy_cur.fetchone()[0])
|
||||||
autopsy_cur.execute("SELECT * FROM blackboard_artifacts")
|
autopsy_cur.execute("SELECT blackboard_artifact_types.display_name FROM blackboard_artifact_types INNER JOIN blackboard_artifacts ON blackboard_artifact_types.artifact_type_id = blackboard_artifacts.artifact_type_id INNER JOIN tsk_objects ON tsk_objects.obj_id = blackboard_artifacts.obj_id INNER JOIN blackboard_attributes ON blackboard_attributes.artifact_id = blackboard_artifacts.artifact_id")
|
||||||
self.autopsy_artifacts_list = []
|
self.autopsy_artifacts_list = []
|
||||||
for row in autopsy_cur.fetchall():
|
for row in autopsy_cur.fetchall():
|
||||||
for item in row:
|
for item in row:
|
||||||
self.autopsy_artifacts_list.append(item)
|
self.autopsy_artifacts_list.append(item)
|
||||||
|
print(self.autopsy_artifacts_list)
|
||||||
|
|
||||||
|
|
||||||
def generate_autopsy_attributes(self):
|
def generate_autopsy_attributes(self):
|
||||||
@ -681,8 +682,9 @@ def rebuild():
|
|||||||
oldcwd = os.getcwd()
|
oldcwd = os.getcwd()
|
||||||
zpdir = case.gold_parse
|
zpdir = case.gold_parse
|
||||||
os.chdir(zpdir)
|
os.chdir(zpdir)
|
||||||
img_gold = case.image_name
|
os.chdir("..")
|
||||||
img_archive = Emailer.make_path("..", case.image_name+"-archive.zip")
|
img_gold = "tmp"
|
||||||
|
img_archive = Emailer.make_path(case.image_name+"-archive.zip")
|
||||||
comprssr = zipfile.ZipFile(img_archive, 'w',compression=zipfile.ZIP_DEFLATED)
|
comprssr = zipfile.ZipFile(img_archive, 'w',compression=zipfile.ZIP_DEFLATED)
|
||||||
zipdir(img_gold, comprssr)
|
zipdir(img_gold, comprssr)
|
||||||
comprssr.close()
|
comprssr.close()
|
||||||
@ -744,7 +746,7 @@ def compare_to_gold_db():
|
|||||||
# Testing tsk_objects
|
# Testing tsk_objects
|
||||||
exceptions.append(compare_tsk_objects())
|
exceptions.append(compare_tsk_objects())
|
||||||
# Testing blackboard_artifacts
|
# Testing blackboard_artifacts
|
||||||
exceptions.append(compare_bb_artifacts())
|
exceptions.append(count_bb_artifacts())
|
||||||
# Testing blackboard_attributes
|
# Testing blackboard_attributes
|
||||||
exceptions.append(compare_bb_attributes())
|
exceptions.append(compare_bb_attributes())
|
||||||
|
|
||||||
@ -823,9 +825,12 @@ def compare_to_gold_html():
|
|||||||
printerror(str(e) + "\n")
|
printerror(str(e) + "\n")
|
||||||
logging.critical(traceback.format_exc())
|
logging.critical(traceback.format_exc())
|
||||||
|
|
||||||
|
def compare_bb_artifacts():
|
||||||
|
count_bb_artifacts()
|
||||||
|
|
||||||
# Compares the blackboard artifact counts of two databases
|
# Compares the blackboard artifact counts of two databases
|
||||||
# given the two database cursors
|
# given the two database cursors
|
||||||
def compare_bb_artifacts():
|
def count_bb_artifacts():
|
||||||
exceptions = []
|
exceptions = []
|
||||||
try:
|
try:
|
||||||
global failedbool
|
global failedbool
|
||||||
@ -835,7 +840,8 @@ def compare_bb_artifacts():
|
|||||||
global imgfail
|
global imgfail
|
||||||
imgfail = True
|
imgfail = True
|
||||||
errorem += "There was a difference in the number of artifacts for " + case.image + ".\n"
|
errorem += "There was a difference in the number of artifacts for " + case.image + ".\n"
|
||||||
for type_id in range(1, 13):
|
rner = database.gold_artifacts.length
|
||||||
|
for type_id in range(1, rner):
|
||||||
if database.gold_artifacts[type_id] != database.autopsy_artifacts[type_id]:
|
if database.gold_artifacts[type_id] != database.autopsy_artifacts[type_id]:
|
||||||
error = str("Artifact counts do not match for type id %d. " % type_id)
|
error = str("Artifact counts do not match for type id %d. " % type_id)
|
||||||
error += str("Gold: %d, Test: %d" %
|
error += str("Gold: %d, Test: %d" %
|
||||||
|
Loading…
x
Reference in New Issue
Block a user