diff --git a/Core/src/org/sleuthkit/autopsy/report/Report.java b/Core/src/org/sleuthkit/autopsy/report/Report.java index c60e8f4b35..56bf70d1f3 100644 --- a/Core/src/org/sleuthkit/autopsy/report/Report.java +++ b/Core/src/org/sleuthkit/autopsy/report/Report.java @@ -38,6 +38,7 @@ import java.text.SimpleDateFormat; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.openide.util.Exceptions; +import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskCoreException; public class Report { @@ -67,12 +68,12 @@ public class Report { tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_list;"); tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_name;"); tempdbconnect.executeStmt("DROP TABLE IF EXISTS report;"); - String temp1 = "CREATE TABLE report_keyword AS SELECT value_text as keyword,blackboard_attributes.attribute_type_id, blackboard_attributes.artifact_id FROM blackboard_attributes WHERE attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID() + ";"; + String temp1 = "CREATE TABLE report_keyword AS SELECT value_text as keyword, blackboard_attributes.attribute_type_id, blackboard_attributes.artifact_id FROM blackboard_attributes WHERE attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID() + ";"; String temp2 = "CREATE TABLE report_preview AS SELECT value_text as preview, blackboard_attributes.attribute_type_id, blackboard_attributes.artifact_id FROM blackboard_attributes WHERE attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID() + ";"; String temp3 = "CREATE TABLE report_exp AS SELECT value_text as exp, blackboard_attributes.attribute_type_id, blackboard_attributes.artifact_id FROM blackboard_attributes WHERE attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID() + ";"; String temp4 = "CREATE TABLE report_list AS SELECT value_text as list, blackboard_attributes.attribute_type_id, blackboard_attributes.artifact_id FROM blackboard_attributes WHERE attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + ";"; - String temp5 = "CREATE TABLE report_name AS SELECT name, report_keyword.artifact_id from tsk_files,blackboard_artifacts, report_keyword WHERE blackboard_artifacts.artifact_id = report_keyword.artifact_id AND blackboard_artifacts.obj_id = tsk_files.obj_id;"; - String temp6 = "CREATE TABLE report AS SELECT keyword,preview,exp,list,name from report_keyword " + String temp5 = "CREATE TABLE report_name AS SELECT name, report_keyword.artifact_id, tsk_files.obj_id as obj_id from tsk_files, blackboard_artifacts, report_keyword WHERE blackboard_artifacts.artifact_id = report_keyword.artifact_id AND blackboard_artifacts.obj_id = tsk_files.obj_id;"; + String temp6 = "CREATE TABLE report AS SELECT keyword, preview, exp, list, name, obj_id from report_keyword " + "LEFT JOIN report_preview ON report_keyword.artifact_id=report_preview.artifact_id " + "LEFT JOIN report_exp ON report_keyword.artifact_id=report_exp.artifact_id " + "LEFT JOIN report_list ON report_keyword.artifact_id=report_list.artifact_id " @@ -83,20 +84,27 @@ public class Report { tempdbconnect.executeStmt(temp4); tempdbconnect.executeStmt(temp5); tempdbconnect.executeStmt(temp6); - ResultSet uniqueresults = tempdbconnect.executeQry("SELECT keyword, exp, preview, list, name FROM report ORDER BY keyword ASC"); + ResultSet uniqueresults = tempdbconnect.executeQry("SELECT keyword, exp, preview, list, name, obj_id FROM report ORDER BY keyword ASC"); String keyword = ""; while (uniqueresults.next()) { + Long objId = uniqueresults.getLong("obj_id"); + AbstractFile file = null; + try { + file = tempDb.getAbstractFileById(objId); + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Could not get AbstractFile from TSK ", ex); + } StringBuilder table = new StringBuilder(); if (uniqueresults.getString("keyword") == null ? keyword == null : uniqueresults.getString("keyword").equals(keyword)) { } else { table.append("

\n"); keyword = uniqueresults.getString("keyword"); table.append("").append(keyword).append("\n"); - table.append("\n"); + table.append("
").append("File Name").append("PreviewKeyword List
\n"); } table.append("\n"); String previewreplace = StringEscapeUtils.escapeHtml(uniqueresults.getString("preview")); - table.append("").append("\n"); + table.append("").append("").append("\n"); out.write(table.toString()); } tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_keyword;"); diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java index 4e868a6158..cd3f726fba 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -328,7 +328,7 @@ public class ReportHTML implements ReportModule { nav.append("
  • Web History (").append(countHistory).append(")
  • \n"); } if(countDownloads > 0) { - nav.append("
  • Downloads (").append(countDownloads).append(")
  • \n"); + nav.append("
  • Web Downloads (").append(countDownloads).append(")
  • \n"); } if(countRecent > 0) { nav.append("
  • Recent Documents (").append(countRecent).append(")
  • \n"); @@ -448,13 +448,9 @@ public class ReportHTML implements ReportModule { */ private TreeMap getAttributes(List attList) { TreeMap attributes = new TreeMap(); - try { - int size = skCase.getBlackboardAttributeTypes().size(); - for (int n = 0; n <= size; n++) { - attributes.put(n, ""); - } - } catch(TskCoreException ex) { - logger.log(Level.WARNING, "Failed to fill in blank attributes with spaces, they will be shown as null."); + int size = BlackboardAttribute.ATTRIBUTE_TYPE.values().length; + for (int n = 0; n <= size; n++) { + attributes.put(n, ""); } for (BlackboardAttribute tempatt : attList) { if (ReportFilter.cancel == true) { @@ -668,7 +664,7 @@ public class ReportHTML implements ReportModule { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(folder + "downloads.html"), "UTF-8")); out.write(generateHead("Web Download Artifacts (" + countDownloads + ")")); String title = "

    Web Downloads (" + countDownloads + ")

    \n"; - String tableHeader = getTableHead("File", "Source", "Time", "Program", "Path"); + String tableHeader = getTableHead("URL", "Source", "Time", "Program", "Path"); out.write(title); out.write(tableHeader); @@ -719,7 +715,7 @@ public class ReportHTML implements ReportModule { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(folder + "recent.html"), "UTF-8")); out.write(generateHead("Recent Document Artifacts (" + countRecent + ")")); String title = "

    Recent Documents (" + countRecent + ")

    \n"; - String tableHeader = getTableHead("Name", "Path", "Related Shortcut"); + String tableHeader = getTableHead("Name", "Related Shortcut", "Path"); out.write(title); out.write(tableHeader); @@ -732,8 +728,8 @@ public class ReportHTML implements ReportModule { StringBuilder row = new StringBuilder(); row.append("
    \n"); row.append("\n"); - row.append("\n"); row.append("\n"); + row.append("\n"); row.append("\n"); out.write(row.toString()); }
    ").append("File Name").append("PreviewKeyword ListPath
    ").append(uniqueresults.getString("name")).append("").append(previewreplace.replaceAll("").append("").append(uniqueresults.getString("list")).append("
    (").append(uniqueresults.getString("exp") == null ? keyword : uniqueresults.getString("exp")).append(")").append("
    ").append(previewreplace.replaceAll("").append("").append(uniqueresults.getString("list")).append("
    (").append(uniqueresults.getString("exp") == null ? keyword : uniqueresults.getString("exp")).append(")").append("
    ").append(file != null ? file.getUniquePath() : "").append("
    ").append(attributes.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID())).append("").append(file.getUniquePath()).append("").append(file != null ? file.getName() : "").append("").append(file.getUniquePath()).append("