diff --git a/RecentActivity/nbproject/genfiles.properties b/RecentActivity/nbproject/genfiles.properties index 9e5bb239dce3e61a399d6514487f27933d31de11..ac6636ed073da6ab93ffbc6d1c1fdf59c61b57f0 100644 --- a/RecentActivity/nbproject/genfiles.properties +++ b/RecentActivity/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=dacaa05a +build.xml.data.CRC32=f4b57a2d build.xml.script.CRC32=d323407a -build.xml.stylesheet.CRC32=a56c6a5b@1.46.1 +build.xml.stylesheet.CRC32=a56c6a5b@1.46.2 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=dacaa05a +nbproject/build-impl.xml.data.CRC32=f4b57a2d nbproject/build-impl.xml.script.CRC32=aef16a21 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.1 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2 diff --git a/RecentActivity/nbproject/project.properties b/RecentActivity/nbproject/project.properties index c2587f0f66da27a9ede0ad53554f11716cfd0827..87fc09e95f9a9c515e10bdbb87faee5e6570ca4c 100644 --- a/RecentActivity/nbproject/project.properties +++ b/RecentActivity/nbproject/project.properties @@ -1,5 +1,6 @@ file.reference.gson-2.1.jar=release/modules/ext/gson-2.1.jar file.reference.jdom-1.1.2.jar=release/modules/ext/jdom-1.1.2.jar file.reference.sqlite-jdbc-3.7.6.3-20110609.081603-3.jar=release/modules/ext/sqlite-jdbc-3.7.6.3-20110609.081603-3.jar +is.autoload=true javac.source=1.6 javac.compilerargs=-Xlint -Xlint:-serial diff --git a/RecentActivity/nbproject/project.xml b/RecentActivity/nbproject/project.xml index c6387afb84c783b9e9b3d9557e5ed923d0e3b941..8b4a1e91da7aaf06c06f6e65c1f5735e94958c24 100644 --- a/RecentActivity/nbproject/project.xml +++ b/RecentActivity/nbproject/project.xml @@ -178,14 +178,10 @@ <specification-version>0.0</specification-version> </run-dependency> </dependency> - <dependency> - <code-name-base>org.sleuthkit.autopsy.report</code-name-base> - <run-dependency> - <specification-version>1.0</specification-version> - </run-dependency> - </dependency> </module-dependencies> - <public-packages/> + <public-packages> + <package>org.sleuthkit.autopsy.recentactivity</package> + </public-packages> <class-path-extension> <runtime-relative-path>ext/sqlite-jdbc-3.7.6.3-20110609.081603-3.jar</runtime-relative-path> <binary-origin>release/modules/ext/sqlite-jdbc-3.7.6.3-20110609.081603-3.jar</binary-origin> diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Bundle.properties b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Bundle.properties index fc21672edd5c40e82e657d6e46dc2d9d8dc19e50..3e1a5cd2cb1c094b6a8cbfbd79f3fd70ee91c5ab 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Bundle.properties +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Bundle.properties @@ -1,3 +1,4 @@ +OpenIDE-Module-Display-Category=Java OpenIDE-Module-Name=RecentActivity RecentActivityTopComponent.makeNodesButton.text=Get Recent Activity RecentActivityTopComponent.jLabel1.text=Filter Options diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/dbconnect.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/dbconnect.java index 67272f5900b351f619649105b150eb6bae7710fd..19064301f87001f9c754b972aa24d5d5db08b715 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/dbconnect.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/dbconnect.java @@ -15,9 +15,6 @@ public class dbconnect extends sqlitedbconnect{ public dbconnect(String sDriverForClass, String sUrlKey) throws Exception { init(sDriverForClass, sUrlKey); - //Statement stmt = conn.createStatement(); - //String selecthistory = "SELECT moz_historyvisits.id,url,title,visit_count,visit_date,from_visit,rev_host FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id AND hidden = 0"; - // ResultSet rs = stmt.executeQuery(selecthistory); } diff --git a/Report/nbproject/genfiles.properties b/Report/nbproject/genfiles.properties index 03f0e6b8805e2c86162b681bfda27f3c0306d387..2e8895c1f41c2854705a4ca0f0e037d1e817a01d 100644 --- a/Report/nbproject/genfiles.properties +++ b/Report/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=38c0b1aa +build.xml.data.CRC32=d88c1ca9 build.xml.script.CRC32=bbb1c310 -build.xml.stylesheet.CRC32=a56c6a5b@1.46.1 +build.xml.stylesheet.CRC32=a56c6a5b@1.46.2 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=38c0b1aa +nbproject/build-impl.xml.data.CRC32=d88c1ca9 nbproject/build-impl.xml.script.CRC32=1562aec2 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.1 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2 diff --git a/Report/nbproject/project.xml b/Report/nbproject/project.xml index b7a7ee39b9c5cba6b59faa32ed9ca9b42252e8a3..6deb5c1af8fbe482db01fae184bc8fffb6322a49 100644 --- a/Report/nbproject/project.xml +++ b/Report/nbproject/project.xml @@ -135,6 +135,14 @@ <specification-version>0.0</specification-version> </run-dependency> </dependency> + <dependency> + <code-name-base>org.sleuthkit.autopsy.recentactivity</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> </module-dependencies> <public-packages/> <class-path-extension> diff --git a/Report/src/org/sleuthkit/autopsy/report/Report.java b/Report/src/org/sleuthkit/autopsy/report/Report.java index 847a16c6d56a4bc2ee6390899d18ed2310389487..43a5f7a52c4dc5f77f7f1ab4cbe7f233dfb5f0c5 100644 --- a/Report/src/org/sleuthkit/autopsy/report/Report.java +++ b/Report/src/org/sleuthkit/autopsy/report/Report.java @@ -20,7 +20,9 @@ */ package org.sleuthkit.autopsy.report; -import java.sql.ResultSet; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -30,6 +32,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.SleuthkitCase; +import java.sql.*; +import org.sleuthkit.autopsy.recentactivity.dbconnect; /** * @@ -37,7 +41,7 @@ */ public class Report { - private void report() { + private void Report() { } public String getGroupedKeywordHit() { @@ -46,30 +50,52 @@ public String getGroupedKeywordHit() { Case currentCase = Case.getCurrentCase(); // get the most updated case SleuthkitCase tempDb = currentCase.getSleuthkitCase(); try { + ReportUtils util = new ReportUtils(); + util.copy(new FileInputStream(currentCase.getCaseDirectory()+File.separator+"autopsy.db"), new FileOutputStream(currentCase.getCaseDirectory()+File.separator+"autopsy-copy.db")); + dbconnect tempdbconnect = new dbconnect("org.sqlite.JDBC", "jdbc:sqlite:"+currentCase.getCaseDirectory()+File.separator+"autopsy-copy.db"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_keyword;"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_preview;"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_exp;"); + 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 = 10;"; 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 = 11;"; 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 = 12;"; String temp4 = "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 temp5 = "CREATE table report AS SELECT keyword,preview,exp, name from report_keyword INNER JOIN report_preview ON report_keyword.artifact_id=report_preview.artifact_id INNER JOIN report_exp ON report_preview.artifact_id=report_exp.artifact_id INNER JOIN report_name ON report_exp.artifact_id=report_name.artifact_id;"; - tempDb.runQuery(temp1+temp2+temp3+temp4+temp5); - ResultSet uniqueresults = tempDb.runQuery("select keyword, preview, exp, name FROM report ORDER BY keyword ASC"); + String temp5 = "CREATE TABLE report AS SELECT keyword,preview,exp, name from report_keyword INNER JOIN report_preview ON report_keyword.artifact_id=report_preview.artifact_id INNER JOIN report_exp ON report_preview.artifact_id=report_exp.artifact_id INNER JOIN report_name ON report_exp.artifact_id=report_name.artifact_id;"; + tempdbconnect.executeStmt(temp1); + tempdbconnect.executeStmt(temp2); + tempdbconnect.executeStmt(temp3); + tempdbconnect.executeStmt(temp4); + tempdbconnect.executeStmt(temp5); + ResultSet uniqueresults = tempdbconnect.executeQry("SELECT keyword, preview, exp, name FROM report ORDER BY keyword ASC"); String keyword = ""; while (uniqueresults.next()) { - if(uniqueresults.getString("value_text") == null ? keyword == null : uniqueresults.getString("keyword").equals(keyword)) + if(uniqueresults.getString("keyword") == null ? keyword == null : uniqueresults.getString("keyword").equals(keyword)) { } else{ + table.append("</tbody></table><br /><br />"); keyword = uniqueresults.getString("keyword"); table.append("<strong>").append(keyword).append("</strong>"); table.append("<table><thead><tr><th>").append("File Name").append("</th><th>Preview</th><th>Keyword List</th></tr><tbody>"); } table.append("<tr><td>").append(uniqueresults.getString("name")).append("</td>"); table.append("<td>").append(uniqueresults.getString("preview")).append("</td>").append("<td>").append(uniqueresults.getString("exp")).append("</td>").append("</tr>"); - table.append("</tbody></table><br /><br />"); + } - tempDb.runQuery("DROP TABLE report_keyword; DROP TABLE report_preview; DROP TABLE report_exp; DROP TABLE report_name; DROP TABLE report;"); - + tempDb.close(); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_keyword;"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_preview;"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_exp;"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report_name;"); + tempdbconnect.executeStmt("DROP TABLE IF EXISTS report;"); + tempdbconnect.closeConnection(); + + File f1 = new File(currentCase.getCaseDirectory()+File.separator+"autopsy-copy.db"); + boolean success = f1.delete(); + } catch (Exception e) { Logger.getLogger(Report.class.getName()).log(Level.WARNING, "Exception occurred", e); } diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportFilter.form b/Report/src/org/sleuthkit/autopsy/report/ReportFilter.form index 53b9485c2f6bc7950e55d6561935b118702aa746..0718f0450a6fff2b55e48407db2c43356af4fd0e 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportFilter.form +++ b/Report/src/org/sleuthkit/autopsy/report/ReportFilter.form @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8" ?> +<?xml version="1.1" encoding="UTF-8" ?> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <NonVisualComponents> diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportFilter.java b/Report/src/org/sleuthkit/autopsy/report/ReportFilter.java index 88c236ecb92f00590db792f3e261ed2c19bf1e37..84ffaf3bf59fd3f0e4442a6174b828a4d77aa3e7 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportFilter.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportFilter.java @@ -195,6 +195,7 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS progBar.setStringPainted(true); progBar.setValue(0); filters.clear(); + config.resetGenArtifactTypes(); if (jCheckBox1.isSelected()) { try { config.setGenArtifactType(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK, true); diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportUtils.java b/Report/src/org/sleuthkit/autopsy/report/ReportUtils.java index ba3dd55969bd0d717ea0a1909d76f27683eacd47..8c5b86f55445af3e90d016da47800ff1faf1c5bb 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportUtils.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportUtils.java @@ -20,6 +20,12 @@ */ package org.sleuthkit.autopsy.report; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + /** * * @author Alex @@ -52,4 +58,18 @@ public static String insertPeriodically(String text, String insert, int period) } return builder.toString(); } + + public static void copy(InputStream in, OutputStream out) throws IOException { + + BufferedInputStream bin = new BufferedInputStream(in); + BufferedOutputStream bout = new BufferedOutputStream(out); + + while (true) { + int datum = bin.read(); + if (datum == -1) + break; + bout.write(datum); + } + bout.flush(); + } } \ No newline at end of file diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportXML.java b/Report/src/org/sleuthkit/autopsy/report/ReportXML.java index 5f28552675135a28daad81b95ee0b04dd1b6ce08..90d980ae6661cac442b3c495bfcf75ec39836053 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportXML.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportXML.java @@ -106,10 +106,14 @@ public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) Long objId = entry.getKey().getObjectID(); Content cont = skCase.getContentById(objId); Long filesize = cont.getSize(); - artifact.setAttribute("ID", objId.toString()); + try{ + artifact.setAttribute("ID", objId.toString()); artifact.setAttribute("Name", cont.accept(new NameVisitor())); artifact.setAttribute("Size", filesize.toString()); - + } + catch(Exception e){ + Logger.getLogger(ReportXML.class.getName()).log(Level.WARNING, "Visitor content exception occurred:", e); + } // Get all the attributes for this guy for (BlackboardAttribute tempatt : entry.getValue()) { if (ReportFilter.cancel == true) { diff --git a/Report/src/org/sleuthkit/autopsy/report/layer.xml b/Report/src/org/sleuthkit/autopsy/report/layer.xml index 5888a01825fd469283389c9fd18833a22c8b92c5..700d9fc5ffdc582fa5800fbfd35b7b7437cf74fb 100644 --- a/Report/src/org/sleuthkit/autopsy/report/layer.xml +++ b/Report/src/org/sleuthkit/autopsy/report/layer.xml @@ -4,8 +4,11 @@ <folder name="Actions"> <folder name="Tools"> <file name="org-sleuthkit-autopsy-report-ReportAction.instance"/> - <file name="org-sleuthkit-autopsy-report-ReportAction.instance_hidden"/> - <file name="org-sleuthkit-autopsy-report-ReportAction.instance_hidden"/> + </folder> + </folder> + <folder name="Menu"> + <folder name="Tools"> + <file name="org-sleuthkit-autopsy-report-ReportAction.shadow"/> </folder> </folder> <folder name="Services"> @@ -16,10 +19,10 @@ </file> </folder> <folder name="Toolbars"> - <file name="sep2.instance"> + <!-- <file name="sep2.instance"> <attr name="instanceClass" stringvalue="javax.swing.JToolBar$Separator"/> <attr name="position" intvalue="600"/> - </file> + </file> --> <folder name="File"> <file name="org-sleuthkit-autopsy-report-ReportAction.shadow"> <attr name="displayName" bundlevalue="org.sleuthkit.autopsy.report.Bundle#Toolbars/Reports/org-sleuthkit-autopsy-report-ReportAction.shadow"/> @@ -29,4 +32,4 @@ </folder> </folder> -</filesystem> +</filesystem> \ No newline at end of file