Merged Autopsy 3.0.9 release into develop (master->develop)

This commit is contained in:
Richard Cordovano 2014-03-11 15:21:33 -04:00
commit 70ddbfb3c7
115 changed files with 1081 additions and 983 deletions

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.core/9
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml
OpenIDE-Module-Implementation-Version: 9
OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Requires: org.openide.windows.WindowManager, org.netbeans.api.javahelp.Help
AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true

View File

@ -6,5 +6,5 @@ license.file=../LICENSE-2.0.txt
nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier
nbm.needs.restart=true
spec.version.base=7.0
spec.version.base=7.1

View File

@ -194,6 +194,7 @@
<package>org.sleuthkit.autopsy.actions</package>
<package>org.sleuthkit.autopsy.casemodule</package>
<package>org.sleuthkit.autopsy.casemodule.services</package>
<package>org.sleuthkit.autopsy.contentviewers</package>
<package>org.sleuthkit.autopsy.core</package>
<package>org.sleuthkit.autopsy.corecomponentinterfaces</package>
<package>org.sleuthkit.autopsy.corecomponents</package>
@ -206,14 +207,14 @@
<package>org.sleuthkit.autopsy.report</package>
<package>org.sleuthkit.datamodel</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/Tsk_DataModel.jar</runtime-relative-path>
<binary-origin>release/modules/ext/Tsk_DataModel.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
</project>

View File

@ -109,6 +109,7 @@
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="tagLabel">

View File

@ -245,7 +245,7 @@ public class GetTagNameAndCommentDialog extends JDialog {
private javax.swing.JTextField commentText;
private javax.swing.JButton newTagButton;
private javax.swing.JButton okButton;
private javax.swing.JComboBox tagCombo;
private javax.swing.JComboBox<String> tagCombo;
private javax.swing.JLabel tagLabel;
// End of variables declaration//GEN-END:variables
}

View File

@ -80,6 +80,10 @@
<StringArray count="0"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;LocalDisk&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="errorLabel">
<Properties>

View File

@ -50,12 +50,12 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
/**
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or C:.
*/
class LocalDiskPanel extends JPanel {
final class LocalDiskPanel extends JPanel {
private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName());
private static LocalDiskPanel instance;
private PropertyChangeSupport pcs = null;
private List<LocalDisk> disks = new ArrayList<LocalDisk>();
private List<LocalDisk> disks;
private LocalDiskModel model;
private boolean enableNext = false;
@ -63,6 +63,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
* Creates new form LocalDiskPanel
*/
public LocalDiskPanel() {
this.disks = new ArrayList<>();
initComponents();
customInit();
@ -101,7 +102,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private void initComponents() {
diskLabel = new javax.swing.JLabel();
diskComboBox = new javax.swing.JComboBox();
diskComboBox = new javax.swing.JComboBox<>();
errorLabel = new javax.swing.JLabel();
timeZoneLabel = new javax.swing.JLabel();
timeZoneComboBox = new javax.swing.JComboBox<String>();
@ -165,7 +166,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel descLabel;
private javax.swing.JComboBox diskComboBox;
private javax.swing.JComboBox<LocalDisk> diskComboBox;
private javax.swing.JLabel diskLabel;
private javax.swing.JLabel errorLabel;
private javax.swing.JCheckBox noFatOrphansCheckbox;
@ -296,14 +297,13 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private Object selected;
private boolean ready = false;
private volatile boolean loadingDisks = false;
List<LocalDisk> physical = new ArrayList<LocalDisk>();
List<LocalDisk> partitions = new ArrayList<LocalDisk>();
List<LocalDisk> physical = new ArrayList<>();
List<LocalDisk> partitions = new ArrayList<>();
//private String SELECT = "Select a local disk:";
private String LOADING = NbBundle.getMessage(this.getClass(), "LocalDiskPanel.localDiskModel.loading.msg");
LocalDiskThread worker = null;
private void loadDisks() {
// if there is a worker already building the lists, then cancel it first.
@ -313,9 +313,9 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
// Clear the lists
errorLabel.setText("");
disks = new ArrayList<LocalDisk>();
physical = new ArrayList<LocalDisk>();
partitions = new ArrayList<LocalDisk>();
disks = new ArrayList<>();
physical = new ArrayList<>();
partitions = new ArrayList<>();
diskComboBox.setEnabled(false);
ready = false;
enableNext = false;
@ -330,7 +330,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
@Override
public void setSelectedItem(Object anItem) {
if(ready) {
selected = anItem;
selected = (LocalDisk) anItem;
enableNext = true;
try {
@ -384,13 +384,14 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
label.setForeground(list.getForeground());
}
if(value !=null && value.equals(LOADING)) {
String localDiskString = value.toString();
if(localDiskString.equals(LOADING)) {
Font font = new Font(label.getFont().getName(), Font.ITALIC, label.getFont().getSize());
label.setText(LOADING);
label.setFont(font);
label.setBackground(Color.GRAY);
} else {
label.setText(value != null ? value.toString() : "");
label.setText(value.toString());
}
label.setOpaque(true);
label.setBorder(new EmptyBorder(2, 2, 2, 2));

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 Basis Technology Corp.
* Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.casemodule;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
@ -31,54 +30,46 @@ import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
class MissingImageDialog extends javax.swing.JDialog {
class MissingImageDialog extends javax.swing.JDialog {
private static final Logger logger = Logger.getLogger(MissingImageDialog.class.getName());
long obj_id;
SleuthkitCase db;
static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC);
static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC);
static final List<String> allExt = new ArrayList<String>();
static {
allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
}
static final String allDesc = NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.allDesc.text");
static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
private JFileChooser fc = new JFileChooser();
private MissingImageDialog(long obj_id, SleuthkitCase db) {
super(new JFrame(), true);
this.obj_id = obj_id;
this.db = db;
initComponents();
fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
fc.addChoosableFileFilter(rawFilter);
fc.addChoosableFileFilter(encaseFilter);
fc.setFileFilter(allFilter);
customInit();
}
//
// * Client call to create a MissingImageDialog.
// *
@ -91,16 +82,16 @@ import org.sleuthkit.datamodel.TskCoreException;
@Override
public void windowClosing(WindowEvent e) {
dialog.cancel();
}
}
});
dialog.display();
}
private void customInit() {
selectButton.setEnabled(false);
selectButton.setEnabled(false);
}
private void display() {
this.setTitle(NbBundle.getMessage(this.getClass(), "MissingImageDialog.display.title"));
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
@ -109,27 +100,27 @@ import org.sleuthkit.datamodel.TskCoreException;
int h = this.getSize().height;
// set the location of the popUp Window on the center of the screen
setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
this.setVisible(true);
}
//
// * Focuses the select button for easy enter-pressing access.
//
private void moveFocusToSelect() {
this.selectButton.requestFocusInWindow();
}
//
// * Enables/disables the select button based off the current panel.
//
private void updateSelectButton() {
// Enable this based on whether there is a valid path
if (!pathNameTextField.getText().isEmpty()) {
String filePath = pathNameTextField.getText();
boolean isExist = Case.pathExists(filePath) || Case.driveExists(filePath);
selectButton.setEnabled(isExist);
selectButton.setEnabled(isExist);
}
}
@ -276,16 +267,14 @@ import org.sleuthkit.datamodel.TskCoreException;
private void pathNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathNameTextFieldActionPerformed
// TODO add your handling code here:
updateSelectButton();
updateSelectButton();
}//GEN-LAST:event_pathNameTextFieldActionPerformed
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
String oldText = pathNameTextField.getText();
// set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText);
if (currentDir.exists()) {
@ -298,10 +287,9 @@ import org.sleuthkit.datamodel.TskCoreException;
pathNameTextField.setText(path);
}
//pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true);
updateSelectButton();
}//GEN-LAST:event_browseButtonActionPerformed
updateSelectButton();
}//GEN-LAST:event_browseButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton browseButton;
private javax.swing.JPanel buttonPanel;
@ -312,21 +300,19 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.JLabel titleLabel;
private javax.swing.JSeparator titleSeparator;
// End of variables declaration//GEN-END:variables
//
// * Verify the user wants to cancel searching for the image.
//
void cancel() {
int ret = JOptionPane.showConfirmDialog(null,
NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.msg"),
NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.title"),
JOptionPane.YES_NO_OPTION);
NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.msg"),
NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.title"),
JOptionPane.YES_NO_OPTION);
if (ret == JOptionPane.YES_OPTION) {
this.dispose();
}
}
}
}

View File

@ -120,7 +120,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* Initialize panels representing individual wizard's steps and sets
* various properties for them influencing wizard appearance.
*/
@SuppressWarnings({"unchecked"})
@SuppressWarnings({"unchecked", "rawtypes"})
private WizardDescriptor.Panel<WizardDescriptor>[] getPanels() {
if (panels == null) {
panels = new WizardDescriptor.Panel[]{

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -21,8 +21,6 @@ package org.sleuthkit.autopsy.contentviewers;
import javax.swing.JTextPane;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskCoreException;
/**
*

View File

@ -13,7 +13,8 @@
<attr name="Menu\File\Separator4.instance_hidden\position" intvalue="400"/>-->
<folder name="OptionsDialog">
<folder name="General.instance_hidden"/>
<!--<folder name="General.instance_hidden"/>-->
<file name="General.instance"/>
<folder name="Keymaps.instance_hidden"/> <!-- Keymap -->
<folder name="Java.instance_hidden"/>
<folder name="Advanced.instance_hidden"/> <!-- Miscellaneous -->

View File

@ -284,6 +284,10 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languageComboActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;SCRIPT&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="languageLabel">
<Properties>

View File

@ -116,7 +116,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
prevPageButton = new javax.swing.JButton();
goToPageLabel = new javax.swing.JLabel();
goToPageTextField = new javax.swing.JTextField();
languageCombo = new javax.swing.JComboBox();
languageCombo = new javax.swing.JComboBox<>();
languageLabel = new javax.swing.JLabel();
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.copyMenuItem.text")); // NOI18N
@ -316,7 +316,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
private javax.swing.JTextField goToPageTextField;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JComboBox languageCombo;
private javax.swing.JComboBox<SCRIPT> languageCombo;
private javax.swing.JLabel languageLabel;
private javax.swing.JButton nextPageButton;
private javax.swing.JLabel ofLabel;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -57,29 +57,29 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// service provider when DataResultViewers can be made compatible with node
// multiple selection actions.
//@ServiceProvider(service = DataResultViewer.class)
public class DataResultViewerTable extends AbstractDataResultViewer {
public class DataResultViewerTable extends AbstractDataResultViewer {
private String firstColumnLabel = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.firstColLbl");
private Set<Property> propertiesAcc = new LinkedHashSet<>();
private static final Logger logger = Logger.getLogger(DataResultViewerTable.class.getName());
private final DummyNodeListener dummyNodeListener = new DummyNodeListener();
private static final String DUMMY_NODE_DISPLAY_NAME = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.dummyNodeDisplayName");
private static final String DUMMY_NODE_DISPLAY_NAME = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.dummyNodeDisplayName");
/**
* Creates a DataResultViewerTable object that is compatible with node
* Creates a DataResultViewerTable object that is compatible with node
* multiple selection actions.
*/
public DataResultViewerTable(ExplorerManager explorerManager) {
super(explorerManager);
initialize();
}
/**
* Creates a DataResultViewerTable object that is NOT compatible with node
* Creates a DataResultViewerTable object that is NOT compatible with node
* multiple selection actions.
*/
public DataResultViewerTable() {
initialize();
initialize();
}
private void initialize() {
@ -93,9 +93,9 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// don't show the root node
ov.getOutline().setRootVisible(false);
ov.getOutline().setDragEnabled(false);
ov.getOutline().setDragEnabled(false);
}
/**
* Expand node
*
@ -179,6 +179,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param parent Node with at least one child to get properties from
* @return Properties,
*/
@SuppressWarnings("rawtypes")
private Node.Property[] getAllChildPropertyHeaders(Node parent) {
Node firstChild = parent.getChildren().getNodeAt(0);
@ -222,7 +223,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
private void getAllChildPropertyHeadersRec(Node parent, int rows) {
Children children = parent.getChildren();
int childCount = 0;
for (Node child : children.getNodes()) {
for (Node child : children.getNodes()) {
if (++childCount > rows) {
break;
}
@ -243,8 +244,10 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
}
/**
* Thread note: Make sure to run this in the EDT as it causes GUI operations.
* @param selectedNode
* Thread note: Make sure to run this in the EDT as it causes GUI
* operations.
*
* @param selectedNode
*/
@Override
public void setNode(Node selectedNode) {
@ -252,7 +255,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
boolean hasChildren = false;
if (selectedNode != null) {
hasChildren = selectedNode.getChildren().getNodesCount() > 0;
}
@ -261,7 +264,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
if (oldNode != null) {
oldNode.removeNodeListener(dummyNodeListener);
}
// if there's no selection node, do nothing
if (hasChildren) {
Node root = selectedNode;
@ -279,11 +282,11 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
this.setCursor(null);
}
}
/**
* Create Column Headers based on the Content represented by the Nodes in
* the table.
*
*
* @param root The parent Node of the ContentNodes
*/
private void setupTable(final Node root) {
@ -302,8 +305,8 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
if (ov == null) {
return;
}
propertiesAcc.clear();
propertiesAcc.clear();
DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100);
List<Node.Property> props = new ArrayList<Node.Property>(propertiesAcc);
@ -345,15 +348,15 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// show the horizontal scroll panel and show all the content & header
int totalColumns = props.size();
//int scrollWidth = ttv.getWidth();
int margin = 4;
int startColumn = 1;
// If there is only one column (which was removed from props above)
// Just let the table resize itself.
ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS);
//int scrollWidth = ttv.getWidth();
int margin = 4;
int startColumn = 1;
// If there is only one column (which was removed from props above)
// Just let the table resize itself.
ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS);
// get first 100 rows values for the table
@ -389,28 +392,26 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// Populate a two-dimensional array with rows of property values for up
// to maxRows children of the node passed in.
private static Object[][] getRowValues(Node node, int maxRows) {
Object[][] rowValues = new Object[Math.min(maxRows, node.getChildren().getNodesCount())][];
Object[][] rowValues = new Object[Math.min(maxRows, node.getChildren().getNodesCount())][];
int rowCount = 0;
for (Node child : node.getChildren().getNodes()) {
if (rowCount >= maxRows) {
break;
}
}
PropertySet[] propertySets = child.getPropertySets();
if (propertySets.length > 0)
{
if (propertySets.length > 0) {
Property[] properties = propertySets[0].getProperties();
rowValues[rowCount] = new Object[properties.length];
for (int j = 0; j < properties.length; ++j) {
try {
rowValues[rowCount][j] = properties[j].getValue();
}
catch (IllegalAccessException | InvocationTargetException ignore) {
} catch (IllegalAccessException | InvocationTargetException ignore) {
rowValues[rowCount][j] = "n/a";
}
}
}
}
++rowCount;
}
}
return rowValues;
}
@ -435,6 +436,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param table the object table
* @return max the maximum width of the column
*/
@SuppressWarnings("rawtypes")
private int getMaxColumnWidth(int index, FontMetrics metrics, int margin, int padding, List<Node.Property> header, Object[][] table) {
// set the tree (the node / names column) width
String headerName = header.get(index - 1).getDisplayName();
@ -485,14 +487,15 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
super.clearComponent();
}
private class DummyNodeListener implements NodeListener {
private volatile boolean load = true;
public void reset() {
load = true;
}
@Override
public void childrenAdded(final NodeMemberEvent nme) {
Node[] delta = nme.getDelta();
@ -510,7 +513,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
}
}
}
private boolean containsReal(Node[] delta) {
for (Node n : delta) {
if (!n.getDisplayName().equals(DUMMY_NODE_DISPLAY_NAME)) {

View File

@ -16,7 +16,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="thumbnailScrollPanel" max="32767" attributes="0"/>
<Component id="thumbnailScrollPanel" pref="642" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@ -201,18 +201,17 @@
</Component>
<Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Small Thumbnails"/>
<StringItem index="1" value="Medium Thumbnails"/>
<StringItem index="2" value="Large Thumbnails"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Small Thumbnails&quot;, &quot;Medium Thumbnails&quot;, &quot;Large Thumbnails&quot; })" type="code"/>
</Property>
<Property name="selectedIndex" type="int" value="1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

View File

@ -121,7 +121,7 @@ import org.sleuthkit.datamodel.TskCoreException;
filePathLabel = new javax.swing.JLabel();
goToPageLabel = new javax.swing.JLabel();
goToPageField = new javax.swing.JTextField();
thumbnailSizeComboBox = new javax.swing.JComboBox();
thumbnailSizeComboBox = new javax.swing.JComboBox<>();
thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348));
@ -171,8 +171,7 @@ import org.sleuthkit.datamodel.TskCoreException;
}
});
thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" }));
thumbnailSizeComboBox.setSelectedIndex(1);
thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" }));
thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
thumbnailSizeComboBoxActionPerformed(evt);
@ -183,7 +182,7 @@ import org.sleuthkit.datamodel.TskCoreException;
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -289,7 +288,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.JButton pagePrevButton;
private javax.swing.JLabel pagesLabel;
private javax.swing.JScrollPane thumbnailScrollPanel;
private javax.swing.JComboBox thumbnailSizeComboBox;
private javax.swing.JComboBox<String> thumbnailSizeComboBox;
// End of variables declaration//GEN-END:variables
@Override

