mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-01 06:49:52 +00:00
report action UI changes, improvements using new service lookup
This commit is contained in:
@@ -20,30 +20,31 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionReferences;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.actions.Presenter;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.coreutils.Log;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
|
||||
@ActionID(category = "Tools",
|
||||
id = "org.sleuthkit.autopsy.report.ReportAction")
|
||||
@@ -57,6 +58,10 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
private JButton toolbarButton = new JButton();
|
||||
private static final String ACTION_NAME = "Generate Report";
|
||||
static final Logger logger = Logger.getLogger(ReportAction.class.getName());
|
||||
private JPanel panel;
|
||||
private ArrayList<JCheckBox> reportList = new ArrayList<JCheckBox>();
|
||||
private ArrayList<JCheckBox> configList = new ArrayList<JCheckBox>();
|
||||
|
||||
|
||||
public ReportAction() {
|
||||
setEnabled(false);
|
||||
@@ -106,6 +111,33 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private class reportListener implements ItemListener {
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
Object source = e.getItem();
|
||||
JCheckBox comp = (JCheckBox)source;
|
||||
String name = comp.getName();
|
||||
JRadioButton buttan = null;
|
||||
Component[] comps = comp.getParent().getComponents();
|
||||
for(Component c : comps)
|
||||
{
|
||||
if(c.getName().equals(name+"p"))
|
||||
{
|
||||
buttan = (JRadioButton)c;
|
||||
}
|
||||
}
|
||||
if(e.getStateChange() == ItemEvent.DESELECTED)
|
||||
{
|
||||
buttan.setEnabled(false);
|
||||
}
|
||||
if(e.getStateChange() == ItemEvent.SELECTED)
|
||||
{
|
||||
buttan.setEnabled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -114,7 +146,7 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
// create the popUp window for it
|
||||
final JFrame frame = new JFrame(ACTION_NAME);
|
||||
final JDialog popUpWindow = new JDialog(frame, ACTION_NAME, true); // to make the popUp Window to be modal
|
||||
|
||||
popUpWindow.setLayout(new GridLayout(0, 1));
|
||||
// initialize panel with loaded settings
|
||||
final ReportFilter panel = new ReportFilter();
|
||||
panel.setjButton2ActionListener(new ActionListener() {
|
||||
@@ -124,9 +156,60 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
popUpWindow.dispose();
|
||||
}
|
||||
});
|
||||
final reportListener listener = new reportListener();
|
||||
final JPanel filterpanel = new JPanel(new GridLayout(0, 2, 5, 5));
|
||||
final JPanel artpanel = new JPanel(new GridLayout(0, 3, 5, 5));
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Border border = BorderFactory.createTitledBorder("Reporting Modules");
|
||||
filterpanel.setBorder(border);
|
||||
filterpanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||
filterpanel.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||
filterpanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
filterpanel.setSize(300, 100);
|
||||
ButtonGroup previewGroup = new ButtonGroup();
|
||||
for (ReportModule m : Lookup.getDefault().lookupAll(ReportModule.class)) {
|
||||
String name = m.getName();
|
||||
String desc = m.getReportTypeDescription();
|
||||
JCheckBox ch = new JCheckBox();
|
||||
ch.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||
ch.setText(name);
|
||||
ch.setName(m.getClass().getName());
|
||||
ch.setToolTipText(desc);
|
||||
ch.setSelected(true);
|
||||
|
||||
JRadioButton cb = new JRadioButton("Preview");
|
||||
previewGroup.add(cb);
|
||||
cb.setName(m.getClass().getName()+"p");
|
||||
filterpanel.add(cb, 0);
|
||||
ch.addItemListener(listener);
|
||||
filterpanel.add(ch, 0);
|
||||
}
|
||||
Border artborder = BorderFactory.createTitledBorder("Report Data");
|
||||
artpanel.setBorder(artborder);
|
||||
artpanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||
artpanel.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||
artpanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
artpanel.setSize(300, 100);
|
||||
for (BlackboardArtifact.ARTIFACT_TYPE a : panel.config.config.keySet()) {
|
||||
JCheckBox ce = new JCheckBox();
|
||||
ce.setText(a.getDisplayName());
|
||||
ce.setToolTipText(a.getDisplayName());
|
||||
ce.setName(a.getLabel());
|
||||
ce.setSelected(true);
|
||||
artpanel.add(ce);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
popUpWindow.add(filterpanel, 0);
|
||||
popUpWindow.add(artpanel, 1);
|
||||
// add the panel to the popup window
|
||||
popUpWindow.add(panel);
|
||||
popUpWindow.add(panel, 2);
|
||||
|
||||
popUpWindow.pack();
|
||||
popUpWindow.setResizable(false);
|
||||
|
||||
@@ -145,7 +228,7 @@ public final class ReportAction extends CallableSystemAction implements Presente
|
||||
Log.get(ReportFilterAction.class).log(Level.WARNING, "Error displaying " + ACTION_NAME + " window.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void performAction() {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
@@ -18,7 +18,7 @@
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[325, 200]"/>
|
||||
<Dimension value="[325, 75]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
@@ -36,53 +36,39 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="filterpanel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="progBar" min="-2" pref="231" max="-2" attributes="1"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="progBar" pref="221" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="filterpanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" max="32767" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="progBar" alignment="3" pref="23" max="32767" attributes="1"/>
|
||||
<Component id="cancelButton" alignment="3" max="32767" attributes="1"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="cancelButton" max="32767" attributes="0"/>
|
||||
<Component id="progBar" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportFilter.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jButton1MouseReleased"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="reportFilter_jButton1"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JProgressBar" name="progBar">
|
||||
<Properties>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
@@ -97,6 +83,20 @@
|
||||
<Property name="stringPainted" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/report/Bundle.properties" key="ReportFilter.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jButton1MouseReleased"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="reportFilter_jButton1"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
@@ -111,23 +111,5 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="filterpanel">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JPanel(new GridLayout(0, 1));"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="306" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="100" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -56,8 +56,8 @@ public class ReportFilter extends javax.swing.JPanel {
|
||||
* Creates new form ReportFilter
|
||||
*/
|
||||
public ReportFilter() {
|
||||
this.setLayout(new GridLayout(0,1));
|
||||
initComponents();
|
||||
createReports();
|
||||
cancel = false;
|
||||
try{
|
||||
config.getAllTypes();
|
||||
@@ -79,16 +79,22 @@ public class ReportFilter extends javax.swing.JPanel {
|
||||
private void initComponents() {
|
||||
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
progBar = new javax.swing.JProgressBar();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
cancelButton = new javax.swing.JButton();
|
||||
filterpanel = new JPanel(new GridLayout(0, 1));
|
||||
|
||||
jButton2.setText(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.jButton2.text")); // NOI18N
|
||||
jButton2.setActionCommand(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.jButton2.actionCommand")); // NOI18N
|
||||
jButton2.setLabel(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.jButton2.label")); // NOI18N
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(325, 200));
|
||||
setPreferredSize(new java.awt.Dimension(325, 75));
|
||||
|
||||
progBar.setDoubleBuffered(true);
|
||||
progBar.setEnabled(false);
|
||||
progBar.setName(""); // NOI18N
|
||||
progBar.setPreferredSize(new java.awt.Dimension(146, 15));
|
||||
progBar.setString(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.progBar.string")); // NOI18N
|
||||
progBar.setStringPainted(true);
|
||||
|
||||
jButton1.setText(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.jButton1.text")); // NOI18N
|
||||
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
@@ -102,13 +108,6 @@ public class ReportFilter extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
progBar.setDoubleBuffered(true);
|
||||
progBar.setEnabled(false);
|
||||
progBar.setName(""); // NOI18N
|
||||
progBar.setPreferredSize(new java.awt.Dimension(146, 15));
|
||||
progBar.setString(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.progBar.string")); // NOI18N
|
||||
progBar.setStringPainted(true);
|
||||
|
||||
cancelButton.setText(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.cancelButton.text")); // NOI18N
|
||||
cancelButton.setActionCommand(org.openide.util.NbBundle.getMessage(ReportFilter.class, "ReportFilter.cancelButton.actionCommand")); // NOI18N
|
||||
cancelButton.setEnabled(false);
|
||||
@@ -118,17 +117,6 @@ public class ReportFilter extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout filterpanelLayout = new javax.swing.GroupLayout(filterpanel);
|
||||
filterpanel.setLayout(filterpanelLayout);
|
||||
filterpanelLayout.setHorizontalGroup(
|
||||
filterpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 306, Short.MAX_VALUE)
|
||||
);
|
||||
filterpanelLayout.setVerticalGroup(
|
||||
filterpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 100, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -136,26 +124,25 @@ public class ReportFilter extends javax.swing.JPanel {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(filterpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jButton1)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(progBar, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cancelButton)))
|
||||
.addContainerGap())
|
||||
.addComponent(jButton1)
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(progBar, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancelButton)
|
||||
.addGap(24, 24, 24))))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(filterpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(19, 19, 19)
|
||||
.addComponent(jButton1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(progBar, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
|
||||
.addComponent(cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(progBar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@@ -225,36 +212,7 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
|
||||
});
|
||||
}
|
||||
|
||||
public void createReports() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Border border = BorderFactory.createTitledBorder("Reporting Modules");
|
||||
filterpanel.setBorder(border);
|
||||
for (ReportModule m : Lookup.getDefault().lookupAll(ReportModule.class))
|
||||
{
|
||||
String name = m.getName();
|
||||
String desc = m.getReportTypeDescription();
|
||||
|
||||
JCheckBox ch = new JCheckBox();
|
||||
ch.setText(name);
|
||||
ch.setToolTipText(desc);
|
||||
ch.setSelected(false);
|
||||
filterpanel.add(ch);
|
||||
}
|
||||
|
||||
JCheckBox ch = new JCheckBox();
|
||||
ch.setText("133454");
|
||||
ch.setToolTipText("235325353");
|
||||
ch.setSelected(false);
|
||||
filterpanel.add(ch);
|
||||
filterpanel.revalidate();
|
||||
filterpanel.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void progBarDone() {
|
||||
int max = progBar.getMaximum();
|
||||
progBar.setValue(max);
|
||||
@@ -299,7 +257,6 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JPanel filterpanel;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JProgressBar progBar;
|
||||
|
||||
@@ -54,15 +54,15 @@ public class ReportHTML implements ReportModule{
|
||||
private static StringBuilder formatted_header = new StringBuilder();
|
||||
private static String htmlPath = "";
|
||||
private ReportConfiguration config;
|
||||
private static ReportRegisterService instance = null;
|
||||
private static ReportHTML instance = null;
|
||||
|
||||
ReportHTML(){
|
||||
|
||||
}
|
||||
|
||||
public static synchronized ReportRegisterService getDefault() {
|
||||
public static synchronized ReportHTML getDefault() {
|
||||
if (instance == null) {
|
||||
instance = new ReportRegisterService();
|
||||
instance = new ReportHTML();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@@ -475,6 +475,11 @@ public class ReportHTML implements ReportModule{
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPreview(String path) {
|
||||
BrowserControl.openUrl(path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -68,4 +68,12 @@ public interface ReportModule {
|
||||
* module generates
|
||||
*/
|
||||
public String getReportTypeDescription();
|
||||
|
||||
|
||||
/**
|
||||
* Calls to the report module to execute a method to display the report that was generated.
|
||||
*@param String the path to the file
|
||||
*
|
||||
*/
|
||||
public void getPreview(String path);
|
||||
}
|
||||
@@ -75,7 +75,6 @@ public class ReportPanelAction {
|
||||
ReportHTML htmlReport = new ReportHTML();
|
||||
try{
|
||||
String htmlpath = htmlReport.generateReport(reportconfig, rr);
|
||||
BrowserControl.openUrl(htmlpath);
|
||||
}
|
||||
catch(ReportModuleException e){
|
||||
Logger.getLogger(ReportHTML.class.getName()).log(Level.WARNING, "Exception occurred in generating the htmlReport", e);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
@@ -35,7 +37,6 @@ import java.util.logging.Logger;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.report.register.ReportRegisterService;
|
||||
import org.sleuthkit.datamodel.*;
|
||||
|
||||
/**
|
||||
@@ -47,26 +48,26 @@ public class ReportXLS implements ReportModule {
|
||||
public static Workbook wb = new XSSFWorkbook();
|
||||
private static String xlsPath = "";
|
||||
private ReportConfiguration config;
|
||||
private static ReportRegisterService instance = null;
|
||||
private static ReportXLS instance = null;
|
||||
|
||||
public ReportXLS() {
|
||||
//Empty the workbook first
|
||||
|
||||
}
|
||||
|
||||
public static synchronized ReportRegisterService getDefault() {
|
||||
|
||||
public static synchronized ReportXLS getDefault() {
|
||||
if (instance == null) {
|
||||
instance = new ReportRegisterService();
|
||||
instance = new ReportXLS();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException {
|
||||
config = reportconfig;
|
||||
ReportGen reportobj = new ReportGen();
|
||||
reportobj.populateReport(reportconfig);
|
||||
HashMap<BlackboardArtifact, ArrayList<BlackboardAttribute>> report = reportobj.Results;
|
||||
Workbook wbtemp = new XSSFWorkbook();
|
||||
public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException {
|
||||
config = reportconfig;
|
||||
ReportGen reportobj = new ReportGen();
|
||||
reportobj.populateReport(reportconfig);
|
||||
HashMap<BlackboardArtifact, ArrayList<BlackboardAttribute>> report = reportobj.Results;
|
||||
Workbook wbtemp = new XSSFWorkbook();
|
||||
int countGen = 0;
|
||||
int countBookmark = 0;
|
||||
int countCookie = 0;
|
||||
@@ -132,7 +133,7 @@ public class ReportXLS implements ReportModule {
|
||||
|
||||
//The first summary report page
|
||||
Sheet sheetSummary = wbtemp.createSheet("Summary");
|
||||
|
||||
|
||||
//Generate a sheet per artifact type
|
||||
// Sheet sheetGen = wbtemp.createSheet(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getDisplayName());
|
||||
Sheet sheetHash = wbtemp.createSheet(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getDisplayName());
|
||||
@@ -154,7 +155,7 @@ public class ReportXLS implements ReportModule {
|
||||
font.setFontName("Arial");
|
||||
font.setBoldweight((short) 2);
|
||||
style.setFont(font);
|
||||
|
||||
|
||||
//create 'default' style
|
||||
CellStyle defaultstyle = wbtemp.createCellStyle();
|
||||
defaultstyle.setBorderBottom((short) 2);
|
||||
@@ -196,7 +197,7 @@ public class ReportXLS implements ReportModule {
|
||||
sheetHash.getRow(0).createCell(0).setCellValue("Name");
|
||||
sheetHash.getRow(0).createCell(1).setCellValue("Size");
|
||||
sheetHash.getRow(0).createCell(2).setCellValue("Hashset Name");
|
||||
|
||||
|
||||
sheetDevice.setDefaultColumnStyle(1, defaultstyle);
|
||||
sheetDevice.createRow(0).setRowStyle(style);
|
||||
sheetDevice.getRow(0).createCell(0).setCellValue("Name");
|
||||
@@ -393,54 +394,59 @@ public class ReportXLS implements ReportModule {
|
||||
|
||||
|
||||
//write out the report to the reports folder, set the wbtemp to the primary wb object
|
||||
wb = wbtemp;
|
||||
xlsPath = currentCase.getCaseDirectory() + File.separator + "Reports" + File.separator + caseName + "-" + datenotime + ".xlsx";
|
||||
this.save(xlsPath);
|
||||
wb = wbtemp;
|
||||
xlsPath = currentCase.getCaseDirectory() + File.separator + "Reports" + File.separator + caseName + "-" + datenotime + ".xlsx";
|
||||
this.save(xlsPath);
|
||||
|
||||
} catch (Exception E) {
|
||||
String test = E.toString();
|
||||
}
|
||||
|
||||
return xlsPath;
|
||||
return xlsPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(String path)
|
||||
{
|
||||
try{
|
||||
FileOutputStream fos = new FileOutputStream(path);
|
||||
wb.write(fos);
|
||||
fos.close();
|
||||
}
|
||||
catch(IOException e){
|
||||
Logger.getLogger(ReportHTML.class.getName()).log(Level.SEVERE, "Could not write out XLS report!", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
String name = "Excel";
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReportType(){
|
||||
String type = "XLS";
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ReportConfiguration GetReportConfiguration(){
|
||||
public void save(String path) {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(path);
|
||||
wb.write(fos);
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(ReportXLS.class.getName()).log(Level.SEVERE, "Could not write out XLS report!", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
String name = "Excel";
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReportType() {
|
||||
String type = "XLS";
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportConfiguration GetReportConfiguration() {
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getReportTypeDescription(){
|
||||
public String getReportTypeDescription() {
|
||||
String desc = "This is an xls formatted report that is meant to be viewed in Excel.";
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPreview(String path) {
|
||||
File file = new File(path);
|
||||
try {
|
||||
Desktop.getDesktop().open(file);
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(ReportXLS.class.getName()).log(Level.SEVERE, "Could not open XLS report! ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,22 +47,22 @@ public class ReportXML implements ReportModule {
|
||||
public static Document xmldoc = new Document();
|
||||
private ReportConfiguration reportconfig;
|
||||
private String xmlPath;
|
||||
private static ReportRegisterService instance = null;
|
||||
private static ReportXML instance = null;
|
||||
|
||||
public ReportXML() {
|
||||
}
|
||||
|
||||
public static synchronized ReportRegisterService getDefault() {
|
||||
|
||||
public static synchronized ReportXML getDefault() {
|
||||
if (instance == null) {
|
||||
instance = new ReportRegisterService();
|
||||
instance = new ReportXML();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException{
|
||||
ReportGen reportobj = new ReportGen();
|
||||
reportobj.populateReport(reportconfig);
|
||||
public String generateReport(ReportConfiguration reportconfig, ReportFilter rr) throws ReportModuleException {
|
||||
ReportGen reportobj = new ReportGen();
|
||||
reportobj.populateReport(reportconfig);
|
||||
HashMap<BlackboardArtifact, ArrayList<BlackboardAttribute>> report = reportobj.Results;
|
||||
try {
|
||||
Case currentCase = Case.getCurrentCase(); // get the most updated case
|
||||
@@ -115,13 +115,12 @@ public class ReportXML implements ReportModule {
|
||||
Long objId = entry.getKey().getObjectID();
|
||||
Content cont = skCase.getContentById(objId);
|
||||
Long filesize = cont.getSize();
|
||||
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);
|
||||
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()) {
|
||||
@@ -196,11 +195,11 @@ public class ReportXML implements ReportModule {
|
||||
root.addContent(nodeKeyword);
|
||||
root.addContent(nodeHash);
|
||||
root.addContent(nodeDevice);
|
||||
|
||||
|
||||
|
||||
|
||||
//Export it the first time
|
||||
xmlPath = currentCase.getCaseDirectory() + File.separator + "Reports" + File.separator + caseName + "-" + datenotime + ".xml";
|
||||
this.save(xmlPath);
|
||||
xmlPath = currentCase.getCaseDirectory() + File.separator + "Reports" + File.separator + caseName + "-" + datenotime + ".xml";
|
||||
this.save(xmlPath);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(ReportXML.class.getName()).log(Level.WARNING, "Exception occurred", e);
|
||||
@@ -211,24 +210,24 @@ public class ReportXML implements ReportModule {
|
||||
|
||||
@Override
|
||||
public void save(String path) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
FileOutputStream out = new FileOutputStream(path);
|
||||
XMLOutputter serializer = new XMLOutputter();
|
||||
serializer.output(xmldoc, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
|
||||
|
||||
FileOutputStream out = new FileOutputStream(path);
|
||||
XMLOutputter serializer = new XMLOutputter();
|
||||
serializer.output(xmldoc, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
String name = "Default XML";
|
||||
return name;
|
||||
public String getName() {
|
||||
String name = "Default XML";
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -243,6 +242,11 @@ public class ReportXML implements ReportModule {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPreview(String path) {
|
||||
BrowserControl.openUrl(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReportTypeDescription() {
|
||||
String desc = "This is an html formatted report that is meant to be viewed in a modern browser.";
|
||||
@@ -265,7 +269,7 @@ public class ReportXML implements ReportModule {
|
||||
public String visit(Image img) {
|
||||
return img.getName();
|
||||
}
|
||||
|
||||
|
||||
//@Override
|
||||
public String visit(File file) {
|
||||
return file.getName();
|
||||
|
||||
@@ -12,9 +12,19 @@
|
||||
</folder>
|
||||
</folder>
|
||||
<folder name="Services">
|
||||
<file name="org-sleuthkit-autopsy-report-register-ReportRegisterService.instance">
|
||||
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.report.ReportHTML"/>
|
||||
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.register.ReportRegisterService.getDefault"/>
|
||||
<file name="org-sleuthkit-autopsy-report-ReportHTML.instance">
|
||||
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.report.ReportModule"/>
|
||||
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.ReportHTML.getDefault"/>
|
||||
<attr name="position" intvalue="1000"/>
|
||||
</file>
|
||||
<file name="org-sleuthkit-autopsy-report-ReportXML.instance">
|
||||
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.report.ReportModule"/>
|
||||
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.ReportXML.getDefault"/>
|
||||
<attr name="position" intvalue="1000"/>
|
||||
</file>
|
||||
<file name="org-sleuthkit-autopsy-report-ReportXLS.instance">
|
||||
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.report.ReportModule"/>
|
||||
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.ReportXLS.getDefault"/>
|
||||
<attr name="position" intvalue="1000"/>
|
||||
</file>
|
||||
</folder>
|
||||
|
||||
Reference in New Issue
Block a user