diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java index 42c3d8e5e287254db694be95942e193ca2d4e41d..4ae3be6e29c9c7e63f0a05986f340833b3908842 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java @@ -16,6 +16,7 @@ import java.util.*; import java.io.File; import java.io.IOException; +import java.net.URLDecoder; import org.sleuthkit.autopsy.ingest.IngestImageWorkerController; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ServiceDataEvent; @@ -254,7 +255,8 @@ public void getffdb(List<String> image, IngestImageWorkerController controller){ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID(),"RecentActivity","Last Visited",temprs.getString("startTime"))); bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "RecentActivity","",((temprs.getString("source") != null) ? temprs.getString("source") : ""))); //bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), "RecentActivity","", ((temprs.getString("title") != null) ? temprs.getString("title").replaceAll("'", "''") : ""))); - bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), "Recent Activity", "", temprs.getString("target"))); + String urldecodedtarget = URLDecoder.decode(temprs.getString("target").replaceAll("file:///", ""), "UTF-8"); + bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), "Recent Activity", "", urldecodedtarget)); bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(),"RecentActivity","","FireFox")); bbart.addAttributes(bbattributes); diff --git a/Report/src/org/sleuthkit/autopsy/report/BrowserControl.java b/Report/src/org/sleuthkit/autopsy/report/BrowserControl.java new file mode 100644 index 0000000000000000000000000000000000000000..08f201f83f7652e79ecac4c9976ae86a393d0973 --- /dev/null +++ b/Report/src/org/sleuthkit/autopsy/report/BrowserControl.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.report; + +/** + * + * @author Alex + */ +import java.lang.reflect.Method; + +public class BrowserControl{ +/** +* Method to Open the Browser with Given URL +* @param url +*/ +public static void openUrl(String url){ +String os = System.getProperty("os.name"); +Runtime runtime=Runtime.getRuntime(); +try{ +// Block for Windows Platform +if (os.startsWith("Windows")){ +String cmd = "rundll32 url.dll,FileProtocolHandler "+ url; +Process p = runtime.exec(cmd); +} +//Block for Mac OS +else if(os.startsWith("Mac OS")){ +Class fileMgr = Class.forName("com.apple.eio.FileManager"); +Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); +openURL.invoke(null, new Object[] {url}); +} +//Block for UNIX Platform +else { +String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; +String browser = null; +for (int count = 0; count < browsers.length && browser == null; count++) +if (runtime.exec(new String[] {"which", browsers[count]}).waitFor() == 0) +browser = browsers[count]; +if (browser == null) +throw new Exception("Could not find web browser"); +else +runtime.exec(new String[] {browser, url}); +} +}catch(Exception x){ +System.err.println("Exception occurd while invoking Browser!"); +x.printStackTrace(); +} +} +} diff --git a/Report/src/org/sleuthkit/autopsy/report/Bundle.properties b/Report/src/org/sleuthkit/autopsy/report/Bundle.properties index 96e0030dd7640a5d8947e8b823bd3fc4528b6506..3cfbe706b749f041122a3f9ed86cfbc094439ad2 100644 --- a/Report/src/org/sleuthkit/autopsy/report/Bundle.properties +++ b/Report/src/org/sleuthkit/autopsy/report/Bundle.properties @@ -6,7 +6,6 @@ reportFilter.jCheckBox4.text=Hashlist Hits reportFilter.jCheckBox5.text=System Information reportFilter.jButton1.text=Generate Report Toolbars/Reports/org-sleuthkit-autopsy-report-reportAction.shadow=Reports -reportPanel.jEditorPane1.contentType=text/html reportPanel.jButton1.text=Close reportFilter.cancelButton.text=Cancel reportFilter.cancelButton.actionCommand= @@ -14,5 +13,6 @@ reportFilter.jButton2.actionCommand= reportFilter.jButton2.label= reportFilter.jButton2.text= reportPanel.saveReport.actionCommand= -reportPanel.saveReport.text=Save Report +reportPanel.saveReport.text=Export Report... reportFilter.progBar.string= +reportPanel.jLabel1.text=jLabel1 diff --git a/Report/src/org/sleuthkit/autopsy/report/reportHTML.java b/Report/src/org/sleuthkit/autopsy/report/reportHTML.java index c15af1b79ca07e2879ca032f897ed42c184781be..b7bfc9192379470a5815046a1c734561ededa6b0 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportHTML.java +++ b/Report/src/org/sleuthkit/autopsy/report/reportHTML.java @@ -363,7 +363,7 @@ public reportHTML (HashMap<BlackboardArtifact,ArrayList<BlackboardAttribute>> re formatted_Report.append("</div></div></body></html>"); formatted_header.append(formatted_Report); - unformatted_header.append(formatted_Report); + // unformatted_header.append(formatted_Report); htmlPath = currentCase.getCaseDirectory()+"/Reports/" + caseName + "-" + datenotime + ".html"; Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlPath), "UTF-8")); out.write(formatted_header.toString()); diff --git a/Report/src/org/sleuthkit/autopsy/report/reportPanel.form b/Report/src/org/sleuthkit/autopsy/report/reportPanel.form index 624e825e981e7af65e5fec7649bb053f07ef8ddc..25b5456d3b8feacef59b08fa20e5cf82045f8315 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportPanel.form +++ b/Report/src/org/sleuthkit/autopsy/report/reportPanel.form @@ -28,14 +28,13 @@ <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> + <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jScrollPane1" alignment="0" pref="863" max="32767" attributes="0"/> + <Component id="jLabel1" alignment="0" pref="300" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="320" max="-2" attributes="0"/> <Component id="jButton1" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="391" max="32767" attributes="0"/> + <EmptySpace pref="128" max="32767" attributes="0"/> <Component id="saveReport" min="-2" max="-2" attributes="0"/> </Group> </Group> @@ -45,10 +44,10 @@ </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="547" max="32767" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel1" pref="26" max="32767" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="saveReport" alignment="3" min="-2" max="-2" attributes="0"/> @@ -59,23 +58,6 @@ </DimensionLayout> </Layout> <SubComponents> - <Container class="javax.swing.JScrollPane" name="jScrollPane1"> - <AuxValues> - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> - </AuxValues> - - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> - <SubComponents> - <Component class="javax.swing.JEditorPane" name="jEditorPane1"> - <Properties> - <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="reportPanel.jEditorPane1.contentType" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - <Property name="editable" type="boolean" value="false"/> - </Properties> - </Component> - </SubComponents> - </Container> <Component class="javax.swing.JButton" name="jButton1"> <Properties> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -96,5 +78,12 @@ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveReportActionPerformed"/> </Events> </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="reportPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> </SubComponents> </Form> diff --git a/Report/src/org/sleuthkit/autopsy/report/reportPanel.java b/Report/src/org/sleuthkit/autopsy/report/reportPanel.java index 88d1ccac39ec254e2d3790194fbb4dbd74b42e34..bd431208db67f2f6a6af15fc9d468a59ea3453d3 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportPanel.java +++ b/Report/src/org/sleuthkit/autopsy/report/reportPanel.java @@ -15,7 +15,9 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; -import java.net.URL; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import org.jdom.output.XMLOutputter; @@ -43,14 +45,9 @@ private void initComponents() { jFileChooser1 = new javax.swing.JFileChooser(); jOptionPane1 = new javax.swing.JOptionPane(); - jScrollPane1 = new javax.swing.JScrollPane(); - jEditorPane1 = new javax.swing.JEditorPane(); jButton1 = new javax.swing.JButton(); saveReport = new javax.swing.JButton(); - - jEditorPane1.setContentType(org.openide.util.NbBundle.getMessage(reportPanel.class, "reportPanel.jEditorPane1.contentType")); // NOI18N - jEditorPane1.setEditable(false); - jScrollPane1.setViewportView(jEditorPane1); + jLabel1 = new javax.swing.JLabel(); jButton1.setText(org.openide.util.NbBundle.getMessage(reportPanel.class, "reportPanel.jButton1.text")); // NOI18N @@ -62,6 +59,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + jLabel1.setText(org.openide.util.NbBundle.getMessage(reportPanel.class, "reportPanel.jLabel1.text")); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -69,20 +68,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 863, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() - .addGap(320, 320, 320) .addComponent(jButton1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 391, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 128, Short.MAX_VALUE) .addComponent(saveReport))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 547, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(saveReport)) @@ -109,20 +107,27 @@ public void getLink(HyperlinkEvent evt){ try{ String str = evt.getDescription(); - jEditorPane1.scrollToReference(str.substring(1)); + // jEditorPane1.scrollToReference(str.substring(1)); } catch(Exception e){ String whater = ""; } } public void setjEditorPane1EventListener(HyperlinkListener evt){ - jEditorPane1.addHyperlinkListener(evt); + // jEditorPane1.addHyperlinkListener(evt); } private void setReportWindow(String report) { - jEditorPane1.setText(report); - jEditorPane1.setCaretPosition(0); + // jEditorPane1.setText(report); + // jEditorPane1.setCaretPosition(0); + } + + public void setFinishedReportText(){ + DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + Date date = new Date(); + String reportText = "Report was sucessfully generated at " + dateFormat.format(date) + "."; + jLabel1.setText(reportText); } @@ -163,10 +168,9 @@ private void exportReport(String path){ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; - private javax.swing.JEditorPane jEditorPane1; private javax.swing.JFileChooser jFileChooser1; + private javax.swing.JLabel jLabel1; private javax.swing.JOptionPane jOptionPane1; - private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton saveReport; // End of variables declaration//GEN-END:variables diff --git a/Report/src/org/sleuthkit/autopsy/report/reportPanelAction.java b/Report/src/org/sleuthkit/autopsy/report/reportPanelAction.java index 6fe76733e7f7378a517cd693aca20b39d7cf06d0..99e1f9fd464c18413bc557ed84df720e39c25a23 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportPanelAction.java +++ b/Report/src/org/sleuthkit/autopsy/report/reportPanelAction.java @@ -79,7 +79,8 @@ public void run() public void run() { reportHTML htmlReport = new reportHTML(Results,rr); - viewReport.append(reportHTML.unformatted_header.toString()); + BrowserControl.openUrl(htmlReport.htmlPath); + // viewReport.append(reportHTML.unformatted_header.toString()); } }); @@ -134,6 +135,7 @@ public void hyperlinkUpdate(HyperlinkEvent hev) { double h = popUpWindow.getSize().getHeight(); popUpWindow.setLocation((int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2)); rr.progBarDone(); + panel.setFinishedReportText(); popUpWindow.setVisible(true); xmlthread.join();