View File

@ -1,3 +1,21 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 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.corecomponents;
import java.io.File;

View File

@ -1,6 +1,20 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* Autopsy Forensic Browser
*
* Copyright 2013-2014 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.corecomponents;
@ -15,54 +29,60 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
@OptionsPanelController.TopLevelRegistration(
categoryName = "#OptionsCategory_Name_General",
iconBase = "org/sleuthkit/autopsy/corecomponents/general-options.png",
position = 1,
keywords = "#OptionsCategory_Keywords_General",
keywordsCategory = "General")
// moved to Bundle
//@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_General=General", "OptionsCategory_Keywords_General=general"})
@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_General",
iconBase = "org/sleuthkit/autopsy/corecomponents/display-options.png",
position = 1,
keywords = "#OptionsCategory_Keywords_General",
keywordsCategory = "General")
public final class GeneralOptionsPanelController extends OptionsPanelController {
private GeneralPanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed;
private static final Logger logger = Logger.getLogger(GeneralOptionsPanelController.class.getName());
@Override
public void update() {
getPanel().load();
changed = false;
}
@Override
public void applyChanges() {
getPanel().store();
changed = false;
}
@Override
public void cancel() {
// need not do anything special, if no changes have been persisted yet
}
@Override
public boolean isValid() {
return getPanel().valid();
}
@Override
public boolean isChanged() {
return changed;
}
@Override
public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set
return null;
}
@Override
public JComponent getComponent(Lookup masterLookup) {
return getPanel();
}
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
@ -77,11 +97,10 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
void changed() {
if (!changed) {
changed = true;
try {
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
}
catch (Exception e) {
} catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
@ -89,16 +108,15 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
MessageNotifyUtil.MessageType.ERROR);
}
}
try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}
catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
} catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
}
}

View File

