This commit is contained in:
adam-m 2012-08-15 12:59:05 -04:00
commit db48eb3f7b
2 changed files with 34 additions and 15 deletions

View File

@ -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<numCalc; i++) {
Element calcEl = (Element) calcList.item(i);
final String value = calcEl.getAttribute(SET_VALUE);
calculate = Boolean.parseBoolean(value);
}
return true;
}

View File

@ -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 += "<tr><td>Exceptions Count:</td>"
info += "<td>" + str(len(get_exceptions())) + "</td></tr>"
info += "<tr><td>OutOfMemoryExceptions:</td>"
info += "<td>" + str(len(search_common_log("OutOfMemoryException"))) + "</td></tr>"
info += "<td>" + str(len(search_logs("OutOfMemoryException"))) + "</td></tr>"
info += "<tr><td>OutOfMemoryErrors:</td>"
info += "<td>" + str(len(search_common_log("OutOfMemoryError"))) + "</td></tr>"
info += "<td>" + str(len(search_logs("OutOfMemoryError"))) + "</td></tr>"
info += "<tr><td>TSK Objects Count:</td>"
info += "<td>" + str(database.autopsy_objects) + "</td></tr>"
info += "<tr><td>Artifacts Count:</td>"