From 542870ebde1483357529a2cb34d7753d56fedad1 Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Mon, 5 Mar 2012 12:54:45 -0500 Subject: [PATCH 1/8] Remove tabs from TopComponents --- CoreComponents/nbproject/project.xml | 16 +++ .../DataResultTopComponent.java | 2 + .../autopsy/corecomponents/Installer.java | 15 ++- .../corecomponents/NoTabsTabDisplayerUI.java | 105 ++++++++++++++++++ 4 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 CoreComponents/src/org/sleuthkit/autopsy/corecomponents/NoTabsTabDisplayerUI.java diff --git a/CoreComponents/nbproject/project.xml b/CoreComponents/nbproject/project.xml index 93290ef079..d96264e3f9 100644 --- a/CoreComponents/nbproject/project.xml +++ b/CoreComponents/nbproject/project.xml @@ -50,6 +50,22 @@ 1.9.1 + + org.netbeans.swing.plaf + + + + 1.20.2 + + + + org.netbeans.swing.tabcontrol + + + + 1.25.1 + + org.openide.awt diff --git a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultTopComponent.java b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultTopComponent.java index 45214c0506..83d82d9f44 100644 --- a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultTopComponent.java +++ b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultTopComponent.java @@ -59,6 +59,8 @@ public final class DataResultTopComponent extends TopComponent implements DataRe setTitle(title); // set the title this.isMain = isMain; putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.valueOf(isMain)); // set option to close compoment in GUI + putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED, true); + putClientProperty(TopComponent.PROP_DRAGGING_DISABLED, true); this.dataResultTabbedPanel.addChangeListener(this); } diff --git a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/Installer.java index 9a4b783f2a..ba50b370cc 100644 --- a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -18,13 +18,16 @@ */ package org.sleuthkit.autopsy.corecomponents; +import java.awt.Color; +import java.awt.Insets; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.BorderFactory; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.UnsupportedLookAndFeelException; +import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI; import org.openide.modules.ModuleInstall; -import org.openide.util.Exceptions; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; @@ -47,7 +50,11 @@ public class Installer extends ModuleInstall { } }); - //setupLAF(); + Logger logger = Logger.getLogger(Installer.class.getName()); + //setupLAF(); + //UIManager.put("ViewTabDisplayerUI", "org.sleuthkit.autopsy.corecomponents.NoTabsTabDisplayerUI"); + //UIManager.put(DefaultTabbedContainerUI.KEY_VIEW_CONTENT_BORDER, BorderFactory.createEmptyBorder()); + //UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0)); } private void setupLAF() { @@ -56,8 +63,8 @@ public class Installer extends ModuleInstall { //UIManager.put("nimbusBase", new Color()); //UIManager.put("nimbusBlueGrey", new Color()); //UIManager.put("control", new Color()); - - + + Logger logger = Logger.getLogger(Installer.class.getName()); //use Nimbus if available for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) { diff --git a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/NoTabsTabDisplayerUI.java b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/NoTabsTabDisplayerUI.java new file mode 100644 index 0000000000..1db15285d8 --- /dev/null +++ b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/NoTabsTabDisplayerUI.java @@ -0,0 +1,105 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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.awt.Dimension; +import java.awt.Point; +import java.awt.Polygon; +import java.awt.Rectangle; +import javax.swing.DefaultSingleSelectionModel; +import javax.swing.JComponent; +import javax.swing.SingleSelectionModel; +import javax.swing.plaf.ComponentUI; +import org.netbeans.swing.tabcontrol.TabDisplayer; +import org.netbeans.swing.tabcontrol.TabDisplayerUI; + +/** + * + * @author dfickling + */ +public class NoTabsTabDisplayerUI extends TabDisplayerUI { + + /** Creates a new instance of NoTabsTabDisplayerUI */ + public NoTabsTabDisplayerUI(TabDisplayer displayer) { + super(displayer); + } + + public static ComponentUI createUI(JComponent jc) { + assert jc instanceof TabDisplayer; + return new NoTabsTabDisplayerUI((TabDisplayer) jc); + } + + private static final int[] PTS = new int[] { 0, 0, 0 }; + public Polygon getExactTabIndication(int i) { + //Should never be called + return new Polygon(PTS, PTS, PTS.length); + } + + public Polygon getInsertTabIndication(int i) { + return new Polygon(PTS, PTS, PTS.length); + } + + public int tabForCoordinate(Point point) { + return -1; + } + + public Rectangle getTabRect(int i, Rectangle rectangle) { + return new Rectangle(0,0,0,0); + } + + protected SingleSelectionModel createSelectionModel() { + return new DefaultSingleSelectionModel(); + } + + public java.lang.String getCommandAtPoint(Point point) { + return null; + } + + public int dropIndexOfPoint(Point point) { + return -1; + } + + public void registerShortcuts(javax.swing.JComponent jComponent) { + //do nothing + } + + public void unregisterShortcuts(javax.swing.JComponent jComponent) { + //do nothing + } + + protected void requestAttention(int i) { + //do nothing + } + + protected void cancelRequestAttention(int i) { + //do nothing + } + + public Dimension getPreferredSize(javax.swing.JComponent c) { + return new Dimension(0, 0); + } + + public Dimension getMinimumSize(javax.swing.JComponent c) { + return new Dimension(0, 0); + } + + public Dimension getMaximumSize(javax.swing.JComponent c) { + return new Dimension(0, 0); + } +} From ad5afc03c7f0c76f21c994860ee7fe1736d6ee2a Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Mon, 5 Mar 2012 12:55:13 -0500 Subject: [PATCH 2/8] Show dialog to user when attempting to search with no files indexed --- .../keywordsearch/AbstractKeywordSearchPerformer.java | 4 ++++ .../autopsy/keywordsearch/KeywordSearchListsViewerPanel.java | 5 +---- .../sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java | 2 -- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java index 853bd77107..ba1bf07589 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java @@ -73,6 +73,10 @@ abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel impleme @Override public void search() { + if (filesIndexed == 0) { + KeywordSearchUtil.displayDialog("Keyword Search Error", "No files are indexed, please index an image before searching", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); + return; + } KeywordSearchQueryManager man = null; if (isMultiwordQuery()) { final List keywords = getQueryList(); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java index cf6d49bce2..69d9455c3a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java @@ -307,10 +307,7 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { private void searchAction(ActionEvent e) { - if (filesIndexed == 0) - return; - - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { search(); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java index c849ed640e..4670e73ff6 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java @@ -216,8 +216,6 @@ public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{ }// //GEN-END:initComponents private void searchBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchBoxActionPerformed - if (filesIndexed == 0) - return; getRootPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { search(); From 4647c1e2fb33c7e031578d84b1b0e89de77f17d8 Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Mon, 5 Mar 2012 16:15:01 -0500 Subject: [PATCH 3/8] TSK-341: dir tree creates columns based onnly on attributes of first artifact Now creating columns based on first 100 artifacts. Will revisit after demo --- .../corecomponents/DataResultViewerTable.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java index b5577cc5c3..4043c1d767 100644 --- a/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java +++ b/CoreComponents/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java @@ -186,6 +186,28 @@ public class DataResultViewerTable extends AbstractDataResultViewer { return properties; } + + Set propertiesAcc = new LinkedHashSet(); + /** + * Gets regular Bean property set properties from all children and, recursively, subchildren of Node. + * Note: won't work out the box for lazy load - you need to set all children props for the parent by hand + * @param parent Node with at least one child to get properties from + */ + private void getAllChildPropertyHeadersRec(Node parent, int rows) { + for(int i = 0; i < Math.min(rows, parent.getChildren().getNodesCount()); i++){ + Node child = parent.getChildren().getNodeAt(i); + for (PropertySet ps : child.getPropertySets()) { + //if (ps.getName().equals(Sheet.PROPERTIES)) { + //return ps.getProperties(); + final Property [] props = ps.getProperties(); + final int propsNum = props.length; + for (int j = 0; j< propsNum; ++j) + propertiesAcc.add(props[j]); + //} + } + getAllChildPropertyHeadersRec(child, rows); + } + } @Override public void setNode(Node selectedNode) { @@ -215,7 +237,11 @@ public class DataResultViewerTable extends AbstractDataResultViewer { OutlineView ov = ((OutlineView) this.tableScrollPanel); - List tempProps = new ArrayList(Arrays.asList(getAllChildPropertyHeaders(selectedNode))); + propertiesAcc.clear(); + Logger logger = Logger.getLogger(DataResultViewerTable.class.getName()); + this.getAllChildPropertyHeadersRec(selectedNode, 100); + List tempProps = new ArrayList(Arrays.asList(propertiesAcc.toArray(new Property[propertiesAcc.size()]))); + //List tempProps = new ArrayList(Arrays.asList(getAllChildPropertyHeaders(selectedNode))); if(tempProps.size() > 0) tempProps.remove(0); @@ -374,6 +400,8 @@ public class DataResultViewerTable extends AbstractDataResultViewer { // Get maximum width of column data for (int i = 0; i < table.length; i++) { + if(index >= table[i].length) + continue; String test = table[i][index].toString(); colWidth = Math.max(colWidth, metrics.stringWidth(test)); } From 7750c00ab94878d5332e95b33ff7d544fb1fdc06 Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Mon, 5 Mar 2012 16:48:54 -0500 Subject: [PATCH 4/8] TSK-387: Record number of docs in index --- .../KeywordSearchListsViewerPanel.form | 10 +-- .../KeywordSearchListsViewerPanel.java | 77 +++++++++++-------- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form index 79d91c5f44..e3c3f5fb3a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form @@ -26,8 +26,8 @@ - - + + @@ -36,7 +36,7 @@ - + @@ -125,13 +125,13 @@ - + - + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java index 69d9455c3a..7201b3d03f 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java @@ -80,7 +80,6 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { } private void customizeComponents() { - ingestLabel.setVisible(false); listsTable.setTableHeader(null); listsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //customize column witdhs @@ -106,6 +105,24 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { } } + KeywordSearch.changeSupport.addPropertyChangeListener(KeywordSearch.NUM_FILES_CHANGE_EVT, + new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String changed = evt.getPropertyName(); + Object oldValue = evt.getOldValue(); + Object newValue = evt.getNewValue(); + + if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) { + int newFilesIndexed = ((Integer) newValue).intValue(); + if(!ingestRunning){ + ingestIndexLabel.setText("Files Indexed: " + newFilesIndexed); + } + } + } + }); + loader = KeywordSearchListsXML.getCurrent(); loader.addPropertyChangeListener(new PropertyChangeListener() { @@ -157,9 +174,9 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { }; if(IngestManager.getDefault().isServiceRunning(KeywordSearchIngestService.getDefault())) - initIngest(0); + initIngest(true); else - initIngest(1); + initIngest(false); IngestManager.addPropertyChangeListener(new PropertyChangeListener() { @@ -169,13 +186,13 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { Object oldValue = evt.getOldValue(); if(changed.equals(IngestManager.SERVICE_COMPLETED_EVT) && ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) - initIngest(1); + initIngest(false); else if(changed.equals(IngestManager.SERVICE_STARTED_EVT) && ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) - initIngest(0); + initIngest(true); else if(changed.equals(IngestManager.SERVICE_STOPPED_EVT) && ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) - initIngest(1); + initIngest(false); } }); @@ -187,27 +204,25 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { * case 0: ingest running * case 1: ingest not running */ - private void initIngest(int running) { + private void initIngest(boolean running) { ActionListener[] current = searchAddButton.getActionListeners(); - for(int i = 0; i < current.length; i++) { - if(current[i].equals(ingestListener) || current[i].equals(searchListener)) + for (int i = 0; i < current.length; i++) { + if (current[i].equals(ingestListener) || current[i].equals(searchListener)) { searchAddButton.removeActionListener(current[i]); + } } - switch (running) { - case 0: - ingestRunning = true; - searchAddButton.setText("Add to Ingest"); - searchAddButton.addActionListener(ingestListener); - listsTableModel.resync(); - ingestLabel.setVisible(true); - break; - case 1: - ingestRunning = false; - searchAddButton.setText("Search"); - searchAddButton.addActionListener(searchListener); - listsTableModel.resync(); - ingestLabel.setVisible(false); - break; + if (running) { + ingestRunning = true; + searchAddButton.setText("Add to Ingest"); + searchAddButton.addActionListener(ingestListener); + listsTableModel.resync(); + ingestIndexLabel.setText("Ingest is ongoing. Results will appear as the index is populated."); + } else { + ingestRunning = false; + searchAddButton.setText("Search"); + searchAddButton.addActionListener(searchListener); + listsTableModel.resync(); + ingestIndexLabel.setText("Files Indexed: " + filesIndexed); } } @@ -227,7 +242,7 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { keywordsTable = new javax.swing.JTable(); manageListsButton = new javax.swing.JButton(); searchAddButton = new javax.swing.JButton(); - ingestLabel = new javax.swing.JLabel(); + ingestIndexLabel = new javax.swing.JLabel(); leftPane.setMinimumSize(new java.awt.Dimension(150, 23)); @@ -257,8 +272,8 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { searchAddButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N - ingestLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N - ingestLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.ingestLabel.text")); // NOI18N + ingestIndexLabel.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N + ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -273,15 +288,15 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { .addContainerGap()) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(ingestLabel) - .addContainerGap(109, Short.MAX_VALUE)) + .addComponent(ingestIndexLabel) + .addContainerGap(327, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) - .addComponent(ingestLabel) + .addComponent(ingestIndexLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(manageListsButton) @@ -295,7 +310,7 @@ class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { }//GEN-LAST:event_manageListsButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel ingestLabel; + private javax.swing.JLabel ingestIndexLabel; private javax.swing.JSplitPane jSplitPane1; private javax.swing.JTable keywordsTable; private javax.swing.JScrollPane leftPane; From c937702b509e9a585627da4e7413ebaf6f67cfbf Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Tue, 6 Mar 2012 13:25:57 -0500 Subject: [PATCH 5/8] TSK-343: Directory tree artifact viewer : specialization for keyword search results TSK-374: Tiers of document types in tree --- .../autopsy/images/file-filter-icon.png | Bin 0 -> 888 bytes ...ilter-icon.png => keyword-search-icon.png} | Bin .../datamodel/AbstractContentChildren.java | 8 +- .../autopsy/datamodel/AutopsyItemVisitor.java | 12 + .../datamodel/DisplayableItemNodeVisitor.java | 17 ++ .../datamodel/ExtractedContentChildren.java | 1 + .../datamodel/FileSearchFilterChildren.java | 4 +- .../datamodel/FileSearchFilterNode.java | 6 +- .../autopsy/datamodel/KeywordHits.java | 208 ++++++++++++++++++ .../autopsy/datamodel/SearchFilters.java | 62 +++++- .../datamodel/SearchFiltersChildren.java | 18 +- .../autopsy/datamodel/SearchFiltersNode.java | 35 ++- .../directorytree/DataResultFilterNode.java | 12 + .../DirectoryTreeFilterChildren.java | 6 +- .../DirectoryTreeTopComponent.java | 2 + 15 files changed, 371 insertions(+), 20 deletions(-) create mode 100644 CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/file-filter-icon.png rename CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/{filter-icon.png => keyword-search-icon.png} (100%) create mode 100644 DataModel/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/file-filter-icon.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/file-filter-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7897850f320ecada2f31c6fe702274d1f285deef GIT binary patch literal 888 zcmV-;1Bd*HP)1JCosl`TW*R-o9^+g|fv81GpTw=lt2$mLzsh4O=vz8D@ zYfPKERSfW=NfTmyFof_xc+%*WMiV;~3tg%dC}s9CJ3F48X;Q<oux;Q!h*36mSyP#k_y`LKO zZ@xSKWQg^pwa*!=oF zbGhKMXh1?VAR?-A)aVRVvV$!who_V>N+lbbrs0;YSRb95h<~3tya9;5w%5FqCqR$@ znuxF_ARu$75<%QY*b&Y{CvmZ8W03%#oSuwNj~v+mgxdF*SptNqdV~NWl>jt1*@35- zg=CdY9XL=_1q%h$8c2N^|KareK49;$AwzH5V=h@P3(*K(^@?$1noNLNA&0i;8Y1Bc zWdpMhxb-oO@YC5|AMj59kfF5pm^W7)79>DW7ZLPa7a$U#UN2#1jKd}m3i$$ldnj8& zXVdYkU-bEap1wgte5u6}=5q;>wb1rAEJw|B^o819tZg8l}cv z=I?j%%oo%1+NTZ(@N$)d{Vy;A%W%lZ%Zsp5V^i_Wxeqn~#cgk!H*Q-@SQiSFC-{K& z8iqp&4YplG<&rKha%*HP9iKfvuh|u1OS2ZTYyRmn0#wBG;nl4ihuakDNbr1EU42mK z@9TSRdV2b%2k7eR+B!TuyrAnk%auj^@sESdEepRcKEhl!kL}e04!uJ65e{SK$C=Sn zBO_y(Oy&mGg9U>@*3i)KMlzY~XlZF_O(YUcu~_VhLZQH{TnYAIIcQiFMwWz9gZ(?Hn3>Cus{QUjL^Zx_9f+-*ZQVFd9 O0000 { @Override public AbstractNode visit(SearchFilters sf) { - return new SearchFiltersNode(sf.getSleuthkitCase()); + return new SearchFiltersNode(sf.getSleuthkitCase(), true); } @Override public AbstractNode visit(RecentFiles rf) { return new RecentFilesNode(rf.getSleuthkitCase()); } + + @Override + public AbstractNode visit(KeywordHits kh) { + return kh.new KeywordHitsRootNode(); + } @Override protected AbstractNode defaultVisit(AutopsyVisitableItem di) { diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/AutopsyItemVisitor.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/AutopsyItemVisitor.java index ab79b51931..1880f335d2 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/AutopsyItemVisitor.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/AutopsyItemVisitor.java @@ -27,8 +27,10 @@ public interface AutopsyItemVisitor { T visit(ExtractedContent ec); T visit(SearchFilters sf); T visit(SearchFilters.FileSearchFilter fsf); + T visit(SearchFilters.DocumentFilter df); T visit(RecentFiles rf); T visit(RecentFiles.RecentFilesFilter rff); + T visit(KeywordHits kf); static abstract public class Default implements AutopsyItemVisitor { @@ -49,6 +51,11 @@ public interface AutopsyItemVisitor { return defaultVisit(fsf); } + @Override + public T visit(SearchFilters.DocumentFilter df) { + return defaultVisit(df); + } + @Override public T visit(RecentFiles rf) { return defaultVisit(rf); @@ -58,5 +65,10 @@ public interface AutopsyItemVisitor { public T visit(RecentFiles.RecentFilesFilter rff) { return defaultVisit(rff); } + + @Override + public T visit(KeywordHits kh) { + return defaultVisit(kh); + } } } diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java index b70d8f8951..3bc4e17dbe 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java @@ -18,6 +18,9 @@ */ package org.sleuthkit.autopsy.datamodel; +import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode; +import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsSetNode; + /** * Visitor pattern for DisplayableItemNodes */ @@ -44,6 +47,10 @@ public interface DisplayableItemNodeVisitor { T visit(RecentFilesNode rfn); T visit(RecentFilesFilterNode rffn); + + T visit(KeywordHitsRootNode khrn); + + T visit(KeywordHitsSetNode khsn); /** * Visitor with an implementable default behavior for all types. Override @@ -113,5 +120,15 @@ public interface DisplayableItemNodeVisitor { public T visit(RecentFilesFilterNode rffn) { return defaultVisit(rffn); } + + @Override + public T visit(KeywordHitsRootNode khrn) { + return defaultVisit(khrn); + } + + @Override + public T visit(KeywordHitsSetNode khsn) { + return defaultVisit(khsn); + } } } diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/ExtractedContentChildren.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/ExtractedContentChildren.java index f810c9fd76..7153f5446c 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/ExtractedContentChildren.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/ExtractedContentChildren.java @@ -41,6 +41,7 @@ public class ExtractedContentChildren extends ChildFactory list) { list.addAll(Arrays.asList(BlackboardArtifact.ARTIFACT_TYPE.values())); + list.remove(BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT); return true; } diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterChildren.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterChildren.java index 4ed4ece677..0d58073b98 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterChildren.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterChildren.java @@ -43,10 +43,10 @@ import org.sleuthkit.datamodel.SleuthkitCase; class FileSearchFilterChildren extends ChildFactory { SleuthkitCase skCase; - FileSearchFilter filter; + SearchFilters.SearchFilterInterface filter; Logger logger = Logger.getLogger(FileSearchFilterChildren.class.getName()); - public FileSearchFilterChildren(FileSearchFilter filter, SleuthkitCase skCase) { + public FileSearchFilterChildren(SearchFilters.SearchFilterInterface filter, SleuthkitCase skCase) { this.filter = filter; this.skCase = skCase; } diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterNode.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterNode.java index f2f78e7042..cdfcf4f840 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterNode.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/FileSearchFilterNode.java @@ -31,16 +31,16 @@ import org.sleuthkit.datamodel.SleuthkitCase; */ public class FileSearchFilterNode extends AbstractNode implements DisplayableItemNode{ - FileSearchFilter filter; + SearchFilters.SearchFilterInterface filter; SleuthkitCase skCase; - FileSearchFilterNode(FileSearchFilter filter, SleuthkitCase skCase) { + FileSearchFilterNode(SearchFilters.SearchFilterInterface filter, SleuthkitCase skCase) { super(Children.create(new FileSearchFilterChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName())); super.setName(filter.getName()); super.setDisplayName(filter.getDisplayName()); this.filter = filter; this.skCase = skCase; - this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/filter-icon.png"); + this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-filter-icon.png"); } @Override diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java new file mode 100644 index 0000000000..3156637ca1 --- /dev/null +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java @@ -0,0 +1,208 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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.datamodel; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.Sheet; +import org.openide.util.lookup.Lookups; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskException; + +/** + * + * @author dfickling + */ +public class KeywordHits implements AutopsyVisitableItem { + + SleuthkitCase skCase; + private static final Logger logger = Logger.getLogger(KeywordHits.class.getName()); + private static final String KEYWORD_HITS = "Keyword Hits"; + private static final String SIMPLE_SEARCH = "Single Keyword Search"; + //Map>> artifactMap = new HashMap>>(); + Map> listMap = new LinkedHashMap>(); + + public KeywordHits(SleuthkitCase skCase) { + this.skCase = skCase; + initMap(); + } + + private void initMap() { + listMap.clear(); + try { + String query = "select value_text,artifact_id from blackboard_attributes where attribute_type_id=" + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_SET.getTypeID(); + ResultSet rs = skCase.runQuery(query); + listMap.put(SIMPLE_SEARCH, new ArrayList()); + while(rs.next()){ + String listName = rs.getString("value_text"); + if(listName == null || listName.equals("")) + listName = SIMPLE_SEARCH; + long artifactID = rs.getLong("artifact_id"); + if(!listMap.containsKey(listName)) + listMap.put(listName, new ArrayList()); + listMap.get(listName).add(artifactID); + } + if(listMap.get(SIMPLE_SEARCH).isEmpty()) + listMap.remove(SIMPLE_SEARCH); + Statement s = rs.getStatement(); + rs.close(); + if (s != null) + s.close(); + } catch (SQLException ex) { + logger.log(Level.INFO, "SQL Exception occurred: ", ex); + } + } + + @Override + public T accept(AutopsyItemVisitor v) { + return v.visit(this); + } + + public class KeywordHitsRootNode extends AbstractNode implements DisplayableItemNode { + + + public KeywordHitsRootNode() { + super(Children.create(new KeywordHitsRootChildren(), true), Lookups.singleton(KEYWORD_HITS)); + super.setName(KEYWORD_HITS); + super.setDisplayName(KEYWORD_HITS); + this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword-search-icon.png"); + initMap(); + } + + @Override + public T accept(DisplayableItemNodeVisitor v) { + return v.visit(this); + } + + @Override + protected Sheet createSheet() { + Sheet s = super.createSheet(); + Sheet.Set ss = s.get(Sheet.PROPERTIES); + if (ss == null) { + ss = Sheet.createPropertiesSet(); + s.put(ss); + } + + ss.put(new NodeProperty(KEYWORD_HITS, + KEYWORD_HITS, + "no description", + getName())); + + return s; + } + } + + class KeywordHitsRootChildren extends ChildFactory { + + KeywordHitsRootChildren() { + super(); + } + + @Override + protected boolean createKeys(List list) { + list.addAll(listMap.keySet()); + return true; + } + + @Override + protected Node createNodeForKey(String key) { + return new KeywordHitsSetNode(key); + } + } + + public class KeywordHitsSetNode extends AbstractNode implements DisplayableItemNode { + + String setName; + public KeywordHitsSetNode(String key) { + super(Children.create(new KeywordHitsSetChildren(key), true), Lookups.singleton(key)); + super.setName(key); + super.setDisplayName(key + " (" + listMap.get(key).size() + ")"); + setName = key; + this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword-search-icon.png"); + } + + @Override + public T accept(DisplayableItemNodeVisitor v) { + return v.visit(this); + } + + @Override + protected Sheet createSheet() { + Sheet s = super.createSheet(); + Sheet.Set ss = s.get(Sheet.PROPERTIES); + if (ss == null) { + ss = Sheet.createPropertiesSet(); + s.put(ss); + } + + ss.put(new NodeProperty("List Name", + "List Name", + "no description", + setName)); + + + ss.put(new NodeProperty("Number of Hits", + "Number of Hits", + "no description", + listMap.get(setName).size())); + + return s; + } + } + + class KeywordHitsSetChildren extends ChildFactory { + + String setName; + KeywordHitsSetChildren(String setName) { + super(); + this.setName = setName; + } + + @Override + protected boolean createKeys(List list) { + for (long l : listMap.get(setName)) { + try { + //TODO: bulk artifact gettings + list.add(skCase.getBlackboardArtifact(l)); + } catch (TskException ex) { + logger.log(Level.INFO, "TSK Exception occurred", ex); + } + } + return true; + } + + @Override + protected Node createNodeForKey(BlackboardArtifact artifact) { + return new BlackboardArtifactNode(artifact); + } + } +} diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFilters.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFilters.java index 4491ee3dd8..5c5647141f 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFilters.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFilters.java @@ -29,7 +29,7 @@ public class SearchFilters implements AutopsyVisitableItem{ SleuthkitCase skCase; - public enum FileSearchFilter implements AutopsyVisitableItem { + public enum FileSearchFilter implements AutopsyVisitableItem,SearchFilterInterface { TSK_IMAGE_FILTER(0, "TSK_IMAGE_FILTER", "Images", Arrays.asList(".jpg", ".jpeg", ".png", ".psd", ".nef", ".tiff")), TSK_VIDEO_FILTER(1, "TSK_VIDEO_FILTER", "Videos", Arrays.asList(".aaf", ".3gp", ".asf", ".avi", ".m1v", ".m2v", ".m4v", @@ -57,18 +57,68 @@ public class SearchFilters implements AutopsyVisitableItem{ return v.visit(this); } + @Override public String getName(){ return this.name; } + @Override public int getId(){ return this.id; } + @Override public String getDisplayName(){ return this.displayName; } + @Override + public List getFilter(){ + return this.filter; + } + } + + public enum DocumentFilter implements AutopsyVisitableItem,SearchFilterInterface { + AUT_DOC_HTML(0, "AUT_DOC_HTML", "HTML", Arrays.asList(".htm", ".html")), + AUT_DOC_OFFICE(1, "AUT_DOC_OFFICE", "Office", Arrays.asList(".doc", ".docx", + ".odt", ".xls", ".xlsx", ".ppt", ".pptx")), + AUT_DOC_PDF(2, "AUT_DOC_PDF", "PDF", Arrays.asList(".pdf")), + AUT_DOC_TXT(3, "AUT_DOC_TXT", "Plain Text", Arrays.asList(".txt")), + AUT_DOC_RTF(4, "AUT_DOC_RTF", "Rich Text", Arrays.asList(".rtf")); + + int id; + String name; + String displayName; + List filter; + + private DocumentFilter(int id, String name, String displayName, List filter){ + this.id = id; + this.name = name; + this.displayName = displayName; + this.filter = filter; + } + + @Override + public T accept(AutopsyItemVisitor v) { + return v.visit(this); + } + + @Override + public String getName(){ + return this.name; + } + + @Override + public int getId(){ + return this.id; + } + + @Override + public String getDisplayName(){ + return this.displayName; + } + + @Override public List getFilter(){ return this.filter; } @@ -86,4 +136,14 @@ public class SearchFilters implements AutopsyVisitableItem{ public SleuthkitCase getSleuthkitCase(){ return this.skCase; } + + interface SearchFilterInterface { + public String getName(); + + public int getId(); + + public String getDisplayName(); + + public List getFilter(); + } } diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersChildren.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersChildren.java index 9d20df7542..fd564daf6a 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersChildren.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersChildren.java @@ -29,22 +29,30 @@ import org.sleuthkit.datamodel.SleuthkitCase; * * @author dfickling */ -class SearchFiltersChildren extends ChildFactory { +class SearchFiltersChildren extends ChildFactory { SleuthkitCase skCase; + boolean root; - public SearchFiltersChildren(SleuthkitCase skCase) { + public SearchFiltersChildren(SleuthkitCase skCase, boolean root) { this.skCase = skCase; + this.root = root; } @Override - protected boolean createKeys(List list) { - list.addAll(Arrays.asList(FileSearchFilter.values())); + protected boolean createKeys(List list) { + if(root) + list.addAll(Arrays.asList(FileSearchFilter.values())); + else + list.addAll(Arrays.asList(SearchFilters.DocumentFilter.values())); return true; } @Override - protected Node createNodeForKey(FileSearchFilter key){ + protected Node createNodeForKey(SearchFilters.SearchFilterInterface key){ + if(key.getName().equals(SearchFilters.FileSearchFilter.TSK_DOCUMENT_FILTER.getName())){ + return new SearchFiltersNode(skCase, false); + } return new FileSearchFilterNode(key, skCase); } diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersNode.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersNode.java index 290aac3fb2..e27c87fafe 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersNode.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/SearchFiltersNode.java @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.datamodel; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; +import org.openide.nodes.Sheet; import org.openide.util.lookup.Lookups; import org.sleuthkit.datamodel.SleuthkitCase; @@ -31,17 +32,37 @@ public class SearchFiltersNode extends AbstractNode implements DisplayableItemNo SleuthkitCase skCase; - SearchFiltersNode(SleuthkitCase skCase) { - super(Children.create(new SearchFiltersChildren(skCase), true), Lookups.singleton("Search Filters")); - super.setName("File Types"); - super.setDisplayName("File Types"); + SearchFiltersNode(SleuthkitCase skCase, boolean root) { + super(Children.create(new SearchFiltersChildren(skCase, root), true), Lookups.singleton(root ? "File Types" : "Documents")); + if(root){ + super.setName("File Types"); + super.setDisplayName("File Types"); + } else { + super.setName("Documents"); + super.setDisplayName("Documents"); + } this.skCase = skCase; - this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/filter-icon.png"); -} + this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-filter-icon.png"); + } @Override public T accept(DisplayableItemNodeVisitor v) { return v.visit(this); } - + + @Override + protected Sheet createSheet() { + Sheet s = super.createSheet(); + Sheet.Set ss = s.get(Sheet.PROPERTIES); + if (ss == null) { + ss = Sheet.createPropertiesSet(); + s.put(ss); + } + + ss.put(new NodeProperty("Search Filter", + "Search Filter", + "no description", + getName())); + return s; + } } diff --git a/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java b/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java index 981aa2455c..cace0923f0 100644 --- a/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java +++ b/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java @@ -42,7 +42,9 @@ import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; import org.sleuthkit.autopsy.datamodel.FileNode; import org.sleuthkit.autopsy.datamodel.FileSearchFilterNode; import org.sleuthkit.autopsy.datamodel.ImageNode; +import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsSetNode; import org.sleuthkit.autopsy.datamodel.RecentFilesFilterNode; +import org.sleuthkit.autopsy.datamodel.SearchFiltersNode; import org.sleuthkit.datamodel.Content; @@ -209,11 +211,21 @@ public class DataResultFilterNode extends FilterNode{ return openChild(fsfn); } + @Override + public AbstractAction visit(SearchFiltersNode sfn) { + return openChild(sfn); + } + @Override public AbstractAction visit(RecentFilesFilterNode rffn) { return openChild(rffn); } + @Override + public AbstractAction visit(KeywordHitsSetNode khsn) { + return openChild(khsn); + } + @Override protected AbstractAction defaultVisit(DisplayableItemNode c) { return null; diff --git a/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterChildren.java b/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterChildren.java index 760c048d53..22c5e8f649 100644 --- a/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterChildren.java +++ b/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterChildren.java @@ -27,6 +27,8 @@ import org.openide.nodes.Node; import org.sleuthkit.autopsy.datamodel.ArtifactTypeNode; import org.sleuthkit.autopsy.datamodel.ExtractedContentNode; import org.sleuthkit.autopsy.datamodel.FileSearchFilterNode; +import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode; +import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsSetNode; import org.sleuthkit.autopsy.datamodel.RecentFilesFilterNode; import org.sleuthkit.autopsy.datamodel.RecentFilesNode; import org.sleuthkit.autopsy.datamodel.SearchFiltersNode; @@ -68,7 +70,9 @@ class DirectoryTreeFilterChildren extends FilterNode.Children { arg0 instanceof FileSearchFilterNode || arg0 instanceof SearchFiltersNode || arg0 instanceof RecentFilesNode || - arg0 instanceof RecentFilesFilterNode)) { + arg0 instanceof RecentFilesFilterNode || + arg0 instanceof KeywordHitsRootNode || + arg0 instanceof KeywordHitsSetNode)) { return new Node[]{this.copyNode(arg0)}; } else { return new Node[]{}; diff --git a/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index e6a3ee2da4..b50a0a55bb 100644 --- a/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/DirectoryTree/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java @@ -56,6 +56,7 @@ import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.datamodel.DataConversion; import org.sleuthkit.autopsy.datamodel.ExtractedContent; import org.sleuthkit.autopsy.datamodel.ExtractedContentNode; +import org.sleuthkit.autopsy.datamodel.KeywordHits; import org.sleuthkit.autopsy.datamodel.RecentFiles; import org.sleuthkit.autopsy.datamodel.RootContentChildren; import org.sleuthkit.autopsy.datamodel.SearchFilters; @@ -330,6 +331,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat List items = new ArrayList(); items.addAll(currentCase.getRootObjects()); items.add(new ExtractedContent(currentCase.getSleuthkitCase())); + items.add(new KeywordHits(currentCase.getSleuthkitCase())); items.add(new SearchFilters(currentCase.getSleuthkitCase())); items.add(new RecentFiles(currentCase.getSleuthkitCase())); contentChildren = new RootContentChildren(items); From 38a5e4535fc52545822e1560f97d1cfee0d6e061 Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Tue, 6 Mar 2012 13:26:40 -0500 Subject: [PATCH 6/8] Label text change --- .../src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties index 9b3d0df705..6a7124bb01 100755 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties @@ -81,5 +81,5 @@ KeywordSearchPanel.settingsLabel.text= KeywordSearchPanel.listsButton.text=Watch Lists KeywordSearchListsViewerPanel.searchAddButton.text=Search KeywordSearchListsViewerPanel.manageListsButton.text=Manage Lists -KeywordSearchListsViewerPanel.ingestLabel.text=Ingest is ongoing. Results will appear as the index is populated. KeywordSearchIngestSimplePanel.jLabel1.text=Select lists to use during ingest: +KeywordSearchListsViewerPanel.ingestIndexLabel.text=Files Indexed: From 1a1866a3168a14253238dea74a97073ab8b48468 Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Tue, 6 Mar 2012 14:45:52 -0500 Subject: [PATCH 7/8] TSK-385: Remove File Search explorer tab --- .../autopsy/filesearch/Bundle.properties | 2 +- .../autopsy/filesearch/DateSearchFilter.java | 6 + .../autopsy/filesearch/DateSearchPanel.java | 5 + .../autopsy/filesearch/FileSearchAction.java | 30 ++ .../autopsy/filesearch/FileSearchDialog.form | 38 +++ .../autopsy/filesearch/FileSearchDialog.java | 88 +++++ .../autopsy/filesearch/FileSearchFilter.java | 6 + .../autopsy/filesearch/FileSearchPanel.form | 28 ++ .../autopsy/filesearch/FileSearchPanel.java | 302 ++++++++++++++++++ .../filesearch/KnownStatusSearchFilter.java | 5 + .../autopsy/filesearch/NameSearchFilter.java | 6 + .../autopsy/filesearch/NameSearchPanel.java | 4 + .../autopsy/filesearch/SizeSearchFilter.java | 6 + .../autopsy/filesearch/SizeSearchPanel.java | 4 + .../sleuthkit/autopsy/filesearch/layer.xml | 29 -- .../autopsy/menuactions/SearchResultMenu.java | 4 +- 16 files changed, 531 insertions(+), 32 deletions(-) create mode 100644 FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchAction.java create mode 100644 FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.form create mode 100644 FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.java create mode 100644 FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form create mode 100644 FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/Bundle.properties b/FileSearch/src/org/sleuthkit/autopsy/filesearch/Bundle.properties index a47179e01b..bc1f0a833f 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/Bundle.properties +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/Bundle.properties @@ -1,4 +1,4 @@ -CTL_FileSearchAction=FileSearch +CTL_FileSearchAction=File Search CTL_FileSearchTopComponent=File Search HINT_FileSearchTopComponent=This is a FileSearch window OpenIDE-Module-Name=FileSearch diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java index 7a7e12a660..119616a6e2 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchFilter.java @@ -19,6 +19,7 @@ package org.sleuthkit.autopsy.filesearch; import java.awt.Component; +import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.text.DateFormat; @@ -193,6 +194,11 @@ class DateSearchFilter extends AbstractFileSearchFilter { return timeZones; } + @Override + public void addActionListener(ActionListener l) { + getComponent().addActionListener(l); + } + /** * Inner class to put the separator inside the combo box. */ diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java index b777cb64ed..787994279b 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/DateSearchPanel.java @@ -363,4 +363,9 @@ class DateSearchPanel extends javax.swing.JPanel { private javax.swing.JMenuItem selectAllMenuItem; private javax.swing.JComboBox timeZoneComboBox; // End of variables declaration//GEN-END:variables + + void addActionListener(ActionListener l) { + dateFromTextField.addActionListener(l); + dateToTextField.addActionListener(l); + } } diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchAction.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchAction.java new file mode 100644 index 0000000000..abf56fb76d --- /dev/null +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchAction.java @@ -0,0 +1,30 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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.filesearch; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public final class FileSearchAction implements ActionListener { + + @Override + public void actionPerformed(ActionEvent e) { + new FileSearchDialog().setVisible(true); + } +} diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.form b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.form new file mode 100644 index 0000000000..c11d976898 --- /dev/null +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.form @@ -0,0 +1,38 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.java new file mode 100644 index 0000000000..48146c16e1 --- /dev/null +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchDialog.java @@ -0,0 +1,88 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + */ + +/* + * FileSearchDialog.java + * + * Created on Mar 5, 2012, 1:57:33 PM + */ +package org.sleuthkit.autopsy.filesearch; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JFrame; + +/** + * + * @author dfickling + */ +public class FileSearchDialog extends javax.swing.JDialog { + + /** Creates new form FileSearchDialog */ + public FileSearchDialog() { + super(new JFrame("File Search"), true); + initComponents(); + + setResizable(false); + Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); + double w = getSize().getWidth(); + double h = getSize().getHeight(); + setLocation((int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2)); + fileSearchPanel1.addListenerToAll(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + dispose(); + } + }); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + fileSearchPanel1 = new org.sleuthkit.autopsy.filesearch.FileSearchPanel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(fileSearchPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(fileSearchPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE) + ); + + pack(); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + private org.sleuthkit.autopsy.filesearch.FileSearchPanel fileSearchPanel1; + // End of variables declaration//GEN-END:variables +} diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchFilter.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchFilter.java index 5159ae020a..1c088c1cd7 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchFilter.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchFilter.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.filesearch; +import java.awt.event.ActionListener; import javax.swing.JComponent; /** @@ -45,6 +46,11 @@ interface FileSearchFilter { * invalid state */ String getPredicate() throws FilterValidationException; + + /** + * Add an action listener to the fields of this panel + */ + void addActionListener(ActionListener l); /** * Thrown if a filter's inputs are invalid diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form new file mode 100644 index 0000000000..43c000f93b --- /dev/null +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.form @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java new file mode 100644 index 0000000000..1aed06a285 --- /dev/null +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/FileSearchPanel.java @@ -0,0 +1,302 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + */ + +/* + * FileSearchPanel.java + * + * Created on Mar 5, 2012, 1:51:50 PM + */ +package org.sleuthkit.autopsy.filesearch; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; +import org.openide.windows.TopComponent; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; +import org.sleuthkit.autopsy.corecomponents.TableFilterNode; +import org.sleuthkit.autopsy.filesearch.FileSearchFilter.FilterValidationException; +import org.sleuthkit.datamodel.FsContent; +import org.sleuthkit.datamodel.SleuthkitCase; + +/** + * + * @author dfickling + */ +public class FileSearchPanel extends javax.swing.JPanel { + + private List filterAreas = new ArrayList(); + private JButton searchButton; + private PropertyChangeListener listener; + private static ArrayList searchResults = new ArrayList(); + + /** Creates new form FileSearchPanel */ + public FileSearchPanel() { + initComponents(); + customizeComponents(); + setListener(); + this.listener = new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String changed = evt.getPropertyName(); + Object newValue = evt.getNewValue(); + + // if the one of the "FileSearchResult" window is closed + if (changed.equals(DataResultTopComponent.REMOVE_FILESEARCH)) { + searchResults.remove((DataResultTopComponent) newValue); + } + } + }; + } + + /** + * This method is called from within the constructor to + * initialize the form. + */ + private void customizeComponents() { + + this.setLayout(new BorderLayout()); + + JPanel filterPanel = new JPanel(); + filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS)); + filterPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); + + this.add(filterPanel, BorderLayout.CENTER); + + JLabel label = new JLabel("Search for files that match the following criteria:"); + label.setAlignmentX(Component.LEFT_ALIGNMENT); + label.setBorder(new EmptyBorder(0, 0, 10, 0)); + filterPanel.add(label); + + // Create and add filter areas + this.filterAreas.add(new FilterArea("Name", new NameSearchFilter())); + + List metadataFilters = new ArrayList(); + metadataFilters.add(new SizeSearchFilter()); + metadataFilters.add(new DateSearchFilter()); + this.filterAreas.add(new FilterArea("Metadata", metadataFilters)); + + this.filterAreas.add(new FilterArea("Known Status", new KnownStatusSearchFilter())); + + for (FilterArea fa : this.filterAreas) { + fa.setMaximumSize(new Dimension(Integer.MAX_VALUE, fa.getMinimumSize().height)); + fa.setAlignmentX(Component.LEFT_ALIGNMENT); + filterPanel.add(fa); + } + + // Create and add search button + this.searchButton = new JButton("Search"); + this.searchButton.setAlignmentX(Component.LEFT_ALIGNMENT); + filterPanel.add(searchButton); + + addListenerToAll(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + search(); + } + }); + } + + /** + * @return true if any of the filters in the panel are enabled (checked) + */ + private boolean anyFiltersEnabled() { + for (FileSearchFilter filter : this.getFilters()) { + if (filter.isEnabled()) { + return true; + } + } + + return false; + } + + /** + * Action when the "Search" button is pressed. + * + * @param evt the action event + */ + private void search() { + // change the cursor to "waiting cursor" for this operation + this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + try { + if (this.anyFiltersEnabled()) { + String title = "File Search Results"; + String pathText = "Filename Search Results:"; + + // try to get the number of matches first + Case currentCase = Case.getCurrentCase(); // get the most updated case + int totalMatches = 0; + ArrayList fsContentList = new ArrayList(); + try { + List currentDbList; + SleuthkitCase tempDb = currentCase.getSleuthkitCase(); + ResultSet rs = tempDb.runQuery(this.getQuery("count(*) as TotalMatches")); + totalMatches = totalMatches + rs.getInt("TotalMatches"); + Statement s = rs.getStatement(); + rs.close(); + if (s != null) + s.close(); + rs = tempDb.runQuery(this.getQuery(null)); + currentDbList = tempDb.resultSetToFsContents(rs); + s = rs.getStatement(); + rs.close(); + if (s != null) + s.close(); + fsContentList.addAll(currentDbList); + } catch (SQLException ex) { + Logger logger = Logger.getLogger(this.getClass().getName()); + logger.log(Level.WARNING, "Error while trying to get the number of matches.", ex); + } + + TopComponent searchResultWin = DataResultTopComponent.createInstance(title, pathText, new TableFilterNode(new SearchNode(fsContentList), true), totalMatches); + + searchResultWin.requestActive(); // make it the active top component + + searchResultWin.addPropertyChangeListener(listener); + searchResults.add((DataResultTopComponent) searchResultWin); + + /** + * If total matches more than 1000, pop up a dialog box that say + * the performance maybe be slow and to increase the performance, + * tell the users to refine their search. + */ + if (totalMatches > 1000) { + // show the confirmation + NotifyDescriptor d = new NotifyDescriptor.Message("Note: " + totalMatches + " matches found. Due to the large number of search results, performance may be slow for some operations. (In particular the thumbnail view in this version of Autospy, should be fixed in a future version) \n\nPlease refine your search to get better search results and improve performance."); + DialogDisplayer.getDefault().notify(d); + } + } else { + throw new FilterValidationException("At least one filter must be selected."); + } + } catch (FilterValidationException ex) { + NotifyDescriptor d = new NotifyDescriptor.Message("Validation Error: " + ex.getMessage()); + DialogDisplayer.getDefault().notify(d); + } finally { + this.setCursor(null); + } + } + + private void setListener() { + Case.addPropertyChangeListener(listener); // add this class to listen to any changes in the Case.java class + } + + public static ArrayList getFileSearchResultList() { + return searchResults; + } + + /** + * Gets the SQL query to get the data from the database based on the + * criteria that user chooses on the FileSearch. + * + * @param addition the additional selection for query. If nothing/null, will select all. + * @return query the SQL query + * @throws org.sleuthkit.autopsy.filesearch.FileSearchFilter.FilterValidationException if an enabled filter is in an invalid state + */ + private String getQuery(String addition) throws FilterValidationException { + String tempQuery = "*"; + if (addition != null && !addition.equals("")) { + tempQuery = addition; + } + + String query = "select " + tempQuery + " from tsk_files where 1"; + + for (FileSearchFilter f : this.getEnabledFilters()) { + query += " and (" + f.getPredicate() + ")"; + } + + return query; + } + + private Collection getFilters() { + Collection filters = new ArrayList(); + + for (FilterArea fa : this.filterAreas) { + filters.addAll(fa.getFilters()); + } + + return filters; + } + + private Collection getEnabledFilters() { + Collection enabledFilters = new ArrayList(); + + for (FileSearchFilter f : this.getFilters()) { + if (f.isEnabled()) { + enabledFilters.add(f); + } + } + + return enabledFilters; + } + + void addListenerToAll(ActionListener l) { + searchButton.addActionListener(l); + for (FilterArea fa : this.filterAreas) { + for(FileSearchFilter fsf : fa.getFilters()) { + fsf.addActionListener(l); + } + } + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 376, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +} diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java index 3a55bd2b99..4da7f3244e 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/KnownStatusSearchFilter.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.filesearch; +import java.awt.event.ActionListener; import org.sleuthkit.datamodel.TskData.FileKnown; /** @@ -73,4 +74,8 @@ class KnownStatusSearchFilter extends AbstractFileSearchFilter { return "name like '%" + keyword + "%'"; } + + @Override + public void addActionListener(ActionListener l) { + getComponent().addActionListener(l); + } } diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java index 01d59229ee..b3021dd19a 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/NameSearchPanel.java @@ -155,4 +155,8 @@ class NameSearchPanel extends javax.swing.JPanel { private javax.swing.JTextField searchTextField; private javax.swing.JMenuItem selectAllMenuItem; // End of variables declaration//GEN-END:variables + + void addActionListener(ActionListener l) { + searchTextField.addActionListener(l); + } } diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchFilter.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchFilter.java index b960a679c3..b9f09f06d8 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchFilter.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchFilter.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.filesearch; +import java.awt.event.ActionListener; import javax.swing.JComboBox; import org.sleuthkit.autopsy.filesearch.FileSearchFilter.FilterValidationException; @@ -63,4 +64,9 @@ class SizeSearchFilter extends AbstractFileSearchFilter { throw new IllegalArgumentException(); } } + + @Override + public void addActionListener(ActionListener l) { + getComponent().addActionListener(l); + } } diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java b/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java index 3aa6b7d123..c3e5fb1428 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java @@ -161,4 +161,8 @@ class SizeSearchPanel extends javax.swing.JPanel { private javax.swing.JFormattedTextField sizeTextField; private javax.swing.JComboBox sizeUnitComboBox; // End of variables declaration//GEN-END:variables + + void addActionListener(ActionListener l) { + sizeTextField.addActionListener(l); + } } diff --git a/FileSearch/src/org/sleuthkit/autopsy/filesearch/layer.xml b/FileSearch/src/org/sleuthkit/autopsy/filesearch/layer.xml index 248a122523..6a3f5e0c01 100644 --- a/FileSearch/src/org/sleuthkit/autopsy/filesearch/layer.xml +++ b/FileSearch/src/org/sleuthkit/autopsy/filesearch/layer.xml @@ -1,40 +1,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MenuActions/src/org/sleuthkit/autopsy/menuactions/SearchResultMenu.java b/MenuActions/src/org/sleuthkit/autopsy/menuactions/SearchResultMenu.java index 8b3b434b04..7ed142699c 100644 --- a/MenuActions/src/org/sleuthkit/autopsy/menuactions/SearchResultMenu.java +++ b/MenuActions/src/org/sleuthkit/autopsy/menuactions/SearchResultMenu.java @@ -27,7 +27,7 @@ import javax.swing.JMenuItem; import org.openide.awt.DynamicMenuContent; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent; -import org.sleuthkit.autopsy.filesearch.FileSearchTopComponent; +import org.sleuthkit.autopsy.filesearch.FileSearchPanel; /** * Menu item lists DataResult tabs. @@ -39,7 +39,7 @@ public class SearchResultMenu extends JMenuItem implements DynamicMenuContent { @Override public JComponent[] getMenuPresenters() { - List searchResults = FileSearchTopComponent.getFileSearchResultList(); + List searchResults = FileSearchPanel.getFileSearchResultList(); DirectoryTreeTopComponent directoryTree = DirectoryTreeTopComponent.findInstance(); DataResultTopComponent directoryListing = directoryTree.getDirectoryListing(); From b7e40881117ddfc87da0fbe86b01e2867ab4bffd Mon Sep 17 00:00:00 2001 From: Dick Fickling Date: Tue, 6 Mar 2012 14:47:03 -0500 Subject: [PATCH 8/8] Don't associate search results from single keyword search with a keyword list --- .../org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java index d5c3bb44e6..b317aaad5c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java @@ -164,10 +164,10 @@ public class LuceneQuery implements KeywordSearchQuery { //get listname String listName = ""; - KeywordSearchList list = KeywordSearchListsXML.getCurrent().getListWithKeyword(query); - if (list != null) { - listName = list.getName(); - } + //KeywordSearchList list = KeywordSearchListsXML.getCurrent().getListWithKeyword(query); + //if (list != null) { + // listName = list.getName(); + //} final String theListName = listName; Node rootNode = new KeywordSearchNode(matches, query);