@ -107,7 +107,7 @@ public class Installer extends ModuleInstall {
final String[] UI_MENU_ITEM_KEYS = new String[]{"MenuBarUI",
};
Map<Object, Object> uiEntries = new TreeMap<Object, Object>();
Map<Object, Object> uiEntries = new TreeMap<>();
// Store the keys that deal with menu items
for(String key : UI_MENU_ITEM_KEYS) {
@ -129,7 +129,7 @@ public class Installer extends ModuleInstall {
}
// Overwrite the Metal menu item keys to use the Aqua versions
for(Map.Entry entry : uiEntries.entrySet()) {
for(Map.Entry<Object,Object> entry : uiEntries.entrySet()) {
UIManager.put(entry.getKey(), entry.getValue());
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -208,7 +208,7 @@ public class PlatformUtil {
* @throws IOException exception thrown if extract the file failed for IO
* reasons
*/
public static boolean extractResourceToUserConfigDir(final Class resourceClass, final String resourceFile) throws IOException {
public static <T> boolean extractResourceToUserConfigDir(final Class<T> resourceClass, final String resourceFile) throws IOException {
final File userDir = new File(getUserConfigDirectory());
final File resourceFileF = new File(userDir + File.separator + resourceFile);

View File

@ -68,7 +68,7 @@ public class XMLUtil {
* For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader.
*
*/
public static boolean xmlIsValid(DOMSource xmlfile, Class clazz, String schemaFile) {
public static <T> boolean xmlIsValid(DOMSource xmlfile, Class<T> clazz, String schemaFile) {
try{
PlatformUtil.extractResourceToUserConfigDir(clazz, schemaFile);
File schemaLoc = new File(PlatformUtil.getUserConfigDirectory() + File.separator + schemaFile);
@ -103,7 +103,7 @@ public class XMLUtil {
* For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader.
*
*/
public static boolean xmlIsValid(Document doc, Class clazz, String type){
public static <T> boolean xmlIsValid(Document doc, Class<T> clazz, String type){
DOMSource dms = new DOMSource(doc);
return xmlIsValid(dms, clazz, type);
}
@ -118,7 +118,7 @@ public class XMLUtil {
* @param xsdPath the full path to the file to validate against
*
*/
public static Document loadDoc(Class clazz, String xmlPath, String xsdPath) {
public static <T> Document loadDoc(Class<T> clazz, String xmlPath, String xsdPath) {
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
Document ret = null;
@ -154,7 +154,7 @@ public class XMLUtil {
* @param doc the document to save
*
*/
public static boolean saveDoc(Class clazz, String xmlPath, String encoding, final Document doc) {
public static <T> boolean saveDoc(Class<T> clazz, String xmlPath, String encoding, final Document doc) {
TransformerFactory xf = TransformerFactory.newInstance();
xf.setAttribute("indent-number", new Integer(1));
boolean success = false;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -22,6 +22,8 @@ import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children.Keys;
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.DerivedFile;
import org.sleuthkit.datamodel.Directory;
import org.sleuthkit.datamodel.File;
@ -62,52 +64,52 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
/**
* Creates appropriate Node for each sub-class of Content
*/
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode> {
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode<? extends Content>> {
@Override
public AbstractContentNode visit(Directory drctr) {
public AbstractContentNode<? extends Content> visit(Directory drctr) {
return new DirectoryNode(drctr);
}
@Override
public AbstractContentNode visit(File file) {
public AbstractContentNode<? extends Content> visit(File file) {
return new FileNode(file);
}
@Override
public AbstractContentNode visit(Image image) {
public AbstractContentNode<? extends Content> visit(Image image) {
return new ImageNode(image);
}
@Override
public AbstractContentNode visit(Volume volume) {
public AbstractContentNode<? extends Content> visit(Volume volume) {
return new VolumeNode(volume);
}
@Override
public AbstractContentNode visit(LayoutFile lf) {
public AbstractContentNode<? extends Content> visit(LayoutFile lf) {
return new LayoutFileNode(lf);
}
@Override
public AbstractContentNode visit(DerivedFile df) {
public AbstractContentNode<? extends Content> visit(DerivedFile df) {
return new LocalFileNode(df);
}
@Override
public AbstractContentNode visit(LocalFile lf) {
public AbstractContentNode<? extends Content> visit(LocalFile lf) {
return new LocalFileNode(lf);
}
@Override
public AbstractContentNode visit(VirtualDirectory ld) {
public AbstractContentNode<? extends Content> visit(VirtualDirectory ld) {
return new VirtualDirectoryNode(ld);
}
@Override
protected AbstractContentNode defaultVisit(SleuthkitVisitableItem di) {
protected AbstractContentNode<? extends Content> defaultVisit(SleuthkitVisitableItem di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
"AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg"));
"AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg"));
}
}
@ -150,12 +152,12 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
public AbstractNode visit(HashsetHits hh) {
return hh.new HashsetHitsRootNode();
}
@Override
public AbstractNode visit(InterestingHits ih) {
return ih.new InterestingHitsRootNode();
}
@Override
public AbstractNode visit(EmailExtracted ee) {
return ee.new EmailExtractedRootNode();
@ -189,7 +191,7 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
protected AbstractNode defaultVisit(AutopsyVisitableItem di) {
throw new UnsupportedOperationException(
NbBundle.getMessage(this.getClass(),
"AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg"));
"AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg"));
}
}
}

View File

@ -78,10 +78,10 @@ public abstract class AbstractFsContentNode<T extends AbstractFile> extends Abst
for (int i = 0; i < FS_PROPS_LEN; ++i) {
final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i];
final String propString = propType.toString();
ss.put(new NodeProperty(propString, propString, NO_DESCR, map.get(propString)));
ss.put(new NodeProperty<>(propString, propString, NO_DESCR, map.get(propString)));
}
if (directoryBrowseMode) {
ss.put(new NodeProperty(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
ss.put(new NodeProperty<>(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
}
return s;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -30,8 +30,9 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskException;
/**
* Node encapsulating blackboard artifact type. This is used on the left-hand navigation side of the Autopsy UI as the
* parent node for all of the artifacts of a given type. Its children will be BlackboardArtifactNode objects.
* Node encapsulating blackboard artifact type. This is used on the left-hand
* navigation side of the Autopsy UI as the parent node for all of the artifacts
* of a given type. Its children will be BlackboardArtifactNode objects.
*/
public class ArtifactTypeNode extends DisplayableItemNode {
@ -66,14 +67,14 @@ public class ArtifactTypeNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.name"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.desc"),
type.getDisplayName()));
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.desc"),
type.getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.name"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.desc"),
childCount));
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.desc"),
childCount));
return s;
}
@ -127,7 +128,7 @@ public class ArtifactTypeNode extends DisplayableItemNode {
case TSK_ENCRYPTION_DETECTED:
return "encrypted-file.png";
case TSK_EXT_MISMATCH_DETECTED:
return "mismatch-16.png";
return "mismatch-16.png";
}
return "artifact-icon.png";
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -48,7 +48,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private BlackboardArtifact artifact;
private Content associated;
private List<NodeProperty> customProperties;
private List<NodeProperty<? extends Object>> customProperties;
static final Logger logger = Logger.getLogger(BlackboardArtifactNode.class.getName());
/**
* Artifact types which should have the associated content's full unique path
@ -107,7 +107,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
}
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.noDesc.text");
Map<String, Object> map = new LinkedHashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, artifact);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.name"),
@ -116,7 +116,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
associated.getName()));
for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(),
ss.put(new NodeProperty<>(entry.getKey(),
entry.getKey(),
NO_DESCR,
entry.getValue()));
@ -124,7 +124,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
//append custom node properties
if (customProperties != null) {
for (NodeProperty np : customProperties) {
for (NodeProperty<? extends Object> np : customProperties) {
ss.put(np);
}
}
@ -172,7 +172,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
try {
sourcePath = associated.getUniquePath();
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get unique path from: " + associated.getName());
logger.log(Level.WARNING, "Failed to get unique path from: {0}", associated.getName());
}
if (sourcePath.isEmpty() == false) {
@ -192,7 +192,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
dataSource = getRootParentName();
}
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get image name from " + associated.getName());
logger.log(Level.WARNING, "Failed to get image name from {0}", associated.getName());
}
if (dataSource.isEmpty() == false) {
@ -215,7 +215,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
parentName = parent.getName();
}
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get parent name from " + associated.getName());
logger.log(Level.WARNING, "Failed to get parent name from {0}", associated.getName());
return "";
}
return parentName;
@ -227,10 +227,10 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
*
* @param np NodeProperty to add
*/
public void addNodeProperty(NodeProperty np) {
public <T> void addNodeProperty(NodeProperty<T> np) {
if (customProperties == null) {
//lazy create the list
customProperties = new ArrayList<NodeProperty>();
customProperties = new ArrayList<>();
}
customProperties.add(np);
@ -297,7 +297,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private static Lookup getLookups(BlackboardArtifact artifact) {
Content content = getAssociatedContent(artifact);
HighlightLookup highlight = getHighlightLookup(artifact, content);
List<Object> forLookup = new ArrayList<Object>();
List<Object> forLookup = new ArrayList<>();
forLookup.add(artifact);
if (content != null) {
forLookup.add(content);

View File

@ -159,8 +159,8 @@ public final class ContentUtils {
* @return number of bytes extracted
* @throws IOException if file could not be written
*/
public static long writeToFile(Content content, java.io.File outputFile,
ProgressHandle progress, SwingWorker worker, boolean source) throws IOException {
public static <T,V> long writeToFile(Content content, java.io.File outputFile,
ProgressHandle progress, SwingWorker<T,V> worker, boolean source) throws IOException {
InputStream in = new ReadContentInputStream(content);
@ -215,11 +215,11 @@ public final class ContentUtils {
* Assumes there will be no collisions with existing directories/files, and
* that the directory to contain the destination file already exists.
*/
public static class ExtractFscContentVisitor extends ContentVisitor.Default<Void> {
public static class ExtractFscContentVisitor<T,V> extends ContentVisitor.Default<Void> {
java.io.File dest;
ProgressHandle progress;
SwingWorker worker;
SwingWorker<T,V> worker;
boolean source = false;
/**
@ -234,7 +234,7 @@ public final class ContentUtils {
* @param source true if source file
*/
public ExtractFscContentVisitor(java.io.File dest,
ProgressHandle progress, SwingWorker worker, boolean source) {
ProgressHandle progress, SwingWorker<T,V> worker, boolean source) {
this.dest = dest;
this.progress = progress;
this.worker = worker;
@ -249,8 +249,8 @@ public final class ContentUtils {
* Convenience method to make a new instance for given destination and
* extract given content
*/
public static void extract(Content cntnt, java.io.File dest, ProgressHandle progress, SwingWorker worker) {
cntnt.accept(new ExtractFscContentVisitor(dest, progress, worker, true));
public static <T,V> void extract(Content cntnt, java.io.File dest, ProgressHandle progress, SwingWorker<T,V> worker) {
cntnt.accept(new ExtractFscContentVisitor<>(dest, progress, worker, true));
}
@Override
@ -333,8 +333,8 @@ public final class ContentUtils {
// recurse on children
for (Content child : dir.getChildren()) {
java.io.File childFile = getFsContentDest(child);
ExtractFscContentVisitor childVisitor =
new ExtractFscContentVisitor(childFile, progress, worker, false);
ExtractFscContentVisitor<T,V> childVisitor =
new ExtractFscContentVisitor<>(childFile, progress, worker, false);
// If this is the source directory of an extract it
// will have a progress and worker, and will keep track
// of the progress bar's progress

View File

@ -102,10 +102,10 @@ public class DataConversion {
outputStringBuilder.append(" ");
// print the ascii columns
String ascii = new String(array, curOffset, lineLen);
String ascii = new String(array, curOffset, lineLen, java.nio.charset.StandardCharsets.US_ASCII);
for (int i = 0; i < 16; i++) {
char c = ' ';
if (i < lineLen) {
if (i < ascii.length()) {
c = ascii.charAt(i);
int dec = (int) c;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -43,7 +43,7 @@ public class DataSourcesNode extends DisplayableItemNode {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -59,9 +59,9 @@ public class DataSourcesNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.desc"),
NAME));
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.desc"),
NAME));
return s;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -53,11 +53,11 @@ public class DeletedContent implements AutopsyVisitableItem {
public enum DeletedContentFilter implements AutopsyVisitableItem {
FS_DELETED_FILTER(0,
"FS_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.fsDelFilter.text")),
"FS_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.fsDelFilter.text")),
ALL_DELETED_FILTER(1,
"ALL_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.allDelFilter.text"));
"ALL_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.allDelFilter.text"));
private int id;
private String name;
private String displayName;
@ -103,7 +103,7 @@ public class DeletedContent implements AutopsyVisitableItem {
public static class DeletedContentsNode extends DisplayableItemNode {
private static final String NAME = NbBundle.getMessage(DeletedContent.class,
"DeletedContent.deletedContentsNode.name");
"DeletedContent.deletedContentsNode.name");
private SleuthkitCase skCase;
DeletedContentsNode(SleuthkitCase skCase) {
@ -118,7 +118,7 @@ public class DeletedContent implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -134,9 +134,9 @@ public class DeletedContent implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.desc"),
NAME));
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.desc"),
NAME));
return s;
}
}
@ -163,14 +163,12 @@ public class DeletedContent implements AutopsyVisitableItem {
public class DeletedContentNode extends DisplayableItemNode {
private SleuthkitCase skCase;
private DeletedContent.DeletedContentFilter filter;
private final Logger logger = Logger.getLogger(DeletedContentNode.class.getName());
DeletedContentNode(SleuthkitCase skCase, DeletedContent.DeletedContentFilter filter) {
super(Children.create(new DeletedContentChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName());
this.skCase = skCase;
this.filter = filter;
String tooltip = filter.getDisplayName();
@ -217,8 +215,7 @@ public class DeletedContent implements AutopsyVisitableItem {
private SleuthkitCase skCase;
private DeletedContent.DeletedContentFilter filter;
private final Logger logger = Logger.getLogger(DeletedContentChildren.class.getName());
private static final int MAX_OBJECTS = 2001;
private static final int MAX_OBJECTS = 10001;
DeletedContentChildren(DeletedContent.DeletedContentFilter filter, SleuthkitCase skCase) {
this.skCase = skCase;
@ -233,12 +230,12 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override
public void run() {
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(),
"DeletedContent.createKeys.maxObjects.msg",
MAX_OBJECTS - 1));
"DeletedContent.createKeys.maxObjects.msg",
MAX_OBJECTS - 1));
}
});
}
queryList.remove(queryList.size() - 1);
list.addAll(queryList);
return true;
@ -273,7 +270,7 @@ public class DeletedContent implements AutopsyVisitableItem {
break;
default:
logger.log(Level.SEVERE, "Unsupported filter type to get deleted content: " + filter);
logger.log(Level.SEVERE, "Unsupported filter type to get deleted content: {0}", filter);
}
@ -282,7 +279,7 @@ public class DeletedContent implements AutopsyVisitableItem {
}
private List<AbstractFile> runFsQuery() {
List<AbstractFile> ret = new ArrayList<AbstractFile>();
List<AbstractFile> ret = new ArrayList<>();
String query = makeQuery();
try {
@ -338,8 +335,8 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override
protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
"DeletedContent.createNodeForKey.typeNotSupported.msg",
di.toString()));
"DeletedContent.createNodeForKey.typeNotSupported.msg",
di.toString()));
}
});
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 Basis Technology Corp.
* Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -58,7 +58,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public EmailExtracted(SleuthkitCase skCase) {
this.skCase = skCase;
accounts = new LinkedHashMap<String, Map<String, List<Long>>>();
accounts = new LinkedHashMap<>();
}
@SuppressWarnings("deprecation")
@ -82,12 +82,12 @@ public class EmailExtracted implements AutopsyVisitableItem {
Map<String, List<Long>> folders = accounts.get(account);
if (folders == null) {
folders = new LinkedHashMap<String, List<Long>>();
folders = new LinkedHashMap<>();
accounts.put(account, folders);
}
List<Long> messages = folders.get(folder);
if (messages == null) {
messages = new ArrayList<Long>();
messages = new ArrayList<>();
folders.put(folder, messages);
}
messages.add(artifactId);
@ -100,11 +100,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
}
private static Map<String, String> parsePath(String path) {
Map<String, String> parsed = new HashMap<String, String>();
Map<String, String> parsed = new HashMap<>();
String[] split = path.split(MAIL_PATH_SEPARATOR);
if (split.length < 4) {
logger.log(Level.WARNING, "Unexpected number of tokens when parsing email PATH: "
+ split.length + ", will use defaults");
logger.log(Level.WARNING, "Unexpected number of tokens when parsing email PATH: {0}, will use defaults", split.length);
parsed.put(MAIL_ACCOUNT, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultAcct.text"));
parsed.put(MAIL_FOLDER, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultFolder.text"));
return parsed;
@ -137,7 +136,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
//return v.visit(this);
@ -154,10 +153,9 @@ public class EmailExtracted implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
return s;
}
}
@ -190,7 +188,6 @@ public class EmailExtracted implements AutopsyVisitableItem {
}
}
list.addAll(tempList);
return true;
}
@ -219,7 +216,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -236,9 +233,9 @@ public class EmailExtracted implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
return s;
}
@ -283,9 +280,9 @@ public class EmailExtracted implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
return s;
}
@ -294,7 +291,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -353,9 +350,9 @@ public class EmailExtracted implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName()));
return s;
}

View File

@ -46,7 +46,7 @@ class ExtractedContentChildren extends ChildFactory<BlackboardArtifact.ARTIFACT_
this.skCase = skCase;
// these are shown in other parts of the UI tree
doNotShow = new ArrayList();
doNotShow = new ArrayList<>();
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -25,7 +25,8 @@ import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase;
/**
* Node for the extracted content artifacts (artifacts that are not shown in more specific areas of the tree)
* Node for the extracted content artifacts (artifacts that are not shown in
* more specific areas of the tree)
*/
public class ExtractedContentNode extends DisplayableItemNode {
@ -42,7 +43,7 @@ public class ExtractedContentNode extends DisplayableItemNode {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -58,8 +59,8 @@ public class ExtractedContentNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.desc"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.desc"),
NAME));
return s;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -101,13 +101,11 @@ public class FileSize implements AutopsyVisitableItem {
public static class FileSizeRootNode extends DisplayableItemNode {
private static final String NAME = NbBundle.getMessage(FileSize.class, "FileSize.fileSizeRootNode.name");
private SleuthkitCase skCase;
FileSizeRootNode(SleuthkitCase skCase) {
super(Children.create(new FileSizeRootChildren(skCase), true), Lookups.singleton(NAME));
super.setName(NAME);
super.setDisplayName(NAME);
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-size-16.png");
}
@ -115,7 +113,7 @@ public class FileSize implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -131,8 +129,8 @@ public class FileSize implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.desc"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.desc"),
NAME));
return s;
}
@ -160,14 +158,12 @@ public class FileSize implements AutopsyVisitableItem {
public class FileSizeNode extends DisplayableItemNode {
private SleuthkitCase skCase;
private FileSizeFilter filter;
private final Logger logger = Logger.getLogger(FileSizeNode.class.getName());
FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter) {
super(Children.create(new FileSizeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName());
this.skCase = skCase;
this.filter = filter;
String tooltip = filter.getDisplayName();
@ -195,9 +191,9 @@ public class FileSize implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.desc"),
filter.getDisplayName()));
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.desc"),
filter.getDisplayName()));
return s;
}
@ -244,7 +240,7 @@ public class FileSize implements AutopsyVisitableItem {
break;
default:
logger.log(Level.SEVERE, "Unsupported filter type to get files by size: " + filter);
logger.log(Level.SEVERE, "Unsupported filter type to get files by size: {0}", filter);
return null;
}
// ignore unalloc block files
@ -254,13 +250,13 @@ public class FileSize implements AutopsyVisitableItem {
}
private List<AbstractFile> runFsQuery() {
List<AbstractFile> ret = new ArrayList<AbstractFile>();
List<AbstractFile> ret = new ArrayList<>();
String query = makeQuery();
if (query == null) {
return null;
}
try {
ret = skCase.findAllFilesWhere(query);
} catch (TskCoreException e) {
@ -330,8 +326,8 @@ public class FileSize implements AutopsyVisitableItem {
protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException(
NbBundle.getMessage(this.getClass(),
"FileSize.exception.notSupported.msg",
di.toString()));
"FileSize.exception.notSupported.msg",
di.toString()));
}
});
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -34,12 +34,12 @@ public class FileTypeNode extends DisplayableItemNode {
FileTypeNode(FileTypeExtensionFilters.SearchFilterInterface filter, SleuthkitCase skCase) {
super(Children.create(new FileTypeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
this.filter = filter;
this.skCase = skCase;
super.setName(filter.getName());
//get count of children without preloading all children nodes
final long count = new FileTypeChildren(filter, skCase).calculateItems();
//final long count = getChildren().getNodesCount(true);
@ -63,18 +63,18 @@ public class FileTypeNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.desc"),
filter.getDisplayName()));
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.desc"),
filter.getDisplayName()));
String extensions = "";
for (String ext : filter.getFilter()) {
extensions += "'" + ext + "', ";
}
extensions = extensions.substring(0, extensions.lastIndexOf(','));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.name"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.desc"),
extensions));
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.desc"),
extensions));
return s;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -30,12 +30,12 @@ import org.sleuthkit.datamodel.SleuthkitCase;
public class FileTypesNode extends DisplayableItemNode {
private static final String FNAME = NbBundle.getMessage(FileTypesNode.class, "FileTypesNode.fname.text");
private SleuthkitCase skCase;
/**
*
*
* @param skCase
* @param filter null to display root node of file type tree, pass in something to provide a sub-node.
* @param filter null to display root node of file type tree, pass in
* something to provide a sub-node.
*/
FileTypesNode(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) {
super(Children.create(new FileTypesChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName()));
@ -43,13 +43,11 @@ public class FileTypesNode extends DisplayableItemNode {
if (filter == null) {
super.setName(FNAME);
super.setDisplayName(FNAME);
}
// sub-node in file tree (i.e. documents, exec, etc.)
} // sub-node in file tree (i.e. documents, exec, etc.)
else {
super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName());
}
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png");
}
@ -57,7 +55,7 @@ public class FileTypesNode extends DisplayableItemNode {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -73,8 +71,8 @@ public class FileTypesNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.desc"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.desc"),
getName()));
return s;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -52,7 +52,7 @@ public class HashsetHits implements AutopsyVisitableItem {
public HashsetHits(SleuthkitCase skCase) {
this.skCase = skCase;
hashSetHitsMap = new LinkedHashMap<String, Set<Long>>();
hashSetHitsMap = new LinkedHashMap<>();
}
@SuppressWarnings("deprecation")
@ -77,21 +77,20 @@ public class HashsetHits implements AutopsyVisitableItem {
hashSetHitsMap.get(value).add(artifactId);
}
} catch (SQLException ex) {
logger.log(Level.WARNING, "SQL Exception occurred: ", ex);
}
finally {
} finally {
if (rs != null) {
try {
skCase.closeRunQuery(rs);
} catch (SQLException ex) {
logger.log(Level.WARNING, "Error closing result set after getting hashset hits", ex);
logger.log(Level.WARNING, "Error closing result set after getting hashset hits", ex);
}
}
}
}
@Override
public <T> T accept(AutopsyItemVisitor<T> v) {
return v.visit(this);
@ -114,7 +113,7 @@ public class HashsetHits implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -130,9 +129,9 @@ public class HashsetHits implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName()));
return s;
}
@ -176,9 +175,9 @@ public class HashsetHits implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName()));
return s;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -86,10 +86,9 @@ public class ImageNode extends AbstractContentNode<Image> {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"),
getName()));
// @@@ add more properties here...
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"),
getName()));
return s;
}
@ -103,7 +102,7 @@ public class ImageNode extends AbstractContentNode<Image> {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -31,10 +31,8 @@ import org.sleuthkit.datamodel.AbstractFile;
* Node that contains a KeyValue object. The node also has that KeyValue object
* set to its lookup so that when the node is passed to the content viewers its
* string will be displayed.
*
* @author alawrence
*/
public class KeyValueNode extends AbstractNode {
public class KeyValueNode extends AbstractNode {
private KeyValue data;
@ -50,12 +48,12 @@ import org.sleuthkit.datamodel.AbstractFile;
super(children, lookup);
this.setName(thing.getName());
this.data = thing;
setIcon();
}
private void setIcon() {
//if file/dir, set icon
//if file/dir, set icon
AbstractFile af = Lookup.getDefault().lookup(AbstractFile.class);
if (af != null) {
// set name, display name, and icon
@ -80,17 +78,17 @@ import org.sleuthkit.datamodel.AbstractFile;
// table view drops first column of properties under assumption
// that it contains the node's name
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.desc"),
data.getName()));
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.desc"),
data.getName()));
for (Map.Entry<String, Object> entry : data.getMap().entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
ss.put(new NodeProperty(key,
key,
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.map.desc"),
value));
key,
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.map.desc"),
value));
}
return s;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.nodes.ChildFactory;
@ -66,11 +65,11 @@ public class KeywordHits implements AutopsyVisitableItem {
public KeywordHits(SleuthkitCase skCase) {
this.skCase = skCase;
artifacts = new LinkedHashMap<Long, Map<Long, String>>();
listsMap = new LinkedHashMap<String, Map<String, Set<Long>>>();
literalMap = new LinkedHashMap<String, Set<Long>>();
regexMap = new LinkedHashMap<String, Set<Long>>();
topLevelMap = new LinkedHashMap<String, Map<String, Set<Long>>>();
artifacts = new LinkedHashMap<>();
listsMap = new LinkedHashMap<>();
literalMap = new LinkedHashMap<>();
regexMap = new LinkedHashMap<>();
topLevelMap = new LinkedHashMap<>();
}
private void initMaps() {
@ -107,7 +106,6 @@ public class KeywordHits implements AutopsyVisitableItem {
literalMap.get(word).add(id);
}
topLevelMap.putAll(listsMap);
}
}
@ -140,16 +138,15 @@ public class KeywordHits implements AutopsyVisitableItem {
}
}
} catch (SQLException ex) {
logger.log(Level.WARNING, "SQL Exception occurred: ", ex);
}
finally {
if (rs != null) {
} finally {
if (rs != null) {
try {
skCase.closeRunQuery(rs);
} catch (SQLException ex) {
logger.log(Level.WARNING, "Error closing result set after getting keyword hits", ex);
logger.log(Level.WARNING, "Error closing result set after getting keyword hits", ex);
}
}
}
@ -167,18 +164,15 @@ public class KeywordHits implements AutopsyVisitableItem {
super.setName(NAME);
super.setDisplayName(KEYWORD_HITS);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png");
//long start = System.currentTimeMillis();
initArtifacts();
initMaps();
//long finish = System.currentTimeMillis();
//logger.info("Process took " + (finish-start) + " ms" );
}
@Override
@Override
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -194,9 +188,9 @@ public class KeywordHits implements AutopsyVisitableItem {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.desc"),
getName()));
return s;
}
@ -242,17 +236,17 @@ public class KeywordHits implements AutopsyVisitableItem {
ss = Sheet.createPropertiesSet();
s.put(ss);
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
name));
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
name));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.desc"),
children.size()));
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.desc"),
children.size()));
return s;
}
@ -261,7 +255,7 @@ public class KeywordHits implements AutopsyVisitableItem {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -291,7 +285,6 @@ public class KeywordHits implements AutopsyVisitableItem {
public class KeywordHitsKeywordNode extends DisplayableItemNode {
private String name;
private Set<Long> children;
public KeywordHitsKeywordNode(String name, Set<Long> children) {
@ -299,7 +292,6 @@ public class KeywordHits implements AutopsyVisitableItem {
super.setName(name);
super.setDisplayName(name + " (" + children.size() + ")");
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png");
this.name = name;
this.children = children;
}
@ -308,8 +300,6 @@ public class KeywordHits implements AutopsyVisitableItem {
return true;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -323,17 +313,16 @@ public class KeywordHits implements AutopsyVisitableItem {
ss = Sheet.createPropertiesSet();
s.put(ss);
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.desc"),
children.size()));
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.desc"),
children.size()));
return s;
}
@ -373,27 +362,27 @@ public class KeywordHits implements AutopsyVisitableItem {
logger.log(Level.SEVERE, "TskCoreException while constructing BlackboardArtifact Node from KeywordHitsKeywordChildren");
return n;
}
n.addNodeProperty(new NodeProperty(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.modTime.name"),
NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.modTime.displayName"),
"KeywordHits.createNodeForKey.modTime.displayName"),
NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.modTime.desc"),
"KeywordHits.createNodeForKey.modTime.desc"),
ContentUtils.getStringTime(file.getMtime(), file)));
n.addNodeProperty(new NodeProperty(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.accessTime.name"),
NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.accessTime.displayName"),
"KeywordHits.createNodeForKey.accessTime.displayName"),
NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.accessTime.desc"),
"KeywordHits.createNodeForKey.accessTime.desc"),
ContentUtils.getStringTime(file.getAtime(), file)));
n.addNodeProperty(new NodeProperty(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.chgTime.name"),
NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.chgTime.displayName"),
"KeywordHits.createNodeForKey.chgTime.displayName"),
NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.chgTime.desc"),
"KeywordHits.createNodeForKey.chgTime.desc"),
ContentUtils.getStringTime(file.getCtime(), file)));
return n;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 - 2013 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -73,19 +73,18 @@ public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
s.put(ss);
}
Map<String, Object> map = new LinkedHashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.desc"),
getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.noDescr.text");
for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
}
// @@@ add more properties here...
return s;
}
@ -99,7 +98,7 @@ public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.datamodel;
import java.util.ArrayList;
@ -65,17 +64,17 @@ public class LocalFileNode extends AbstractAbstractFileNode<AbstractFile> {
s.put(ss);
}
Map<String, Object> map = new LinkedHashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.desc"),
getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.noDescr.text");
for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
}
// @@@ add more properties here...

