Moving the report into it's own package

This commit is contained in:
Eugene Livis
2018-11-06 11:16:42 -05:00
parent 8fe070cf27
commit ec3e4eae94
6 changed files with 327 additions and 3 deletions
@@ -0,0 +1,9 @@
OpenIDE-Module-Name=CaseUcoModule
ReportCaseUco.progress.initializing=Creating directories...
ReportCaseUco.progress.querying=Querying files...
ReportCaseUco.ingestWarning.text=Warning, this report was run before ingest services completed\!
ReportCaseUco.progress.loading=Loading files...
ReportCaseUco.progress.processing=Now processing {0}...
ReportCaseUco.getName.text=CASE/UCO
ReportCaseUco.getDesc.text=CASE/UCO format report with basic property fields for every file.
ReportCaseUcoConfigPanel.jLabelSelectDataSource.text=Select a data source for the CASE/UCO report
@@ -0,0 +1,2 @@
ReportCaseUcoConfigPanel.jLabelSelectDataSource.text=STIX\u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306fSTIX\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u9078\u629e
@@ -0,0 +1,80 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.modules.case_uco;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;
/**
* Encapsulates meta data needed to populate the data source selection drop down menu
*/
public class DataSourceComboBoxModel extends AbstractListModel<String> implements ComboBoxModel<String> {
private static final long serialVersionUID = 1L;
private final String[] dataSourceList;
private String selection = null;
/**
* Use this to initialize the panel
*/
DataSourceComboBoxModel() {
this.dataSourceList = new String[0];
}
/**
* Use this when we have data to display.
*
* @param theDataSoureList names of data sources for user to pick from
*/
DataSourceComboBoxModel(String... theDataSoureList) {
dataSourceList = theDataSoureList.clone();
}
@Override
public void setSelectedItem(Object anItem) {
selection = (String) anItem;
}
@Override
public Object getSelectedItem() {
return selection;
}
@Override
public int getSize() {
return dataSourceList.length;
}
@Override
public String getElementAt(int index) {
return dataSourceList[index];
}
@Override
public void addListDataListener(ListDataListener listener) {
this.listenerList.add(ListDataListener.class, listener);
}
@Override
public void removeListDataListener(ListDataListener listener) {
this.listenerList.remove(ListDataListener.class, listener);
}
}
@@ -20,7 +20,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.report;
package org.sleuthkit.autopsy.modules.case_uco;
import java.io.IOException;
import java.nio.file.Files;
@@ -35,13 +35,14 @@ import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.report.GeneralReportModule;
import org.sleuthkit.autopsy.report.ReportProgressPanel;
import org.sleuthkit.autopsy.report.ReportProgressPanel.ReportStatus;
import org.sleuthkit.datamodel.*;
@@ -53,6 +54,7 @@ class ReportCaseUco implements GeneralReportModule {
private static final Logger logger = Logger.getLogger(ReportCaseUco.class.getName());
private static ReportCaseUco instance = null;
private ReportCaseUcoConfigPanel configPanel;
private Case currentCase;
private SleuthkitCase skCase;
@@ -242,6 +244,7 @@ class ReportCaseUco implements GeneralReportModule {
@Override
public JPanel getConfigurationPanel() {
return null; // No configuration panel
configPanel = new ReportCaseUcoConfigPanel();
return configPanel;
}
}
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabelSelectDataSource" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="selectDataSourceComboBox" pref="348" max="32767" attributes="0"/>
</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="11" max="-2" attributes="0"/>
<Component id="jLabelSelectDataSource" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="selectDataSourceComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="172" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JComboBox" name="selectDataSourceComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="dataSourcesList" type="code"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabelSelectDataSource">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/case_uco/Bundle.properties" key="ReportCaseUcoConfigPanel.jLabelSelectDataSource.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
</AuxValues>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,163 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.modules.case_uco;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import java.util.Observer;
import javax.swing.ComboBoxModel;
/**
* UI controls for Common Files Search scenario where the user intends to find
* common files between datasources. It is an inner panel which provides the
* ability to select all datasources or a single datasource from a dropdown list
* of sources in the current case.
*/
public final class ReportCaseUcoConfigPanel extends javax.swing.JPanel {
private static final long serialVersionUID = 1L;
static final long NO_DATA_SOURCE_SELECTED = -1;
private final Observable fileTypeFilterObservable;
private ComboBoxModel<String> dataSourcesList = new DataSourceComboBoxModel();
private final Map<Long, String> dataSourceMap;
/**
* Creates new form IntraCasePanel
*/
public ReportCaseUcoConfigPanel() {
initComponents();
this.dataSourceMap = new HashMap<>();
fileTypeFilterObservable = new Observable() {
@Override
public void notifyObservers() {
//set changed before notify observers
//we want this observerable to always cause the observer to update when notified
this.setChanged();
super.notifyObservers();
}
};
}
/**
* Add an Observer to the Observable portion of this panel so that it can be
* notified of changes to this panel.
*
* @param observer the object which is observing this panel
*/
void addObserver(Observer observer) {
fileTypeFilterObservable.addObserver(observer);
}
/**
* Get the map of datasources which was used to populate the combo box on
* this panel.
*
* @return an unmodifiable copy of the map of datasources
*/
Map<Long, String> getDataSourceMap() {
return Collections.unmodifiableMap(this.dataSourceMap);
}
/**
* Get the ID for the datasource selected in the combo box.
*
* @return the selected datasource ID or
ReportCaseUcoConfigPanel.NO_DATA_SOURCE_SELECTED if none is selected
*/
Long getSelectedDataSourceId() {
for (Entry<Long, String> entry : this.dataSourceMap.entrySet()) {
if (entry.getValue().equals(this.selectDataSourceComboBox.getSelectedItem())) {
return entry.getKey();
}
}
return ReportCaseUcoConfigPanel.NO_DATA_SOURCE_SELECTED;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
selectDataSourceComboBox = new javax.swing.JComboBox<>();
jLabelSelectDataSource = new javax.swing.JLabel();
selectDataSourceComboBox.setModel(dataSourcesList);
selectDataSourceComboBox.setEnabled(false);
jLabelSelectDataSource.setText(org.openide.util.NbBundle.getMessage(ReportCaseUcoConfigPanel.class, "ReportCaseUcoConfigPanel.jLabelSelectDataSource.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelSelectDataSource)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(selectDataSourceComboBox, 0, 348, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(jLabelSelectDataSource)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(172, 172, 172))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabelSelectDataSource;
private javax.swing.JComboBox<String> selectDataSourceComboBox;
// End of variables declaration//GEN-END:variables
/**
* Set the datamodel for the combo box which displays the data sources in
* the current case
*
* @param dataSourceComboBoxModel the DataSourceComboBoxModel to use
*/
void setDatasourceComboboxModel(DataSourceComboBoxModel dataSourceComboBoxModel) {
this.dataSourcesList = dataSourceComboBoxModel;
this.selectDataSourceComboBox.setModel(dataSourcesList);
}
/**
* Update the map of datasources that this panel allows the user to select
* from
*
* @param dataSourceMap A map of datasources
*/
void setDataSourceMap(Map<Long, String> dataSourceMap) {
this.dataSourceMap.clear();
this.dataSourceMap.putAll(dataSourceMap);
}
}