From d328d3b01b5ab10c3423cff1f777c52aa245688b Mon Sep 17 00:00:00 2001 From: dhurd Date: Wed, 15 Aug 2012 09:33:37 -0400 Subject: [PATCH 1/2] Saves 'calculate hash without databases' checkbox value in the XML. --- .../autopsy/hashdatabase/HashDbXML.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbXML.java b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbXML.java index 46c1e2163f..8d02966db2 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbXML.java +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbXML.java @@ -66,6 +66,8 @@ public class HashDbXML { private static final String CUR_HASHSETS_FILE_NAME = "hashsets.xml"; private static final String ENCODING = "UTF-8"; private static final String CUR_HASHSET_FILE = AutopsyPropFile.getUserDirPath() + File.separator + CUR_HASHSETS_FILE_NAME; + private static final String SET_CALC = "hash_calculate"; + private static final String SET_VALUE = "value"; private static final Logger logger = Logger.getLogger(HashDbXML.class.getName()); private static HashDbXML currentInstance; @@ -184,6 +186,7 @@ public class HashDbXML { */ public void setCalculate(boolean set) { this.calculate = set; + save(); } /** @@ -252,6 +255,11 @@ public class HashDbXML { } rootEl.appendChild(setEl); } + + String calcValue = Boolean.toString(calculate); + Element setCalc = doc.createElement(SET_CALC); + setCalc.setAttribute(SET_VALUE, calcValue); + rootEl.appendChild(setCalc); success = saveDoc(doc); } catch (ParserConfigurationException e) { @@ -305,6 +313,14 @@ public class HashDbXML { this.nsrlSet = set; } } + + NodeList calcList = root.getElementsByTagName(SET_CALC); + int numCalc = calcList.getLength(); // Shouldn't be more than 1 + for(int i=0; i Date: Wed, 15 Aug 2012 11:34:19 -0400 Subject: [PATCH 2/2] Minor bug fixes and changes. --- Testing/script/regression.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Testing/script/regression.py b/Testing/script/regression.py index 1bda548551..9968bb6eeb 100644 --- a/Testing/script/regression.py +++ b/Testing/script/regression.py @@ -746,15 +746,15 @@ def generate_csv(csv_path): total_ingest_time = case.total_ingest_time service_times = case.service_times exceptions_count = str(len(get_exceptions())) - mem_exceptions_count = str(len(search_common_log("OutOfMemoryException")) + - len(search_common_log("OutOfMemoryError"))) + mem_exceptions_count = str(len(search_logs("OutOfMemoryException")) + + len(search_logs("OutOfMemoryError"))) tsk_objects_count = str(database.autopsy_objects) artifacts_count = str(database.get_artifacts_count()) attributes_count = str(database.autopsy_attributes) - gold_db_name = "standard.db" + gold_db_name = make_local_path("gold", case.image_name, "standard.db") artifact_comparison = database.get_artifact_comparison() attribute_comparison = database.get_attribute_comparison() - gold_report_name = "standard.html" + gold_report_name = make_local_path("gold", case.image_name, "standard.html") report_comparison = str(case.report_passed) ant = case.ant_to_string() @@ -788,17 +788,20 @@ def csv_header(csv_path): csv.write(output) csv.close() -# Returns a list of all the exceptions listed in the common log +# Returns a list of all the exceptions listed in all the case logs def get_exceptions(): exceptions = [] - common_log = open(case.common_log, "r") - lines = common_log.readlines() - ex = re.compile("\SException") - er = re.compile("\SError") - for line in lines: - if ex.search(line) or er.search(line): - exceptions.append(line) - common_log.close() + logs_path = make_local_path(case.output_dir, case.image_name, "logs") + results = [] + for file in os.listdir(logs_path): + log = open(make_path(logs_path, file), "r") + lines = log.readlines() + ex = re.compile("\SException") + er = re.compile("\SError") + for line in lines: + if ex.search(line) or er.search(line): + exceptions.append(line) + log.close() return exceptions # Returns a list of all the warnings listed in the common log @@ -954,9 +957,9 @@ def generate_html(): info += "Exceptions Count:" info += "" + str(len(get_exceptions())) + "" info += "OutOfMemoryExceptions:" - info += "" + str(len(search_common_log("OutOfMemoryException"))) + "" + info += "" + str(len(search_logs("OutOfMemoryException"))) + "" info += "OutOfMemoryErrors:" - info += "" + str(len(search_common_log("OutOfMemoryError"))) + "" + info += "" + str(len(search_logs("OutOfMemoryError"))) + "" info += "TSK Objects Count:" info += "" + str(database.autopsy_objects) + "" info += "Artifacts Count:"