View File

@ -25,19 +25,19 @@ import org.openide.nodes.PropertySupport;
* This class is used to represent the properties for each node.
*
*/
public class NodeProperty extends PropertySupport.ReadOnly {
public class NodeProperty<T> extends PropertySupport.ReadOnly<T> {
private Object value;
private T value;
@SuppressWarnings({"unchecked"})
public NodeProperty(String name, String displayName, String desc, Object value) {
super(name, value.getClass(), displayName, desc);
@SuppressWarnings("unchecked")
public NodeProperty(String name, String displayName, String desc, T value) {
super(name, (Class<T>) value.getClass(), displayName, desc);
setValue("suppressCustomEditor", Boolean.TRUE); // remove the "..." (editing) button
this.value = value;
}
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
public T getValue() throws IllegalAccessException, InvocationTargetException {
return this.value;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +20,8 @@ package org.sleuthkit.autopsy.datamodel;
import java.util.Calendar;
import java.util.Locale;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Sheet;
import org.openide.util.lookup.Lookups;
@ -42,7 +40,6 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) {
super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName());
//super.setDisplayName(filter.getDisplayName());
this.skCase = skCase;
this.filter = filter;
Calendar prevDay = (Calendar) lastDay.clone();
@ -52,10 +49,9 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
+ prevDay.get(Calendar.YEAR);
this.setShortDescription(tooltip);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png");
//get count of children without preloading all children nodes
final long count = new RecentFilesFilterChildren(filter, skCase, lastDay).calculateItems();
//final long count = getChildren().getNodesCount(true);
super.setDisplayName(filter.getDisplayName() + " (" + count + ")");
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
@ -38,8 +37,7 @@ public class RecentFilesNode extends DisplayableItemNode {
super.setName(NAME);
super.setDisplayName(NAME);
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png");
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png");
}
@Override

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -37,8 +37,7 @@ public class ResultsNode extends DisplayableItemNode {
new HashsetHits(sleuthkitCase),
new EmailExtracted(sleuthkitCase),
new InterestingHits(sleuthkitCase),
new TagsNodeKey()
)), Lookups.singleton(NAME));
new TagsNodeKey())), Lookups.singleton(NAME));
setName(NAME);
setDisplayName(NAME);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/results.png");
@ -48,7 +47,7 @@ public class ResultsNode extends DisplayableItemNode {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -64,9 +63,9 @@ public class ResultsNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.desc"),
NAME));
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.desc"),
NAME));
return s;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -35,11 +35,10 @@ public class ViewsNode extends DisplayableItemNode {
public ViewsNode(SleuthkitCase sleuthkitCase) {
super(new RootContentChildren(Arrays.asList(
new FileTypeExtensionFilters(sleuthkitCase),
new RecentFiles(sleuthkitCase),
new FileTypeExtensionFilters(sleuthkitCase),
new RecentFiles(sleuthkitCase),
new DeletedContent(sleuthkitCase),
new FileSize(sleuthkitCase)
)),
new FileSize(sleuthkitCase))),
Lookups.singleton(NAME));
setName(NAME);
setDisplayName(NAME);
@ -50,7 +49,7 @@ public class ViewsNode extends DisplayableItemNode {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);
@ -66,9 +65,9 @@ public class ViewsNode extends DisplayableItemNode {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.desc"),
NAME));
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.desc"),
NAME));
return s;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 - 2013 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -36,12 +36,11 @@ import org.sleuthkit.datamodel.TskData;
* Node for layout dir
*/
public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirectory> {
private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName());
private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName());
//prefix for special VirtualDirectory root nodes grouping local files
public final static String LOGICAL_FILE_SET_PREFIX = "LogicalFileSet";
public static String nameForLayoutFile(VirtualDirectory ld) {
return ld.getName();
}
@ -50,26 +49,23 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
super(ld);
this.setDisplayName(nameForLayoutFile(ld));
String name = ld.getName();
//set icon for name, special case for some built-ins
if (name.equals(VirtualDirectory.NAME_UNALLOC)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
}
else if (name.startsWith(LOGICAL_FILE_SET_PREFIX)) {
} else if (name.startsWith(LOGICAL_FILE_SET_PREFIX)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/fileset-icon-16.png");
}
else if (name.equals(VirtualDirectory.NAME_CARVED)) {
} else if (name.equals(VirtualDirectory.NAME_CARVED)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //TODO
}
else {
} else {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
}
}
/**
/**
* Right click action for this node
*
* @param popup
@ -86,7 +82,7 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
actions.addAll(ContextMenuExtensionPoint.getActions());
return actions.toArray(new Action[0]);
}
@Override
protected Sheet createSheet() {
Sheet s = super.createSheet();
@ -96,20 +92,19 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
s.put(ss);
}
Map<String, Object> map = new LinkedHashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"),
getName()));
NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"),
getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.noDesc");
for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
}
// @@@ add more properties here...
return s;
}
@ -129,7 +124,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
return true;
}
/**
* Convert meta flag long to user-readable string / label
*
@ -143,12 +137,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue();
short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue();
// some variables that might be needed in the future
//long usedFlag = TskData.TSK_FS_META_FLAG_ENUM.USED.getMetaFlag();
//long unusedFlag = TskData.TSK_FS_META_FLAG_ENUM.UNUSED.getMetaFlag();
//long compFlag = TskData.TSK_FS_META_FLAG_ENUM.COMP.getMetaFlag();
//long orphanFlag = TskData.TSK_FS_META_FLAG_ENUM.ORPHAN.getMetaFlag();
if ((metaFlag & allocFlag) == allocFlag) {
result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString();
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -88,29 +88,29 @@ public class VolumeNode extends AbstractContentNode<Volume> {
}
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"),
this.getDisplayName()));
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"),
this.getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"),
content.getAddr()));
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"),
content.getAddr()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"),
content.getStart()));
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"),
content.getStart()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"),
content.getLength()));
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"),
content.getLength()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"),
content.getDescription()));
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"),
content.getDescription()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"),
content.getFlagsAsString()));
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"),
content.getFlagsAsString()));
return s;
}
@ -124,7 +124,7 @@ public class VolumeNode extends AbstractContentNode<Volume> {
public boolean isLeafTypeNode() {
return false;
}
@Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this);

View File

@ -180,7 +180,7 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
return isLeafDirectory(dn);
}
private Boolean visitDeep(AbstractAbstractFileNode node) {
private Boolean visitDeep(AbstractAbstractFileNode<? extends AbstractFile> node) {
//is a leaf if has no children, or children are files not dirs
boolean hasChildren = node.hasContentChildren();
if (!hasChildren) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -92,7 +92,7 @@ class DirectoryTreeFilterNode extends FilterNode {
*/
@Override
public Action[] getActions(boolean popup) {
List<Action> actions = new ArrayList<Action>();
List<Action> actions = new ArrayList<>();
final Content content = this.getLookup().lookup(Content.class);
if (content != null) {
@ -103,24 +103,24 @@ class DirectoryTreeFilterNode extends FilterNode {
if (dir != null) {
actions.add(ExtractAction.getInstance());
}
// file search action
final Image img = this.getLookup().lookup(Image.class);
if (img != null) {
actions.add(new FileSearchAction(
NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text")));
}
//ingest action
actions.add(new AbstractAction(
NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) {
@Override
public void actionPerformed(ActionEvent e) {
final IngestDialog ingestDialog = new IngestDialog();
ingestDialog.setContent(Collections.<Content>singletonList(content));
ingestDialog.display();
}
});
actions.add(new AbstractAction(
NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) {
@Override
public void actionPerformed(ActionEvent e) {
final IngestDialog ingestDialog = new IngestDialog();
ingestDialog.setContent(Collections.<Content>singletonList(content));
ingestDialog.display();
}
});
}
//check if delete actions should be added
@ -135,7 +135,7 @@ class DirectoryTreeFilterNode extends FilterNode {
}
private static List<Action> getDeleteActions(DisplayableItemNode original) {
List<Action> actions = new ArrayList<Action>();
List<Action> actions = new ArrayList<>();
//actions.addAll(original.accept(getDeleteActionVisitor));
return actions;
}

View File

@ -76,6 +76,8 @@ public class NewWindowViewAction extends AbstractAction{
@Override
public void run() {
dctc.setNode(contentNode);
dctc.toFront();
dctc.requestActive();
}
});
}

View File

@ -39,6 +39,7 @@ import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
import org.sleuthkit.autopsy.datamodel.DataSourcesNode;
import org.sleuthkit.autopsy.datamodel.RootContentChildren;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.FileSystem;
@ -66,7 +67,7 @@ public class ViewContextAction extends AbstractAction {
}
public ViewContextAction(String title, AbstractFsContentNode node) {
public ViewContextAction(String title, AbstractFsContentNode<? extends AbstractFile> node) {
super(title);
this.content = node.getLookup().lookup(Content.class);
}

View File

@ -32,7 +32,6 @@ package org.sleuthkit.autopsy.examples;
import java.util.List;
import org.apache.log4j.Logger;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.casemodule.services.Services;
@ -50,8 +49,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* Sample DataSource-level ingest module that doesn't do much at all.
* Just exists to show basic idea of these modules
*/
class SampleDataSourceIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleDataSource {
public class SampleDataSourceIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleDataSource {
/* Data Source modules operate on a disk or set of logical files. They
* are passed in teh data source refernce and query it for things they want.
*/
@ -84,23 +82,19 @@ import org.sleuthkit.datamodel.TskCoreException;
} catch (TskCoreException ex) {
Logger log = Logger.getLogger(SampleDataSourceIngestModule.class);
log.fatal("Error retrieving files from database: " + ex.getLocalizedMessage());
return;
}
}
@Override
public void init(IngestModuleInit initContext) throws IngestModuleException {
// do nothing
}
@Override
public void complete() {
// do nothing
}
@Override
public void stop() {
// do nothing
}
@Override

View File

@ -1,33 +1,32 @@
/*
* Sample module in the public domain. Feel free to use this as a template
* for your modules.
*
* Contact: Brian Carrier [carrier <at> sleuthkit [dot] org]
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
* Sample module in the public domain. Feel free to use this as a template
* for your modules.
*
* Contact: Brian Carrier [carrier <at> sleuthkit [dot] org]
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.sleuthkit.autopsy.examples;
import org.apache.log4j.Logger;
@ -44,23 +43,25 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData;
/**
* This is a sample and simple module. It is a file-level ingest module, meaning
* that it will get called on each file in the disk image / logical file set.
* It does a stupid calculation of the number of null bytes in the beginning of the
* file in order to show the basic flow.
*
* Autopsy has been hard coded to ignore this module based on the it's package name.
* IngestModuleLoader will not load things from the org.sleuthkit.autopsy.examples package.
* Either change the package or the loading code to make this module actually run.
* This is a sample and simple module. It is a file-level ingest module, meaning
* that it will get called on each file in the disk image / logical file set. It
* does a stupid calculation of the number of null bytes in the beginning of the
* file in order to show the basic flow.
*
* Autopsy has been hard coded to ignore this module based on the it's package
* name. IngestModuleLoader will not load things from the
* org.sleuthkit.autopsy.examples package. Either change the package or the
* loading code to make this module actually run.
*/
class SampleFileIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile {
public class SampleFileIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile {
private int attrId = -1;
private static SampleFileIngestModule defaultInstance = null;
// Private to ensure Singleton status
private SampleFileIngestModule() {
}
// File-level ingest modules are currently singleton -- this is required
public static synchronized SampleFileIngestModule getDefault() {
//defaultInstance is a private static class variable
@ -70,7 +71,6 @@ import org.sleuthkit.datamodel.TskData;
return defaultInstance;
}
@Override
public void init(IngestModuleInit initContext) throws IngestModuleException {
/* For this demo, we are going to make a private attribute to post our
@ -82,7 +82,7 @@ import org.sleuthkit.datamodel.TskData;
*/
Case case1 = Case.getCurrentCase();
SleuthkitCase sleuthkitCase = case1.getSleuthkitCase();
// see if the type already exists in the blackboard.
try {
attrId = sleuthkitCase.getAttrTypeID("ATTR_SAMPLE");
@ -97,21 +97,21 @@ import org.sleuthkit.datamodel.TskData;
}
}
}
@Override
public ProcessResult process(PipelineContext<IngestModuleAbstractFile> pipelineContext, AbstractFile abstractFile) {
// skip non-files
if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) ||
(abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) {
if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)
|| (abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) {
return ProcessResult.OK;
}
// skip NSRL / known files
if (abstractFile.getKnown() == TskData.FileKnown.KNOWN) {
return ProcessResult.OK;
}
/* Do a non-sensical calculation of the number of 0x00 bytes
* in the first 1024-bytes of the file. This is for demo
* purposes only.
@ -125,7 +125,7 @@ import org.sleuthkit.datamodel.TskData;
count++;
}
}
if (attrId != -1) {
// Make an attribute using the ID for the private type that we previously created.
BlackboardAttribute attr = new BlackboardAttribute(attrId, getName(), count);
@ -136,30 +136,27 @@ import org.sleuthkit.datamodel.TskData;
BlackboardArtifact art = abstractFile.getGenInfoArtifact();
art.addAttribute(attr);
}
return ProcessResult.OK;
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
return ProcessResult.ERROR;
}
}
@Override
public void complete() {
}
@Override
public void stop() {
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public String getName() {
return "SampleFileIngestModule";
@ -172,7 +169,6 @@ import org.sleuthkit.datamodel.TskData;
@Override
public boolean hasBackgroundJobsRunning() {
// we're single threaded...
return false;
}
}

View File

@ -204,7 +204,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
/**
* Inner class to put the separator inside the combo box.
*/
static class ComboBoxRenderer extends JLabel implements ListCellRenderer {
static class ComboBoxRenderer extends JLabel implements ListCellRenderer<String> {
JSeparator separator;
@ -215,8 +215,8 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value.toString();
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value;
if (SEPARATOR.equals(str)) {
return separator;
}

View File

@ -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>
@ -181,8 +181,9 @@
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JComboBox(this.timeZones.toArray());"/>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JComboBox&lt;&gt;(this.timeZones.toArray(new String[this.timeZones.size()]))"/>
<AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">

View File

@ -102,7 +102,7 @@ class DateSearchPanel extends javax.swing.JPanel {
return modifiedCheckBox;
}
JComboBox getTimeZoneComboBox() {
JComboBox<String> getTimeZoneComboBox() {
return timeZoneComboBox;
}
@ -132,7 +132,7 @@ class DateSearchPanel extends javax.swing.JPanel {
jLabel1 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
dateCheckBox = new javax.swing.JCheckBox();
timeZoneComboBox = new JComboBox(this.timeZones.toArray());
timeZoneComboBox = new JComboBox<>(this.timeZones.toArray(new String[this.timeZones.size()]));
timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());
jLabel3 = new javax.swing.JLabel();
dateFromTextField = new JFormattedTextField(this.dateFormat);
@ -359,7 +359,7 @@ class DateSearchPanel extends javax.swing.JPanel {
private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JComboBox timeZoneComboBox;
private javax.swing.JComboBox<String> timeZoneComboBox;
// End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) {

View File

@ -51,7 +51,7 @@ class SizeSearchFilter extends AbstractFileSearchFilter<SizeSearchPanel> {
return "size " + operator + " " + size;
}
private String compareComboBoxToOperator(JComboBox compare) {
private String compareComboBoxToOperator(JComboBox<String> compare) {
String compareSize = compare.getSelectedItem().toString();
if (compareSize.equals("equal to")) {

View File

@ -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>
@ -79,16 +79,13 @@
<SubComponents>
<Component class="javax.swing.JComboBox" name="sizeUnitComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="5">
<StringItem index="0" value="Byte(s)"/>
<StringItem index="1" value="KB"/>
<StringItem index="2" value="MB"/>
<StringItem index="3" value="GB"/>
<StringItem index="4" value="TB"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Byte(s)&quot;, &quot;KB&quot;, &quot;MB&quot;, &quot;GB&quot;, &quot;TB&quot; })" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JFormattedTextField" name="sizeTextField">
<Properties>
@ -105,14 +102,13 @@
</Component>
<Component class="javax.swing.JComboBox" name="sizeCompareComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="equal to"/>
<StringItem index="1" value="greater than"/>
<StringItem index="2" value="less than"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;equal to&quot;, &quot;greater than&quot;, &quot;less than&quot; })" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JCheckBox" name="sizeCheckBox">
<Properties>

View File

@ -67,7 +67,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeCheckBox;
}
JComboBox getSizeCompareComboBox() {
JComboBox<String> getSizeCompareComboBox() {
return sizeCompareComboBox;
}
@ -75,7 +75,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeTextField;
}
JComboBox getSizeUnitComboBox() {
JComboBox<String> getSizeUnitComboBox() {
return sizeUnitComboBox;
}
@ -93,9 +93,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = new javax.swing.JMenuItem();
selectAllMenuItem = new javax.swing.JMenuItem();
sizeUnitComboBox = new javax.swing.JComboBox();
sizeUnitComboBox = new javax.swing.JComboBox<String>();
sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance());
sizeCompareComboBox = new javax.swing.JComboBox();
sizeCompareComboBox = new javax.swing.JComboBox<String>();
sizeCheckBox = new javax.swing.JCheckBox();
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.cutMenuItem.text")); // NOI18N
@ -110,7 +110,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem);
sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" }));
sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" }));
sizeTextField.setValue(0);
sizeTextField.addMouseListener(new java.awt.event.MouseAdapter() {
@ -119,7 +119,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
}
});
sizeCompareComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "equal to", "greater than", "less than" }));
sizeCompareComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "equal to", "greater than", "less than" }));
sizeCheckBox.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.sizeCheckBox.text")); // NOI18N
@ -157,9 +157,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JCheckBox sizeCheckBox;
private javax.swing.JComboBox sizeCompareComboBox;
private javax.swing.JComboBox<String> sizeCompareComboBox;
private javax.swing.JFormattedTextField sizeTextField;
private javax.swing.JComboBox sizeUnitComboBox;
private javax.swing.JComboBox<String> sizeUnitComboBox;
// End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,7 +20,6 @@
package org.sleuthkit.autopsy.ingest;
import java.util.List;
import org.openide.util.NbBundle;
import org.sleuthkit.datamodel.Content;
@ -93,6 +92,7 @@ class DataSourceTask<T extends IngestModuleAbstract> {
if (getClass() != obj.getClass()) {
return false;
}
@SuppressWarnings("unchecked")
final DataSourceTask<T> other = (DataSourceTask<T>) obj;
if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) {
return false;

View File

@ -343,7 +343,7 @@ public class IngestManager {
* @param pipelineContext ingest context used to ingest parent of the file
* to be scheduled
*/
void scheduleFile(AbstractFile file, PipelineContext pipelineContext) {
void scheduleFile(AbstractFile file, PipelineContext<IngestModuleAbstractFile> pipelineContext) {
scheduler.getFileScheduler().schedule(file, pipelineContext);
}

View File

@ -100,11 +100,11 @@
<EmptySpace min="-2" pref="101" max="-2" attributes="0"/>
<Component id="totalMessagesNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="totalMessagesNameVal" pref="9" max="32767" attributes="0"/>
<Component id="totalMessagesNameVal" pref="24" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="totalUniqueMessagesNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="totalUniqueMessagesNameVal" pref="8" max="32767" attributes="0"/>
<Component id="totalUniqueMessagesNameVal" pref="24" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
</Group>
</Group>
@ -132,11 +132,8 @@
</Component>
<Component class="javax.swing.JComboBox" name="sortByComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="Time"/>
<StringItem index="1" value="Priority"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Time&quot;, &quot;Priority&quot; })" type="code"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagePanel.sortByComboBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -146,7 +143,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sortByComboBoxActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="totalMessagesNameLabel">

View File

@ -149,7 +149,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
sortByLabel.setText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByLabel.text")); // NOI18N
sortByComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Time", "Priority" }));
sortByComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Time", "Priority" }));
sortByComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByComboBox.toolTipText")); // NOI18N
sortByComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -177,11 +177,11 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
.addGap(101, 101, 101)
.addComponent(totalMessagesNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE)
.addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addGap(22, 22, 22)
.addComponent(totalUniqueMessagesNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 8, Short.MAX_VALUE)
.addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addGap(22, 22, 22))
);
controlPanelLayout.setVerticalGroup(
@ -224,7 +224,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
private javax.swing.JPanel controlPanel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable messageTable;
private javax.swing.JComboBox sortByComboBox;
private javax.swing.JComboBox<String> sortByComboBox;
private javax.swing.JLabel sortByLabel;
private javax.swing.JLabel totalMessagesNameLabel;
private javax.swing.JLabel totalMessagesNameVal;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2013 Basis Technology Corp.
* Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -369,8 +369,8 @@ class IngestScheduler {
* @param originalContext original content schedule context that was used
* to schedule the parent origin content, with the modules, settings, etc.
*/
synchronized void schedule(AbstractFile file, PipelineContext originalContext) {
DataSourceTask originalTask = originalContext.getDataSourceTask();
synchronized void schedule(AbstractFile file, PipelineContext<IngestModuleAbstractFile> originalContext) {
DataSourceTask<IngestModuleAbstractFile> originalTask = originalContext.getDataSourceTask();
//skip if task contains no modules
if (originalTask.getModules().isEmpty()) {
@ -393,7 +393,6 @@ class IngestScheduler {
* @param context context to schedule, with scheduled task containing content to process and modules
*/
synchronized void schedule(DataSourceTask<IngestModuleAbstractFile> task) {
//skip if task contains no modules
if (task.getModules().isEmpty()) {
return;

View File

@ -136,7 +136,7 @@ public class IngestServices {
* @param file file to be scheduled
* @param pipelineContext the ingest context for the file ingest pipeline
*/
public void scheduleFile(AbstractFile file, PipelineContext pipelineContext) {
public void scheduleFile(AbstractFile file, PipelineContext<IngestModuleAbstractFile> pipelineContext) {
logger.log(Level.INFO, "Scheduling file: " + file.getName());
manager.scheduleFile(file, pipelineContext);
}

View File

@ -65,6 +65,7 @@ public class PipelineContext <T extends IngestModuleAbstract> {
if (getClass() != obj.getClass()) {
return false;
}
@SuppressWarnings("unchecked")
final PipelineContext<T> other = (PipelineContext<T>) obj;
if (!Objects.equals(this.task, other.task)) {

View File

@ -85,6 +85,10 @@
<Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="2"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ARTIFACT_TYPE&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>

View File

@ -36,7 +36,6 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -45,12 +44,12 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TskCoreException;
public class ArtifactSelectionDialog extends javax.swing.JDialog {
private ArtifactModel model;
private ArtifactRenderer renderer;
private Map<BlackboardArtifact.ARTIFACT_TYPE, Boolean> artifactStates;
private List<BlackboardArtifact.ARTIFACT_TYPE> artifacts;
/**
* Creates new form ArtifactSelectionDialog
*/
@ -60,27 +59,27 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
populateList();
customInit();
}
/**
* Populate the list of artifacts with all important artifacts.
*/
private void populateList() {
try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList();
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();
artifacts.removeAll(doNotReport);
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();
artifacts.removeAll(doNotReport);
Collections.sort(artifacts, new Comparator<BlackboardArtifact.ARTIFACT_TYPE>() {
@Override
public int compare(ARTIFACT_TYPE o1, ARTIFACT_TYPE o2) {
return o1.getDisplayName().compareTo(o2.getDisplayName());
}
});
artifactStates = new EnumMap<>(BlackboardArtifact.ARTIFACT_TYPE.class);
artifactStates = new EnumMap<>(BlackboardArtifact.ARTIFACT_TYPE.class);
for (BlackboardArtifact.ARTIFACT_TYPE type : artifacts) {
artifactStates.put(type, Boolean.TRUE);
}
@ -88,26 +87,26 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
Logger.getLogger(ArtifactSelectionDialog.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage());
}
}
private void customInit() {
model = new ArtifactModel();
renderer = new ArtifactRenderer();
artifactList.setModel(model);
artifactList.setCellRenderer(renderer);
artifactList.setVisibleRowCount(-1);
artifactList.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint());
BlackboardArtifact.ARTIFACT_TYPE type = (BlackboardArtifact.ARTIFACT_TYPE) model.getElementAt(index);
BlackboardArtifact.ARTIFACT_TYPE type = model.getElementAt(index);
artifactStates.put(type, !artifactStates.get(type));
list.repaint();
}
});
}
/**
* Display this dialog, and return the selected artifacts.
*/
@ -120,7 +119,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
// set the location of the popUp Window on the center of the screen
setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
this.setVisible(true);
return artifactStates;
}
@ -135,7 +134,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private void initComponents() {
artifactScrollPane = new javax.swing.JScrollPane();
artifactList = new javax.swing.JList();
artifactList = new javax.swing.JList<>();
okButton = new javax.swing.JButton();
titleLabel = new javax.swing.JLabel();
selectAllButton = new javax.swing.JButton();
@ -229,9 +228,8 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
}
artifactList.repaint();
}//GEN-LAST:event_deselectAllButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JList artifactList;
private javax.swing.JList<ARTIFACT_TYPE> artifactList;
private javax.swing.JScrollPane artifactScrollPane;
private javax.swing.JButton deselectAllButton;
private javax.swing.JButton okButton;
@ -239,7 +237,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private javax.swing.JLabel titleLabel;
// End of variables declaration//GEN-END:variables
private class ArtifactModel implements ListModel {
private class ArtifactModel implements ListModel<ARTIFACT_TYPE> {
@Override
public int getSize() {
@ -247,7 +245,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
}
@Override
public Object getElementAt(int index) {
public ARTIFACT_TYPE getElementAt(int index) {
return artifacts.get(index);
}
@ -259,11 +257,11 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
public void removeListDataListener(ListDataListener l) {
}
}
private class ArtifactRenderer extends JCheckBox implements ListCellRenderer<BlackboardArtifact.ARTIFACT_TYPE> {
@Override
public Component getListCellRendererComponent(JList list, BlackboardArtifact.ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus) {
public Component getListCellRendererComponent(JList<? extends ARTIFACT_TYPE> list, ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) {
setEnabled(list.isEnabled());
setSelected(artifactStates.get(value));
@ -274,6 +272,6 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
return this;
}
return new JLabel();
}
}
}
}

View File

@ -345,7 +345,7 @@ import org.sleuthkit.datamodel.TskData;
return absFiles;
} catch (TskCoreException ex) {
// TODO
return Collections.EMPTY_LIST;
return Collections.<AbstractFile>emptyList();
}
}
@ -515,7 +515,6 @@ import org.sleuthkit.datamodel.TskData;
module.addRow(rowData);
}
}
// Finish up this data type
for (TableReportModule module : tableModules) {
tableProgress.get(module).increment();

View File

@ -123,16 +123,14 @@
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.AbstractListModel&lt;ReportModule&gt;() {&#xa; ReportModule[] modules = {};&#xa; public int getSize() { return modules.length; }&#xa; public ReportModule getElementAt(int i) { return modules[i]; }&#xa;}" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ReportModule&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>

View File

@ -93,7 +93,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
modulesJList.getSelectionModel().addListSelectionListener(this);
modulesJList.setCellRenderer(new ModuleCellRenderer());
modulesJList.setListData(modules.toArray());
modulesJList.setListData(modules.toArray(new ReportModule[modules.size()]));
selectedIndex = 0;
modulesJList.setSelectedIndex(selectedIndex);
}
@ -162,7 +162,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane = new javax.swing.JScrollPane();
descriptionTextPane = new javax.swing.JTextPane();
modulesScrollPane = new javax.swing.JScrollPane();
modulesJList = new javax.swing.JList();
modulesJList = new javax.swing.JList<>();
setPreferredSize(new java.awt.Dimension(650, 250));
@ -188,10 +188,10 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane.setViewportView(descriptionTextPane);
modulesJList.setBackground(new java.awt.Color(240, 240, 240));
modulesJList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
modulesJList.setModel(new javax.swing.AbstractListModel<ReportModule>() {
ReportModule[] modules = {};
public int getSize() { return modules.length; }
public ReportModule getElementAt(int i) { return modules[i]; }
});
modulesScrollPane.setViewportView(modulesJList);
@ -229,7 +229,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private javax.swing.JPanel configurationPanel;
private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JTextPane descriptionTextPane;
private javax.swing.JList modulesJList;
private javax.swing.JList<ReportModule> modulesJList;
private javax.swing.JScrollPane modulesScrollPane;
private javax.swing.JLabel reportModulesLabel;
// End of variables declaration//GEN-END:variables
@ -264,7 +264,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private class ModuleCellRenderer extends JRadioButton implements ListCellRenderer<ReportModule> {
@Override
public Component getListCellRendererComponent(JList list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) {
public Component getListCellRendererComponent(JList<? extends ReportModule> list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) {
this.setText(value.getName());
this.setEnabled(true);
this.setSelected(isSelected);

View File

@ -143,6 +143,10 @@
<Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="1"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -45,16 +45,14 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
final class ReportVisualPanel2 extends JPanel {
final class ReportVisualPanel2 extends JPanel {
private ReportWizardPanel2 wizPanel;
private Map<String, Boolean> tagStates = new LinkedHashMap<>();
private List<String> tags = new ArrayList<>();
ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(new JFrame(), true);
private Map<ARTIFACT_TYPE, Boolean> artifactStates = new EnumMap<>(ARTIFACT_TYPE.class);
private List<ARTIFACT_TYPE> artifacts = new ArrayList<>();
private TagsListModel tagsModel;
private TagsListRenderer tagsRenderer;
@ -71,58 +69,57 @@ import org.sleuthkit.datamodel.TskCoreException;
allResultsRadioButton.setSelected(true);
this.wizPanel = wizPanel;
}
// Initialize the list of Tags
private void initTags() {
List<TagName> tagNamesInUse;
try {
tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse();
}
catch (TskCoreException ex) {
Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
} catch (TskCoreException ex) {
Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
return;
}
for(TagName tagName : tagNamesInUse) {
}
for (TagName tagName : tagNamesInUse) {
tagStates.put(tagName.getDisplayName(), Boolean.FALSE);
}
tags.addAll(tagStates.keySet());
tagsModel = new TagsListModel();
tagsRenderer = new TagsListRenderer();
tagsList.setModel(tagsModel);
tagsList.setCellRenderer(tagsRenderer);
tagsList.setVisibleRowCount(-1);
// Add the ability to enable and disable Tag checkboxes to the list
tagsList.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint());
String value = (String) tagsModel.getElementAt(index);
String value = tagsModel.getElementAt(index);
tagStates.put(value, !tagStates.get(value));
list.repaint();
updateFinishButton();
}
});
});
}
// Initialize the list of Artifacts
private void initArtifactTypes() {
try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList();
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();
artifacts.removeAll(doNotReport);
artifactStates = new EnumMap<>(ARTIFACT_TYPE.class);
for (ARTIFACT_TYPE type : artifacts) {
for (ARTIFACT_TYPE type : artifacts) {
artifactStates.put(type, Boolean.TRUE);
}
} catch (TskCoreException ex) {
@ -134,41 +131,41 @@ import org.sleuthkit.datamodel.TskCoreException;
public String getName() {
return NbBundle.getMessage(this.getClass(), "ReportVisualPanel2.getName.text");
}
/**
* @return the enabled/disabled state of all Artifacts
*/
Map<ARTIFACT_TYPE, Boolean> getArtifactStates() {
return artifactStates;
}
/**
* @return the enabled/disabled state of all Tags
*/
Map<String, Boolean> getTagStates() {
return tagStates;
}
private boolean areTagsSelected() {
boolean result = false;
for (Entry<String, Boolean> entry: tagStates.entrySet()) {
for (Entry<String, Boolean> entry : tagStates.entrySet()) {
if (entry.getValue()) {
result = true;
}
}
return result;
}
private boolean areArtifactsSelected() {
boolean result = false;
for (Entry<ARTIFACT_TYPE, Boolean> entry: artifactStates.entrySet()) {
for (Entry<ARTIFACT_TYPE, Boolean> entry : artifactStates.entrySet()) {
if (entry.getValue()) {
result = true;
}
}
return result;
}
private void updateFinishButton() {
if (taggedResultsRadioButton.isSelected()) {
wizPanel.setFinish(areTagsSelected());
@ -176,14 +173,14 @@ import org.sleuthkit.datamodel.TskCoreException;
wizPanel.setFinish(areArtifactsSelected());
}
}
/**
* @return true if the Tags radio button is selected, false otherwise
*/
boolean isTaggedResultsRadioButtonSelected() {
return taggedResultsRadioButton.isSelected();
}
/**
* 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
@ -199,7 +196,7 @@ import org.sleuthkit.datamodel.TskCoreException;
selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton();
tagsScrollPane = new javax.swing.JScrollPane();
tagsList = new javax.swing.JList();
tagsList = new javax.swing.JList<>();
advancedButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(650, 250));
@ -316,7 +313,6 @@ import org.sleuthkit.datamodel.TskCoreException;
artifactStates = dialog.display();
wizPanel.setFinish(areArtifactsSelected());
}//GEN-LAST:event_advancedButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton advancedButton;
private javax.swing.JRadioButton allResultsRadioButton;
@ -325,11 +321,11 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.ButtonGroup optionsButtonGroup;
private javax.swing.JButton selectAllButton;
private javax.swing.JRadioButton taggedResultsRadioButton;
private javax.swing.JList tagsList;
private javax.swing.JList<String> tagsList;
private javax.swing.JScrollPane tagsScrollPane;
// End of variables declaration//GEN-END:variables
private class TagsListModel implements ListModel {
private class TagsListModel implements ListModel<String> {
@Override
public int getSize() {
@ -337,7 +333,7 @@ import org.sleuthkit.datamodel.TskCoreException;
}
@Override
public Object getElementAt(int index) {
public String getElementAt(int index) {
return tags.get(index);
}
@ -349,12 +345,12 @@ import org.sleuthkit.datamodel.TskCoreException;
public void removeListDataListener(ListDataListener l) {
}
}
// Render the Tags as JCheckboxes
private class TagsListRenderer extends JCheckBox implements ListCellRenderer {
private class TagsListRenderer extends JCheckBox implements ListCellRenderer<String> {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) {
setEnabled(list.isEnabled());
setSelected(tagStates.get(value.toString()));
@ -365,6 +361,6 @@ import org.sleuthkit.datamodel.TskCoreException;
return this;
}
return new JLabel();
}
}
}
}

View File

@ -64,11 +64,13 @@ public final class ReportWizardAction extends CallableSystemAction implements P
* When the wizard is finished, create a ReportGenerator with the wizard information,
* and start all necessary reports.
*/
@SuppressWarnings("unchecked")
public static void doReportWizard() {
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
wiz.setTitleFormat(new MessageFormat("{0} {1}"));
wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title"));
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
@SuppressWarnings("unchecked")
ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"),
(Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"),
(Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates"));

View File

@ -63,16 +63,14 @@
<SubComponents>
<Component class="javax.swing.JList" name="optionsList">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.AbstractListModel&lt;FileReportDataTypes&gt;() {&#xa; FileReportDataTypes[] types = { };&#xa; public int getSize() { return types.length; }&#xa; public FileReportDataTypes getElementAt(int i) { return types[i]; }&#xa;}" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;FileReportDataTypes&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>

View File

@ -42,7 +42,7 @@ import javax.swing.event.ListDataListener;
class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private List<FileReportDataTypes> options;
private Map<FileReportDataTypes, Boolean> optionStates = new EnumMap<>(FileReportDataTypes.class);
private ListModel model;
private ListModel<FileReportDataTypes> model;
private ReportWizardFileOptionsPanel wizPanel;
@ -80,7 +80,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint());
FileReportDataTypes value = (FileReportDataTypes) model.getElementAt(index);
FileReportDataTypes value = model.getElementAt(index);
optionStates.put(value, !optionStates.get(value));
list.repaint();
boolean anySelected = anySelected();
@ -134,15 +134,15 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
optionsList = new javax.swing.JList();
optionsList = new javax.swing.JList<>();
selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
optionsList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
optionsList.setModel(new javax.swing.AbstractListModel<FileReportDataTypes>() {
FileReportDataTypes[] types = { };
public int getSize() { return types.length; }
public FileReportDataTypes getElementAt(int i) { return types[i]; }
});
jScrollPane1.setViewportView(optionsList);
@ -219,11 +219,11 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private javax.swing.JButton deselectAllButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JList optionsList;
private javax.swing.JList<FileReportDataTypes> optionsList;
private javax.swing.JButton selectAllButton;
// End of variables declaration//GEN-END:variables
private class OptionsListModel implements ListModel {
private class OptionsListModel implements ListModel<FileReportDataTypes> {
@Override
public int getSize() {
@ -231,7 +231,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
}
@Override
public Object getElementAt(int index) {
public FileReportDataTypes getElementAt(int index) {
return options.get(index);
}
@ -247,12 +247,12 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
/**
* Render each item in the list to be a selectable check box.
*/
private class OptionsListRenderer extends JCheckBox implements ListCellRenderer {
private class OptionsListRenderer extends JCheckBox implements ListCellRenderer<FileReportDataTypes> {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
public Component getListCellRendererComponent(JList<? extends FileReportDataTypes> list, FileReportDataTypes value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) {
FileReportDataTypes col = (FileReportDataTypes) value;
FileReportDataTypes col = value;
setEnabled(list.isEnabled());
setSelected(optionStates.get(col));
setFont(list.getFont());

View File

@ -49,6 +49,7 @@ import org.openide.util.NbPreferences;
private WizardDescriptor.Panel<WizardDescriptor>[] fileConfigPanels;
private String[] fileConfigIndex;
@SuppressWarnings({"rawtypes", "unchecked"})
ReportWizardIterator() {
firstPanel = new ReportWizardPanel1();
tableConfigPanel = new ReportWizardPanel2();

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.exifparser/3
OpenIDE-Module-Implementation-Version: 9
OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/exifparser/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/exifparser/Bundle.properties

View File

@ -20,7 +20,7 @@
<compile-dependency/>
<run-dependency>
<release-version>9</release-version>
<specification-version>7.0</specification-version>
<specification-version>7.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.hashdatabase/3
OpenIDE-Module-Implementation-Version: 9
OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/hashdatabase/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/hashdatabase/Bundle.properties

View File

@ -78,7 +78,7 @@
<compile-dependency/>
<run-dependency>
<release-version>9</release-version>
<specification-version>7.0</specification-version>
<specification-version>7.1</specification-version>
</run-dependency>
</dependency>
<dependency>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -50,8 +50,7 @@ class HashDbPanelSearchAction extends CallableSystemAction {
if(evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())){
setEnabled(evt.getNewValue() != null);
}
}
}
});
}

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.keywordsearch/5
OpenIDE-Module-Implementation-Version: 9
OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Install: org/sleuthkit/autopsy/keywordsearch/Installer.class
OpenIDE-Module-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties

View File

@ -96,7 +96,7 @@
<compile-dependency/>
<run-dependency>
<release-version>9</release-version>
<specification-version>7.0</specification-version>
<specification-version>7.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>

View File

@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
private static final int SINGLE_READ_CHARS = 1024;
private static final int EXTRA_CHARS = 128; //for whitespace
private static final char[] TEXT_CHUNK_BUF = new char[MAX_EXTR_TEXT_CHARS];
private static final int MAX_SIZE = 50000000;
private KeywordSearchIngestModule module;
private Ingester ingester;
private AbstractFile sourceFile;
@ -217,7 +218,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
public boolean isSupported(AbstractFile file, String detectedFormat) {
if (detectedFormat == null) {
return false;
} else if (WEB_MIME_TYPES.contains(detectedFormat)) {
} else if (WEB_MIME_TYPES.contains(detectedFormat) && file.getSize() <= MAX_SIZE) {
return true;
} else {
return false;

View File

@ -279,6 +279,10 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
else if (detectedFormat.contains("video/")
&& !detectedFormat.equals("video/x-flv")) {
return false;
} else if (detectedFormat.contains("application/x-font-ttf")) {
// Tika currently has a bug in the ttf parser in fontbox.
// It will throw an out of memory exception
return false;
}

View File

@ -263,5 +263,4 @@ Server.solrServerNoPortException.msg=Indexing server could not bind to port {0},
KeywordSearchIngestModule.doInBackGround.displayName=Keyword Search
KeywordSearchIngestModule.doInBackGround.finalizeMsg= - Finalizing
KeywordSearchIngestModule.doInBackGround.pendingMsg= (Pending)
KeywordSearchIngestModule.doInBackGround.cancelMsg= (Cancelling...)
KeywordSearchIngestModule.doInBackGround.cancelMsg= (Cancelling...)

View File

@ -31,6 +31,8 @@ class ContentHit {
private AbstractFile content;
private int chunkID = 0;
private String snippet = "";
private boolean snippetSet = false;
ContentHit(AbstractFile content) {
this.content = content;
@ -57,6 +59,19 @@ class ContentHit {
return chunkID != 0;
}
void setSnippet(String snippet) {
this.snippet = snippet;
this.snippetSet = true;
}
String getSnippet() {
return snippet;
}
boolean hasSnippet() {
return snippetSet;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {

View File

@ -145,15 +145,14 @@
</Container>
<Component class="javax.swing.JComboBox" name="sourceComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.DefaultComboBoxModel&lt;MarkupSource&gt;()" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;MarkupSource&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="hitLabel">
<Properties>

View File

@ -73,14 +73,17 @@ class ExtractedContentPanel extends javax.swing.JPanel {
public ViewFactory getViewFactory() {
return new HTMLFactory() {
@Override
public View create(Element e) {
View v = super.create(e);
if (v instanceof InlineView) {
return new InlineView(e) {
@Override
public int getBreakWeight(int axis, float pos, float len) {
return GoodBreakWeight;
}
@Override
public View breakView(int axis, int p0, float pos, float len) {
if (axis == View.X_AXIS) {
checkPainter();
@ -95,6 +98,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
};
} else if (v instanceof ParagraphView) {
return new ParagraphView(e) {
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
if (r == null) {
r = new SizeRequirements();
@ -169,7 +173,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
public boolean getScrollableTracksViewportWidth() {
return (getSize().width < 400);
}};
sourceComboBox = new javax.swing.JComboBox();
sourceComboBox = new javax.swing.JComboBox<>();
hitLabel = new javax.swing.JLabel();
hitCountLabel = new javax.swing.JLabel();
hitOfLabel = new javax.swing.JLabel();
@ -202,7 +206,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
extractedTextPane.setPreferredSize(new java.awt.Dimension(700, 400));
jScrollPane1.setViewportView(extractedTextPane);
sourceComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
sourceComboBox.setModel(new javax.swing.DefaultComboBoxModel<MarkupSource>());
hitLabel.setText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitLabel.text")); // NOI18N
hitLabel.setToolTipText(org.openide.util.NbBundle.getMessage(ExtractedContentPanel.class, "ExtractedContentPanel.hitLabel.toolTipText")); // NOI18N
@ -306,7 +310,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
.addComponent(pagePreviousButton)
.addGap(0, 0, 0)
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(sourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
);
@ -332,7 +336,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pagePreviousButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
@ -355,7 +359,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
private javax.swing.JLabel pagesLabel;
private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JComboBox sourceComboBox;
private javax.swing.JComboBox<MarkupSource> sourceComboBox;
// End of variables declaration//GEN-END:variables
void refreshCurrentMarkup() {
@ -374,7 +378,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
setPanelText(null, false);
for (MarkupSource ms : sources) {
sourceComboBox.<String>addItem(ms);
sourceComboBox.addItem(ms);
}
if (!sources.isEmpty()) {
@ -391,7 +395,7 @@ class ExtractedContentPanel extends javax.swing.JPanel {
public List<MarkupSource> getSources() {
ArrayList<MarkupSource> sources = new ArrayList<>();
for (int i = 0; i < sourceComboBox.getItemCount(); ++i) {
sources.add((MarkupSource) sourceComboBox.getItemAt(i));
sources.add(sourceComboBox.getItemAt(i));
}
return sources;
}

View File

@ -20,7 +20,7 @@
<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">
<Group type="102" alignment="0" attributes="0">
@ -34,14 +34,15 @@
<Component id="informationSeparator" min="-2" pref="309" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="skipNSRLCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="showSnippetsCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="filesIndexedLabel" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="141" max="-2" attributes="0"/>
<Component id="filesIndexedValue" min="-2" pref="104" max="-2" attributes="0"/>
</Group>
<Component id="skipNSRLCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="frequencyLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
@ -74,7 +75,9 @@
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="skipNSRLCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="showSnippetsCB" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="frequencyLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="timeRadioButton1" min="-2" max="-2" attributes="0"/>
@ -99,7 +102,7 @@
<Component id="chunksLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chunksValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
<EmptySpace pref="116" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -211,5 +214,12 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="showSnippetsCB">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchConfigurationPanel2.showSnippetsCB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -44,6 +44,7 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
private void activateWidgets() {
skipNSRLCheckBox.setSelected(KeywordSearchSettings.getSkipKnown());
showSnippetsCB.setSelected(KeywordSearchSettings.getShowSnippets());
boolean enable = !IngestManager.getDefault().isIngestRunning()
&& !IngestManager.getDefault().isModuleRunning(KeywordSearchIngestModule.getDefault());
skipNSRLCheckBox.setEnabled(enable);
@ -96,6 +97,7 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
timeRadioButton2 = new javax.swing.JRadioButton();
timeRadioButton3 = new javax.swing.JRadioButton();
timeRadioButton4 = new javax.swing.JRadioButton();
showSnippetsCB = new javax.swing.JCheckBox();
skipNSRLCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.text")); // NOI18N
skipNSRLCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.toolTipText")); // NOI18N
@ -127,6 +129,8 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
timeRadioButton4.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton4.text_1")); // NOI18N
timeRadioButton4.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText")); // NOI18N
showSnippetsCB.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.showSnippetsCB.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -145,11 +149,12 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(skipNSRLCheckBox)
.addComponent(showSnippetsCB)
.addComponent(filesIndexedLabel)
.addGroup(layout.createSequentialGroup()
.addGap(141, 141, 141)
.addComponent(filesIndexedValue, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(skipNSRLCheckBox)
.addComponent(frequencyLabel)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
@ -173,7 +178,9 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
.addComponent(settingsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(skipNSRLCheckBox)
.addGap(13, 13, 13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(showSnippetsCB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(frequencyLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(timeRadioButton1)
@ -195,7 +202,7 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(chunksLabel)
.addComponent(chunksValLabel))
.addContainerGap(30, Short.MAX_VALUE))
.addContainerGap(116, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@ -209,6 +216,7 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
private javax.swing.JSeparator informationSeparator;
private javax.swing.JLabel settingsLabel;
private javax.swing.JSeparator settingsSeparator;
private javax.swing.JCheckBox showSnippetsCB;
private javax.swing.JCheckBox skipNSRLCheckBox;
private javax.swing.ButtonGroup timeGroup;
private javax.swing.JRadioButton timeRadioButton1;
@ -221,6 +229,7 @@ class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel implements Opt
public void store() {
KeywordSearchSettings.setSkipKnown(skipNSRLCheckBox.isSelected());
KeywordSearchSettings.setUpdateFrequency(getSelectedTimeValue());
KeywordSearchSettings.setShowSnippets(showSnippetsCB.isSelected());
}
@Override

View File

@ -249,7 +249,6 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
logger.log(Level.WARNING, "Could not perform the query. ", ex);
return false;
}
final Map<AbstractFile, Integer> hitContents = ContentHit.flattenResults(tcqRes);
//get listname
String listName = "";
@ -261,47 +260,13 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
final boolean literal_query = tcq.isEscaped();
int resID = 0;
for (final AbstractFile f : hitContents.keySet()) {
final int previewChunk = hitContents.get(f);
for(ContentHit chit : tcqRes.get(tcq.getQueryString())) {
AbstractFile f = chit.getContent();
//get unique match result files
Map<String, Object> resMap = new LinkedHashMap<>();
try {
String snippet;
String snippetQuery = null;
if (literal_query) {
snippetQuery = tcq.getEscapedQueryString();
} else {
//in regex, to generate the preview snippet
//just pick any term that hit that file (since we are compressing result view)
String hit = null;
//find the first hit for this file
for (String hitKey : tcqRes.keySet()) {
List<ContentHit> chits = tcqRes.get(hitKey);
for (ContentHit chit : chits) {
if (chit.getContent().equals(f)) {
hit = hitKey;
break;
}
}
if (hit != null) {
break;
}
}
if (hit != null) {
snippetQuery = KeywordSearchUtil.escapeLuceneQuery(hit);
}
}
if (snippetQuery != null) {
snippet = LuceneQuery.querySnippet(snippetQuery, f.getId(), previewChunk, !literal_query, true);
setCommonProperty(resMap, CommonPropertyTypes.CONTEXT, snippet);
}
} catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Could not perform the snippet query. ", ex);
return false;
if (chit.hasSnippet()) {
setCommonProperty(resMap, CommonPropertyTypes.CONTEXT, chit.getSnippet());
}
if (f.getType() == TSK_DB_FILES_TYPE_ENUM.FS) {
@ -309,7 +274,7 @@ class KeywordSearchResultFactory extends ChildFactory<KeyValueQuery> {
}
final String highlightQueryEscaped = getHighlightQuery(tcq, literal_query, tcqRes, f);
tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped, tcq, previewChunk, tcqRes));
tempList.add(new KeyValueQueryContent(f.getName(), resMap, ++resID, f, highlightQueryEscaped, tcq, chit.getChunkId(), tcqRes));
}
// Add all the nodes to toPopulate at once. Minimizes node creation

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012 Basis Technology Corp.
* Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -16,8 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.keywordsearch;
import java.util.ArrayList;
@ -25,7 +23,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
@ -33,9 +30,9 @@ import org.sleuthkit.autopsy.coreutils.StringExtract;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.autopsy.keywordsearch.KeywordSearchIngestModule.UpdateFrequency;
//This file contains constants and settings for KeywordSearch
class KeywordSearchSettings {
public static final String MODULE_NAME = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.moduleName.text");
static final String PROPERTIES_OPTIONS = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.properties_options.text", MODULE_NAME);
static final String PROPERTIES_NSRL = NbBundle.getMessage(KeywordSearchSettings.class, "KeywordSearchSettings.propertiesNSRL.text", MODULE_NAME);
@ -43,99 +40,102 @@ class KeywordSearchSettings {
private static boolean skipKnown = true;
private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName());
private static UpdateFrequency UpdateFreq = UpdateFrequency.DEFAULT;
private static List<StringExtract.StringExtractUnicodeTable.SCRIPT> stringExtractScripts = new ArrayList<StringExtract.StringExtractUnicodeTable.SCRIPT>();
private static Map<String,String> stringExtractOptions = new HashMap<String,String>();
private static List<StringExtract.StringExtractUnicodeTable.SCRIPT> stringExtractScripts = new ArrayList<>();
private static Map<String, String> stringExtractOptions = new HashMap<>();
/**
* Gets the update Frequency from KeywordSearch_Options.properties
* Gets the update Frequency from KeywordSearch_Options.properties
*
* @return KeywordSearchIngestModule's update frequency
*/
static UpdateFrequency getUpdateFrequency(){
if(ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency") != null){
*/
static UpdateFrequency getUpdateFrequency() {
if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency") != null) {
return UpdateFrequency.valueOf(ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency"));
}
//if it failed, return the default/last known value
logger.log(Level.WARNING, "Could not read property for UpdateFrequency, returning backup value.");
return UpdateFrequency.DEFAULT;
}
/**
* Sets the update frequency and writes to KeywordSearch_Options.properties
*
* @param freq Sets KeywordSearchIngestModule to this value.
*/
static void setUpdateFrequency(UpdateFrequency freq){
static void setUpdateFrequency(UpdateFrequency freq) {
ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, "UpdateFrequency", freq.name());
UpdateFreq = freq;
}
/**
* Sets whether or not to skip adding known good files to the search during index.
* @param skip
* Sets whether or not to skip adding known good files to the search during
* index.
*
* @param skip
*/
static void setSkipKnown(boolean skip) {
ModuleSettings.setConfigSetting(PROPERTIES_NSRL, "SkipKnown", Boolean.toString(skip));
skipKnown = skip;
}
/**
* Gets the setting for whether or not this ingest is skipping adding known good files to the index.
/**
* Gets the setting for whether or not this ingest is skipping adding known
* good files to the index.
*
* @return skip setting
*/
static boolean getSkipKnown() {
if(ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown") != null){
if (ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown") != null) {
return Boolean.parseBoolean(ModuleSettings.getConfigSetting(PROPERTIES_NSRL, "SkipKnown"));
}
//if it fails, return the default/last known value
logger.log(Level.WARNING, "Could not read property for SkipKnown, returning backup value.");
return skipKnown;
//if it fails, return the default/last known value
logger.log(Level.WARNING, "Could not read property for SkipKnown, returning backup value.");
return skipKnown;
}
/**
* Sets what scripts to extract during ingest
*
* @param scripts List of scripts to extract
*/
static void setStringExtractScripts(List<StringExtract.StringExtractUnicodeTable.SCRIPT> scripts) {
stringExtractScripts.clear();
stringExtractScripts.addAll(scripts);
//Disabling scripts that weren't selected
for(String s : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).keySet()){
if (! scripts.contains(StringExtract.StringExtractUnicodeTable.SCRIPT.valueOf(s))){
for (String s : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).keySet()) {
if (!scripts.contains(StringExtract.StringExtractUnicodeTable.SCRIPT.valueOf(s))) {
ModuleSettings.setConfigSetting(PROPERTIES_SCRIPTS, s, "false");
}
}
//Writing and enabling selected scripts
for(StringExtract.StringExtractUnicodeTable.SCRIPT s : stringExtractScripts){
for (StringExtract.StringExtractUnicodeTable.SCRIPT s : stringExtractScripts) {
ModuleSettings.setConfigSetting(PROPERTIES_SCRIPTS, s.name(), "true");
}
}
/**
/**
* Set / override string extract option
*
* @param key option name to set
* @param val option value to set
*/
static void setStringExtractOption(String key, String val) {
static void setStringExtractOption(String key, String val) {
stringExtractOptions.put(key, val);
ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, key, val);
}
/**
/**
* gets the currently set scripts to use
*
* @return the list of currently used script
*/
static List<SCRIPT> getStringExtractScripts(){
if(ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS) != null && !ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).isEmpty()){
List<SCRIPT> scripts = new ArrayList<SCRIPT>();
for(Map.Entry<String,String> kvp : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).entrySet()){
if(kvp.getValue().equals("true")){
static List<SCRIPT> getStringExtractScripts() {
if (ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS) != null && !ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).isEmpty()) {
List<SCRIPT> scripts = new ArrayList<>();
for (Map.Entry<String, String> kvp : ModuleSettings.getConfigSettings(PROPERTIES_SCRIPTS).entrySet()) {
if (kvp.getValue().equals("true")) {
scripts.add(SCRIPT.valueOf(kvp.getKey()));
}
}
@ -143,74 +143,71 @@ class KeywordSearchSettings {
}
//if it failed, try to return the built-in list maintained by the singleton.
logger.log(Level.WARNING, "Could not read properties for extracting scripts, returning backup values.");
return new ArrayList<SCRIPT>(stringExtractScripts);
return new ArrayList<>(stringExtractScripts);
}
/**
* get string extract option for the key
*
* @param key option name
* @return option string value, or empty string if the option is not set
*/
static String getStringExtractOption(String key) {
if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key) != null){
if (ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key) != null) {
return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, key);
}
else {
logger.log(Level.WARNING, "Could not read property for key "+ key + ", returning backup value.");
} else {
logger.log(Level.WARNING, "Could not read property for key {0}, returning backup value.", key);
return stringExtractOptions.get(key);
}
}
/**
* get the map of string extract options.
*
* @return Map<String,String> of extract options.
*/
static Map<String,String> getStringExtractOptions(){
Map<String,String> settings = ModuleSettings.getConfigSettings(PROPERTIES_OPTIONS);
if(settings == null){
Map<String,String> settingsv2 = new HashMap<String,String>();
logger.log(Level.WARNING, "Could not read properties for " + PROPERTIES_OPTIONS + ".properties, returning backup values");
static Map<String, String> getStringExtractOptions() {
Map<String, String> settings = ModuleSettings.getConfigSettings(PROPERTIES_OPTIONS);
if (settings == null) {
Map<String, String> settingsv2 = new HashMap<>();
logger.log(Level.WARNING, "Could not read properties for {0}.properties, returning backup values", PROPERTIES_OPTIONS);
settingsv2.putAll(stringExtractOptions);
return settingsv2;
}
else {
} else {
return settings;
}
}
/**
* Sets the default values of the KeywordSearch properties files if none already exist.
* Sets the default values of the KeywordSearch properties files if none
* already exist.
*/
static void setDefaults(){
static void setDefaults() {
logger.log(Level.INFO, "Detecting default settings.");
//setting default NSRL
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_NSRL, "SkipKnown")){
logger.log(Level.INFO, "No configuration for NSRL found, generating default...");
KeywordSearchSettings.setSkipKnown(true);
}
//setting default Update Frequency
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, "UpdateFrequency")){
logger.log(Level.INFO, "No configuration for Update Frequency found, generating default...");
KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT);
}
//setting default Extract UTF8
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())){
logger.log(Level.INFO, "No configuration for UTF8 found, generating default...");
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString(), Boolean.TRUE.toString());
}
//setting default NSRL
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_NSRL, "SkipKnown")) {
logger.log(Level.INFO, "No configuration for NSRL found, generating default...");
KeywordSearchSettings.setSkipKnown(true);
}
//setting default Update Frequency
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, "UpdateFrequency")) {
logger.log(Level.INFO, "No configuration for Update Frequency found, generating default...");
KeywordSearchSettings.setUpdateFrequency(UpdateFrequency.DEFAULT);
}
//setting default Extract UTF8
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString())) {
logger.log(Level.INFO, "No configuration for UTF8 found, generating default...");
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF8.toString(), Boolean.TRUE.toString());
}
//setting default Extract UTF16
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())){
logger.log(Level.INFO, "No configuration for UTF16 found, generating defaults...");
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString(), Boolean.TRUE.toString());
}
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_OPTIONS, AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString())) {
logger.log(Level.INFO, "No configuration for UTF16 found, generating defaults...");
KeywordSearchSettings.setStringExtractOption(AbstractFileExtract.ExtractOptions.EXTRACT_UTF16.toString(), Boolean.TRUE.toString());
}
//setting default Latin-1 Script
if(!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name())){
logger.log(Level.INFO, "No configuration for Scripts found, generating defaults...");
ModuleSettings.setConfigSetting(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name(), Boolean.toString(true));
if (!ModuleSettings.settingExists(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name())) {
logger.log(Level.INFO, "No configuration for Scripts found, generating defaults...");
ModuleSettings.setConfigSetting(KeywordSearchSettings.PROPERTIES_SCRIPTS, SCRIPT.LATIN_1.name(), Boolean.toString(true));
}
}
}

View File

@ -20,9 +20,12 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.apache.solr.client.solrj.SolrQuery;
@ -31,6 +34,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.TermsResponse.Term;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.EscapeUtil;
import org.sleuthkit.autopsy.coreutils.Version;
@ -129,7 +133,8 @@ class LuceneQuery implements KeywordSearchQuery {
public Map<String, List<ContentHit>> performQuery() throws NoOpenCoreException {
Map<String, List<ContentHit>> results = new HashMap<String, List<ContentHit>>();
//in case of single term literal query there is only 1 term
results.put(keywordString, performLuceneQuery());
boolean showSnippets = KeywordSearchSettings.getShowSnippets();
results.put(keywordString, performLuceneQuery(showSnippets));
return results;
}
@ -192,33 +197,13 @@ class LuceneQuery implements KeywordSearchQuery {
* @return list of ContentHit objects
* @throws NoOpenCoreException
*/
private List<ContentHit> performLuceneQuery() throws NoOpenCoreException {
List<ContentHit> matches = new ArrayList<ContentHit>();
private List<ContentHit> performLuceneQuery(boolean snippets) throws NoOpenCoreException {
List<ContentHit> matches = new ArrayList<>();
boolean allMatchesFetched = false;
final Server solrServer = KeywordSearch.getServer();
SolrQuery q = new SolrQuery();
q.setShowDebugInfo(DEBUG); //debug
//set query, force quotes/grouping around all literal queries
final String groupedQuery = KeywordSearchUtil.quoteQuery(keywordStringEscaped);
String theQueryStr = groupedQuery;
if (field != null) {
//use the optional field
StringBuilder sb = new StringBuilder();
sb.append(field).append(":").append(groupedQuery);
theQueryStr = sb.toString();
}
q.setQuery(theQueryStr);
q.setRows(MAX_RESULTS);
q.setFields(Server.Schema.ID.toString());
for (KeywordQueryFilter filter : filters) {
q.addFilterQuery(filter.toString());
}
SolrQuery q = createAndConfigureSolrQuery(snippets);
for (int start = 0; !allMatchesFetched; start = start + MAX_RESULTS) {
q.setStart(start);
@ -226,53 +211,29 @@ class LuceneQuery implements KeywordSearchQuery {
try {
QueryResponse response = solrServer.query(q, METHOD.POST);
SolrDocumentList resultList = response.getResults();
long results = resultList.getNumFound();
allMatchesFetched = start + MAX_RESULTS >= results;
SleuthkitCase sc = null;
Map<String, Map<String, List<String>>> highlightResponse = response.getHighlighting();
Set<SolrDocument> solrDocumentsWithMatches = filterDuplicateSolrDocuments(resultList);
allMatchesFetched = start + MAX_RESULTS >= resultList.getNumFound();
SleuthkitCase sleuthkitCase;
try {
sc = Case.getCurrentCase().getSleuthkitCase();
sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
} catch (IllegalStateException ex) {
//no case open, must be just closed
return matches;
}
for (SolrDocument resultDoc : resultList) {
final String resultID = (String) resultDoc.getFieldValue(Server.Schema.ID.toString());
final int sepIndex = resultID.indexOf(Server.ID_CHUNK_SEP);
if (sepIndex != -1) {
//file chunk result
final long fileID = Long.parseLong(resultID.substring(0, sepIndex));
final int chunkId = Integer.parseInt(resultID.substring(sepIndex + 1));
//logger.log(Level.INFO, "file id: " + fileID + ", chunkID: " + chunkId);
try {
AbstractFile resultAbstractFile = sc.getAbstractFileById(fileID);
matches.add(new ContentHit(resultAbstractFile, chunkId));
} catch (TskException ex) {
logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex);
//something wrong with case/db
return matches;
}
} else {
final long fileID = Long.parseLong(resultID);
try {
AbstractFile resultAbstractFile = sc.getAbstractFileById(fileID);
matches.add(new ContentHit(resultAbstractFile));
} catch (TskException ex) {
logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex);
//something wrong with case/db
return matches;
}
for (SolrDocument resultDoc : solrDocumentsWithMatches) {
ContentHit contentHit;
try {
contentHit = createContentHitFromQueryResults(resultDoc, highlightResponse, snippets, sleuthkitCase);
} catch (TskException ex) {
return matches;
}
matches.add(contentHit);
}
} catch (NoOpenCoreException ex) {
logger.log(Level.WARNING, "Error executing Lucene Solr Query: " + keywordString, ex);
throw ex;
@ -283,6 +244,109 @@ class LuceneQuery implements KeywordSearchQuery {
}
return matches;
}
private SolrQuery createAndConfigureSolrQuery(boolean snippets) {
SolrQuery q = new SolrQuery();
q.setShowDebugInfo(DEBUG); //debug
//set query, force quotes/grouping around all literal queries
final String groupedQuery = KeywordSearchUtil.quoteQuery(keywordStringEscaped);
String theQueryStr = groupedQuery;
if (field != null) {
//use the optional field
StringBuilder sb = new StringBuilder();
sb.append(field).append(":").append(groupedQuery);
theQueryStr = sb.toString();
}
q.setQuery(theQueryStr);
q.setRows(MAX_RESULTS);
if (snippets) {
q.setFields(Server.Schema.ID.toString(), Server.Schema.CONTENT.toString());
} else {
q.setFields(Server.Schema.ID.toString());
}
for (KeywordQueryFilter filter : filters) {
q.addFilterQuery(filter.toString());
}
if (snippets) {
q.addHighlightField(Server.Schema.CONTENT.toString());
//q.setHighlightSimplePre("&laquo;"); //original highlighter only
//q.setHighlightSimplePost("&raquo;"); //original highlighter only
q.setHighlightSnippets(1);
q.setHighlightFragsize(SNIPPET_LENGTH);
//tune the highlighter
q.setParam("hl.useFastVectorHighlighter", "on"); //fast highlighter scales better than standard one
q.setParam("hl.tag.pre", "&laquo;"); //makes sense for FastVectorHighlighter only
q.setParam("hl.tag.post", "&laquo;"); //makes sense for FastVectorHighlighter only
q.setParam("hl.fragListBuilder", "simple"); //makes sense for FastVectorHighlighter only
//Solr bug if fragCharSize is smaller than Query string, StringIndexOutOfBoundsException is thrown.
q.setParam("hl.fragCharSize", Integer.toString(theQueryStr.length())); //makes sense for FastVectorHighlighter only
//docs says makes sense for the original Highlighter only, but not really
//analyze all content SLOW! consider lowering
q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED);
}
return q;
}
private Set<SolrDocument> filterDuplicateSolrDocuments(SolrDocumentList resultList) {
Set<SolrDocument> solrDocumentsWithMatches = new TreeSet<>(new SolrDocumentComparator());
solrDocumentsWithMatches.addAll(resultList);
return solrDocumentsWithMatches;
}
private ContentHit createContentHitFromQueryResults(SolrDocument resultDoc, Map<String, Map<String, List<String>>> highlightResponse, boolean snippets, SleuthkitCase sc) throws TskException {
ContentHit chit;
final String resultID = resultDoc.getFieldValue(Server.Schema.ID.toString()).toString();
final int sepIndex = resultID.indexOf(Server.ID_CHUNK_SEP);
String snippet = "";
if (snippets) {
List<String> snippetList = highlightResponse.get(resultID).get(Server.Schema.CONTENT.toString());
// list is null if there wasn't a snippet
if (snippetList != null) {
snippet = EscapeUtil.unEscapeHtml(snippetList.get(0)).trim();
}
}
if (sepIndex != -1) {
//file chunk result
final long fileID = Long.parseLong(resultID.substring(0, sepIndex));
final int chunkId = Integer.parseInt(resultID.substring(sepIndex + 1));
//logger.log(Level.INFO, "file id: " + fileID + ", chunkID: " + chunkId);
try {
AbstractFile resultAbstractFile = sc.getAbstractFileById(fileID);
chit = new ContentHit(resultAbstractFile, chunkId);
if (snippet.isEmpty() == false) {
chit.setSnippet(snippet);
}
} catch (TskException ex) {
logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex);
//something wrong with case/db
throw ex;
}
} else {
final long fileID = Long.parseLong(resultID);
try {
AbstractFile resultAbstractFile = sc.getAbstractFileById(fileID);
chit = new ContentHit(resultAbstractFile);
if (snippet.isEmpty() == false) {
chit.setSnippet(snippet);
}
} catch (TskException ex) {
logger.log(Level.WARNING, "Could not get the AbstractFile for keyword hit, ", ex);
//something wrong with case/db
throw ex;
}
}
return chit;
}
/**
* return snippet preview context
@ -393,4 +457,28 @@ class LuceneQuery implements KeywordSearchQuery {
return "";
}
}
/**
* Compares SolrDocuments based on their ID's. Two SolrDocuments with
* different chunk numbers are considered equal.
*/
private class SolrDocumentComparator implements Comparator<SolrDocument> {
@Override
public int compare(SolrDocument left, SolrDocument right) {
String idName = Server.Schema.ID.toString();
String leftID = left.getFieldValue(idName).toString();
int index = leftID.indexOf(Server.ID_CHUNK_SEP);
if (index != -1) {
leftID = leftID.substring(0, index);
}
String rightID = right.getFieldValue(idName).toString();
index = rightID.indexOf(Server.ID_CHUNK_SEP);
if (index != -1) {
rightID = rightID.substring(0, index);
}
return leftID.compareTo(rightID);
}
}
}

View File

@ -0,0 +1,5 @@
- Tika has a bug in the true type font parser included in fontbox. It should
be fixed in the next release of Tika (1.5, or a 1.4 point release). Until then
we bypass Tika when it detects a type of "application/x-font-ttf". See
AbstractFileTikaTextExtract::isSupported. This should be removed when we
update Tika.

View File

@ -2,9 +2,30 @@
---------------- VERSION 3.0.9 --------------
Bug Fixes:
- Regular expression keyword search works on file names.
- Fixed thunderbird parser for subject and dates
- Fixed errors in hex viewer
Improvements:
- Enhanced reporting on keyword search module errors
- Updated SQLite to 3.8.0
- More lazy loading to help performance with big folders and sets of files
- Times can be displayed in local time or GMT
- New "EnCase-style" report that lists files and metadata in tab delimited file
- Changed report wizard to make one report at a time
- report improvements (only regnerate if data exists)
- more error messages if recent activity module fails
- more error checking in recent activity module and don't bail as quickly
- Cleanup of recent activity module
- better handle if ingest module throws exception during init()
- do not run ingest if any module faile to init()
- Added FILE_DONE event to ingest manager
- Added search engine parsers for linkedin, twitter, and facebook
- HTML text is better formatted
- Report generation performance
- HTML parser is skipped for files > 50MB.
- Removed xdock definitions -> some claim this helps with memory problems
---------------- VERSION 3.0.8 --------------

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.recentactivity/5
OpenIDE-Module-Implementation-Version: 9
OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/recentactivity/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/recentactivity/Bundle.properties
OpenIDE-Module-Requires:

Some files were not shown because too many files have changed in this diff Show More