From e20466bc2832876b4a77c1ce0339499fb8af5245 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Wed, 14 Nov 2018 09:54:22 -0500 Subject: [PATCH 1/6] Added correlation property search. Cleanup still needed. --- Core/src/org/sleuthkit/autopsy/core/layer.xml | 5 + .../datamodel/DisplayableItemNodeVisitor.java | 16 + .../autopsy/md5search/Bundle.properties | 6 + ...CorrelationAttributeInstanceChildNode.java | 123 ++++++++ ...tionAttributeInstanceChildNodeFactory.java | 68 +++++ .../CorrelationAttributeInstanceRootNode.java | 162 ++++++++++ .../CorrelationAttributeSearchResults.java | 25 ++ .../DlgCorrelationAttributeInstanceNode.java | 143 +++++++++ .../autopsy/md5search/DlgFilterChildren.java | 39 +++ .../autopsy/md5search/DlgFilterNode.java | 79 +++++ .../autopsy/md5search/DlgSearchChildren.java | 34 +++ .../autopsy/md5search/DlgSearchNode.java | 29 ++ .../autopsy/md5search/Md5SearchAction.java | 60 ++++ .../autopsy/md5search/Md5SearchDialog.form | 145 +++++++++ .../autopsy/md5search/Md5SearchDialog.java | 282 ++++++++++++++++++ 15 files changed, 1216 insertions(+) create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form create mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java diff --git a/Core/src/org/sleuthkit/autopsy/core/layer.xml b/Core/src/org/sleuthkit/autopsy/core/layer.xml index 8bdde0f317..546ec757ec 100644 --- a/Core/src/org/sleuthkit/autopsy/core/layer.xml +++ b/Core/src/org/sleuthkit/autopsy/core/layer.xml @@ -78,6 +78,7 @@ + @@ -201,6 +202,10 @@ + + + + diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java index 002f87acba..dbd06ac8dc 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java @@ -29,6 +29,8 @@ import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootChildren.FileSizeNod import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootNode; import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesNode; import org.sleuthkit.autopsy.datamodel.accounts.Accounts; +import org.sleuthkit.autopsy.md5search.CorrelationAttributeInstanceChildNode; +import org.sleuthkit.autopsy.md5search.DlgCorrelationAttributeInstanceNode; /** * Visitor pattern that goes over all nodes in the directory tree. This includes @@ -125,6 +127,10 @@ public interface DisplayableItemNodeVisitor { T visit(CentralRepoCommonAttributeInstanceNode crfin); T visit(InstanceCountNode icn); + + T visit(CorrelationAttributeInstanceChildNode caicn); + + T visit(DlgCorrelationAttributeInstanceNode cain); //DLG: /* * Tags @@ -214,6 +220,16 @@ public interface DisplayableItemNodeVisitor { return defaultVisit(icn); } + @Override + public T visit(CorrelationAttributeInstanceChildNode caicn){ + return defaultVisit(caicn); + } + + @Override + public T visit(DlgCorrelationAttributeInstanceNode cain) { + return defaultVisit(cain); + } + @Override public T visit(CentralRepoCommonAttributeInstanceNode crfin){ return defaultVisit(crfin); diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties b/Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties new file mode 100755 index 0000000000..59bdbf31bf --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties @@ -0,0 +1,6 @@ + +Md5SearchDialog.jButton1.text=Search +Md5SearchDialog.jTextField1.text= +Md5SearchDialog.jLabel1.text=Correlation Property Value: +Md5SearchDialog.jLabel2.text=Correlation Property Type: +Md5SearchDialog.jTextArea1.text=Type a value into the Correlation Property Value field. When the input type is detected, the Correlation Property Type field will become available and default to the detected input type. diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java new file mode 100755 index 0000000000..49c525bd7a --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java @@ -0,0 +1,123 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import javax.swing.Action; +import org.openide.nodes.Children; +import org.openide.nodes.Sheet; +import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.commonfilesearch.CaseDBCommonAttributeInstanceNode; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; +import org.sleuthkit.autopsy.datamodel.NodeProperty; + +/** + * //DLG: + */ +public final class CorrelationAttributeInstanceChildNode extends DisplayableItemNode { + private String caseName; + private String dataSourceName; + //DLG: final ? knownStatus + private String fullPath; + //DLG: final String comment + //DLG: final String deviceId + private String name; + private String parent; + + public CorrelationAttributeInstanceChildNode(Children children) { + super(children); + } + + //CorrelationAttributeInstanceChildNode(Children children) { + // init(null); + //} + + private void init(Map map) { + caseName = (String)map.get("caseName"); + dataSourceName = (String)map.get("dataSourceName"); + fullPath = (String)map.get("fullPath"); + name = (String)map.get("name"); + parent = (String)map.get("parent"); + } + + @Override + public Action[] getActions(boolean context){ + List actionsList = new ArrayList<>(); + + actionsList.addAll(Arrays.asList(super.getActions(true))); + + return actionsList.toArray(new Action[actionsList.size()]); + } + + /*@Override + public T accept(DisplayableItemNodeVisitor visitor) { + return visitor.visit(this); + }*/ + + @Override + public T accept(DisplayableItemNodeVisitor visitor) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public boolean isLeafTypeNode() { + return true; + } + + @Override + public String getItemType() { + //objects of type FileNode will co-occur in the treetable with objects + // of this type and they will need to provide the same key + return CorrelationAttributeInstanceChildNode.class.getName(); + } + + @NbBundle.Messages({ + "CorrelationAttributeInstanceChildNode.columnName.case=Case", + "CorrelationAttributeInstanceChildNode.columnName.dataSource=Data Source", + "CorrelationAttributeInstanceChildNode.columnName.known=Known", + "CorrelationAttributeInstanceChildNode.columnName.path=Path", + "CorrelationAttributeInstanceChildNode.columnName.comment=Comment", + "CorrelationAttributeInstanceChildNode.columnName.device=Device" + }) + @Override + protected Sheet createSheet(){ + Sheet sheet = new Sheet(); + Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); + + if(sheetSet == null){ + sheetSet = Sheet.createPropertiesSet(); + sheet.put(sheetSet); + } + + + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_case(), + Bundle.CorrelationAttributeInstanceNode_columnName_case(), "", name)); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), + Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), "", parent)); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_known(), + Bundle.CorrelationAttributeInstanceNode_columnName_known(), "", "")); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_path(), + Bundle.CorrelationAttributeInstanceNode_columnName_path(), "", dataSourceName)); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_comment(), + Bundle.CorrelationAttributeInstanceNode_columnName_comment(), "", "")); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_device(), + Bundle.CorrelationAttributeInstanceNode_columnName_device(), "", caseName)); + + return sheet; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java new file mode 100755 index 0000000000..b30a11e06f --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java @@ -0,0 +1,68 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.lookup.Lookups; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.datamodel.KeyValue; +import org.sleuthkit.autopsy.datamodel.KeyValueNode; + +/** + * //DLG: + */ +final class CorrelationAttributeInstanceChildNodeFactory extends ChildFactory { + private final Collection correlationInstances; + + CorrelationAttributeInstanceChildNodeFactory(Collection correlationInstances) { + this.correlationInstances = correlationInstances; + } + + @Override + protected boolean createKeys(List list) { + for (CorrelationAttributeInstance instance : correlationInstances) { + Map properties = new HashMap<>(); //DLG: + + final String caseName = instance.getCorrelationCase().getDisplayName(); + final String dataSourceName = instance.getCorrelationDataSource().getName(); + //DLG: final ? knownStatus + final String fullPath = instance.getFilePath(); + //DLG: final String comment + //DLG: final String deviceId + + final File file = new File(fullPath); + final String name = file.getName(); + final String parent = file.getParent(); + + properties.put("caseName", caseName); + properties.put("dataSourceName", dataSourceName); + properties.put("knownStatus", ""); //DLG: + properties.put("fullPath", fullPath); + properties.put("comment", ""); //DLG: + properties.put("deviceId", ""); //DLG: + properties.put("name", name); + properties.put("parent", parent); + + list.add(new KeyValue(String.valueOf(instance.getID()), properties, instance.getID())); + } + return true; + } + + @Override + protected Node createNodeForKey(KeyValue key) { + Map map = key.getMap(); + Node kvNode = new KeyValueNode(key, Children.LEAF, Lookups.fixed(correlationInstances.toArray())); + //DLG: Node resultNode = new CorrelationAttributeInstanceChildNode(kvNode); + return null; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java new file mode 100755 index 0000000000..43b67b57a9 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java @@ -0,0 +1,162 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2018 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.md5search; + +import org.sleuthkit.autopsy.commonfilesearch.*; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.swing.Action; +import org.openide.nodes.ChildFactory; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.Sheet; +import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; +import org.sleuthkit.autopsy.datamodel.NodeProperty; + +/** + * Used by the Common Files search feature to encapsulate instances of a given + * MD5s matched in the search. These nodes will be children of Md5Nodes. + * + * Use this type for files which are not in the current case, but from the + * Central Repo. Contrast with SleuthkitCase which should be used + * when the FileInstance was found in the case presently open in Autopsy. + */ +final class CorrelationAttributeInstanceRootNode extends DisplayableItemNode { + + public CorrelationAttributeInstanceRootNode(Children children) { + super(children); + } + + //private final CorrelationAttributeInstance crFile; + + //CorrelationAttributeInstanceRootNode(CorrelationAttributeSearchResults data) { + //super(Children.create(new FileInstanceNodeFactory(data), true)); + //} + + @Override + public Action[] getActions(boolean context){ + List actionsList = new ArrayList<>(); + + actionsList.addAll(Arrays.asList(super.getActions(true))); + + return actionsList.toArray(new Action[actionsList.size()]); + } + + @Override + public T accept(DisplayableItemNodeVisitor visitor) { + return null; + //return visitor.visit(this); + } + + @Override + public boolean isLeafTypeNode() { + return true; + } + + @Override + public String getItemType() { + //objects of type FileNode will co-occur in the treetable with objects + // of this type and they will need to provide the same key + return CaseDBCommonAttributeInstanceNode.class.getName(); + } + + @NbBundle.Messages({ + "CorrelationAttributeInstanceNode.columnName.case=Case", + "CorrelationAttributeInstanceNode.columnName.dataSource=Data Source", + "CorrelationAttributeInstanceNode.columnName.known=Known", + "CorrelationAttributeInstanceNode.columnName.path=Path", + "CorrelationAttributeInstanceNode.columnName.comment=Comment", + "CorrelationAttributeInstanceNode.columnName.device=Device" + }) + @Override + protected Sheet createSheet(){ + Sheet sheet = new Sheet(); + /*Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); + + if(sheetSet == null){ + sheetSet = Sheet.createPropertiesSet(); + sheet.put(sheetSet); + } + + final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance(); + + final String caseName = centralRepoFile.getCorrelationCase().getDisplayName(); + final String dataSourceName = centralRepoFile.getCorrelationDataSource().getName(); + //DLG: final ? knownStatus + final String fullPath = centralRepoFile.getFilePath(); + //DLG: final String comment + //DLG: final String deviceId + + final File file = new File(fullPath); + final String name = file.getName(); + final String parent = file.getParent(); + + + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_case(), + Bundle.CorrelationAttributeInstanceNode_columnName_case(), "", name)); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), + Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), "", parent)); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_known(), + Bundle.CorrelationAttributeInstanceNode_columnName_known(), "", "")); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_path(), + Bundle.CorrelationAttributeInstanceNode_columnName_path(), "", dataSourceName)); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_comment(), + Bundle.CorrelationAttributeInstanceNode_columnName_comment(), "", "")); + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_device(), + Bundle.CorrelationAttributeInstanceNode_columnName_device(), "", caseName));*/ + + return sheet; + } + + /** + * Child generator for SleuthkitCaseFileInstanceNode of + * CommonAttributeValueNode. + */ + static class FileInstanceNodeFactory extends ChildFactory { + + private final CommonAttributeValue descendants; + + FileInstanceNodeFactory(CommonAttributeValue descendants) { + this.descendants = descendants; + } + + @Override + protected boolean createKeys(List list) { + return true; + } + + /*@Override + protected Node[] createNodesForKey(AbstractCommonAttributeInstance searchResult) { + return null; + //return searchResult.generateNodes(); + }*/ + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java new file mode 100755 index 0000000000..5c1e0ee004 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java @@ -0,0 +1,25 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import java.util.ArrayList; +import java.util.List; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; + +/** + * //DLG: + */ +public class CorrelationAttributeSearchResults { + List correlationInstances = new ArrayList<>(); + + CorrelationAttributeSearchResults(List correlationInstances) { + this.correlationInstances = correlationInstances; + } + + List getCorrelationAttributeInstances() { + return correlationInstances; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java new file mode 100755 index 0000000000..1e6a51850c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java @@ -0,0 +1,143 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2018 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.md5search; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.swing.Action; +import org.openide.nodes.Children; +import org.openide.nodes.Sheet; +import org.openide.util.NbBundle; +import org.openide.util.lookup.Lookups; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; +import org.sleuthkit.autopsy.datamodel.NodeProperty; + +/** + * Used by the Common Files search feature to encapsulate instances of a given + * MD5s matched in the search. These nodes will be children of Md5Nodes. + * + * Use this type for files which are not in the current case, but from the + * Central Repo. Contrast with SleuthkitCase which should be used + * when the FileInstance was found in the case presently open in Autopsy. + */ +public class DlgCorrelationAttributeInstanceNode extends DisplayableItemNode { + + private final CorrelationAttributeInstance crFile; + + DlgCorrelationAttributeInstanceNode(CorrelationAttributeInstance content) { + super(Children.LEAF, Lookups.fixed(content)); + this.crFile = content; + this.setDisplayName(new File(this.crFile.getFilePath()).getName()); + } + + public CorrelationAttributeInstance getCorrelationAttributeInstance(){ + return this.crFile; + } + + @Override + public Action[] getActions(boolean context){ + List actionsList = new ArrayList<>(); + + actionsList.addAll(Arrays.asList(super.getActions(true))); + + return actionsList.toArray(new Action[actionsList.size()]); + } + + @Override + public T accept(DisplayableItemNodeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public boolean isLeafTypeNode() { + return true; + } + + @Override + public String getItemType() { + //objects of type FileNode will co-occur in the treetable with objects + // of this type and they will need to provide the same key + return DlgCorrelationAttributeInstanceNode.class.getName(); + } + + @NbBundle.Messages({ + "DlgCorrelationAttributeInstanceNode.columnName.name=Name", + "DlgCorrelationAttributeInstanceNode.columnName.case=Case", + "DlgCorrelationAttributeInstanceNode.columnName.dataSource=Data Source", + "DlgCorrelationAttributeInstanceNode.columnName.known=Known", + "DlgCorrelationAttributeInstanceNode.columnName.path=Path", + "DlgCorrelationAttributeInstanceNode.columnName.comment=Comment", + "DlgCorrelationAttributeInstanceNode.columnName.device=Device" + }) + @Override + protected Sheet createSheet(){ + Sheet sheet = new Sheet(); + Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); + + if(sheetSet == null){ + sheetSet = Sheet.createPropertiesSet(); + sheet.put(sheetSet); + } + + final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance(); + + final String path = centralRepoFile.getFilePath(); + final File file = new File(path); + final String name = file.getName(); + //DLG: final String parent = file.getParent(); + final String caseName = centralRepoFile.getCorrelationCase().getDisplayName(); + final CorrelationDataSource dataSource = centralRepoFile.getCorrelationDataSource(); + final String dataSourceName = dataSource.getName(); + final String known = centralRepoFile.getKnownStatus().getName(); + final String comment = centralRepoFile.getComment(); + final String device = dataSource.getDeviceID(); + + final String NO_DESCR = ""; + + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_name(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_name(), NO_DESCR, name)); + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_case(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_case(), NO_DESCR, caseName)); + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_dataSource(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_dataSource(), NO_DESCR, dataSourceName)); + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_known(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_known(), NO_DESCR, known)); + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_path(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_path(), NO_DESCR, path)); + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_comment(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_comment(), NO_DESCR, comment)); + sheetSet.put(new NodeProperty<>( + Bundle.DlgCorrelationAttributeInstanceNode_columnName_device(), + Bundle.DlgCorrelationAttributeInstanceNode_columnName_device(), NO_DESCR, device)); + + return sheet; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java new file mode 100755 index 0000000000..6ca7c7540c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import org.openide.nodes.Children; +import org.openide.nodes.FilterNode; +import org.openide.nodes.Node; + +/** + * //DLG: + */ +class DlgFilterChildren extends FilterNode.Children { + + public static Children createInstance(Node wrappedNode, boolean createChildren) { + + if (createChildren) { + return new DlgFilterChildren(wrappedNode); + } else { + return Children.LEAF; + } + } + + DlgFilterChildren(Node wrappedNode) { + super(wrappedNode); + } + + @Override + protected Node copyNode(Node nodeToCopy) { + return new DlgFilterNode(nodeToCopy, false); + } + + @Override + protected Node[] createNodes(Node key) { + return new Node[]{this.copyNode(key)}; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java new file mode 100755 index 0000000000..c746637544 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java @@ -0,0 +1,79 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import org.openide.nodes.FilterNode; +import org.openide.nodes.Node; +import org.openide.util.NbBundle; +import org.openide.util.lookup.Lookups; +import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo; +import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; + +/** + * //DLG: + */ +public class DlgFilterNode extends FilterNode { + + private final boolean createChildren; + private final boolean forceUseWrappedDisplayName; + private String columnOrderKey = "NONE"; + + public DlgFilterNode(Node node, boolean createChildren) { + super(node, DlgFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); + this.forceUseWrappedDisplayName = false; + this.createChildren = createChildren; + } + + public DlgFilterNode(Node node, boolean createChildren, String columnOrderKey) { + super(node, DlgFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); + this.forceUseWrappedDisplayName = false; + this.createChildren = createChildren; + this.columnOrderKey = columnOrderKey; + } + + /*public DlgFilterNode(Node node, int childLayerDepth) { + super(node, TableFilterChildrenWithDescendants.createInstance(node, childLayerDepth), Lookups.proxy(node)); + this.createChildren = true; + this.forceUseWrappedDisplayName = true; + }*/ + + @Override + public String getDisplayName() { + if (this.forceUseWrappedDisplayName) { + return super.getDisplayName(); + } else if (createChildren) { + return NbBundle.getMessage(this.getClass(), "TableFilterNode.displayName.text"); + } else { + return super.getDisplayName(); + } + } + + public void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) { + /* + * Currently, child selection is only supported for nodes selected in + * the tree view and decorated with a DataResultFilterNode. + */ + if (getOriginal() instanceof DataResultFilterNode) { + ((DataResultFilterNode) getOriginal()).setChildNodeSelectionInfo(selectedChildNodeInfo); + } + } + + public NodeSelectionInfo getChildNodeSelectionInfo() { + /* + * Currently, child selection is only supported for nodes selected in + * the tree view and decorated with a DataResultFilterNode. + */ + if (getOriginal() instanceof DataResultFilterNode) { + return ((DataResultFilterNode) getOriginal()).getChildNodeSelectionInfo(); + } else { + return null; + } + } + + public String getColumnOrderKey() { + return columnOrderKey; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java new file mode 100755 index 0000000000..3f2c2ad403 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import java.util.List; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; +import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; +import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent; + +/** + * //DLG: + */ +class DlgSearchChildren extends Children.Keys { + + DlgSearchChildren(boolean lazy, List fileList) { + super(lazy); + this.setKeys(fileList); + } + + @Override + protected Node[] createNodes(CorrelationAttributeInstance t) { + //DLG: + Node[] node = new Node[1]; + //DLG: + node[0] = new DlgCorrelationAttributeInstanceNode(t); + return node; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java new file mode 100755 index 0000000000..6d1a75d39b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java @@ -0,0 +1,29 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import java.util.List; +import org.openide.nodes.AbstractNode; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; + +/** + * //DLG: + */ +class DlgSearchNode extends AbstractNode { + + private DlgSearchChildren children; + + DlgSearchNode(List keys) { + super(new DlgSearchChildren(true, keys)); + this.children = (DlgSearchChildren) this.getChildren(); + } + + @Override + public String getName() { + //DLG: + return /*NbBundle.getMessage(this.getClass(), */"SearchNode.getName.text"/*)*/; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java new file mode 100755 index 0000000000..a231e389fb --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java @@ -0,0 +1,60 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 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.md5search; + +import java.awt.event.ActionEvent; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.CallableSystemAction; +import org.sleuthkit.autopsy.casemodule.Case; + +/** + * //DLG: + */ +public class Md5SearchAction extends CallableSystemAction { + + @Override + public boolean isEnabled() { + return super.isEnabled() && Case.isCaseOpen(); + } + + @Override + public void actionPerformed(ActionEvent event) { + performAction(); + } + + @Override + public void performAction() { + Md5SearchDialog dialog = new Md5SearchDialog(); + dialog.display(); + } + + @NbBundle.Messages({ + "Md5SearchAction.getName.text=Correlation Attribute Search"}) + @Override + public String getName() { + return Bundle.Md5SearchAction_getName_text(); + } + + @Override + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form new file mode 100755 index 0000000000..2ecd2f4475 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form @@ -0,0 +1,145 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java new file mode 100755 index 0000000000..3d6413e82a --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java @@ -0,0 +1,282 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.md5search; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.JFrame; +import javax.swing.SwingWorker; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import org.openide.explorer.ExplorerManager; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults; +import org.sleuthkit.autopsy.commonfilesearch.CommonAttributesSearchResultsViewerTable; +import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; +import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; +import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; +import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; + +/** + * + * @author dgrove + */ +public class Md5SearchDialog extends javax.swing.JDialog { + private static final String FILES_CORRELATION_TYPE = "Files"; + private final List correlationTypes; + private final Pattern md5Pattern; + + /** + * Creates new form Md5SearchDialog + */ + @NbBundle.Messages({"Md5SearchDialog.title=Correlation Property Search"}) + public Md5SearchDialog() { + super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.Md5SearchDialog_title(), true); + this.correlationTypes = new ArrayList<>(); + this.md5Pattern = Pattern.compile("^[a-fA-F0-9]{32}$"); // NON-NLS + initComponents(); + customizeComponents(); + } + + private void search() { + new SwingWorker, Void>() { + + @Override + protected List doInBackground() { + List correlationTypes; + List correlationInstances = new ArrayList<>(); + + try { + correlationTypes = EamDb.getInstance().getDefinedCorrelationTypes(); + for (CorrelationAttributeInstance.Type type : correlationTypes) { + if (type.getId() == CorrelationAttributeInstance.FILES_TYPE_ID) { + correlationInstances = EamDb.getInstance().getArtifactInstancesByTypeValue(type, jTextField1.getText()); + break; + } + } + } catch (Exception ex) { + //DLG: + } + + return correlationInstances; + } + + @Override + protected void done() { + try { + super.done(); + List correlationInstances = this.get(); + //DLG: Node rootNode = new CorrelationAttributeInstanceRootNode(searchResults); + //DataResultFilterNode dataResultFilterNode = new DataResultFilterNode(rootNode, ExplorerManager.find(Md5SearchDialog.this)); + //TableFilterNode tableFilterWithDescendantsNode = new TableFilterNode(dataResultFilterNode, 3); + DataResultViewerTable table = new CommonAttributesSearchResultsViewerTable(); + Collection viewers = new ArrayList<>(1); + viewers.add(table); + + DlgSearchNode searchNode = new DlgSearchNode(correlationInstances); + DlgFilterNode tableFilterNode = new DlgFilterNode(searchNode, true, searchNode.getName()); + + //Node rootNode; + //Children childNodes = Children.create(new CorrelationAttributeInstanceChildNodeFactory(correlationInstances), true); + //rootNode = new AbstractNode(childNodes); + DataResultTopComponent results = DataResultTopComponent.createInstance( + "Files", "Correlation Property Search", tableFilterNode, HIDE_ON_CLOSE, viewers); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); //DLG: + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); //DLG: + } + } + }.execute(); + } + + /** + * 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() { + + jLabel1 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + correlationTypeComboBox = new javax.swing.JComboBox<>(); + jLabel2 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTextArea1 = new javax.swing.JTextArea(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jLabel1.text")); // NOI18N + + jTextField1.setText(org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jTextField1.text")); // NOI18N + jTextField1.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } + public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { + jTextField1InputMethodTextChanged(evt); + } + }); + jTextField1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + jTextField1PropertyChange(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jButton1.text")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jLabel2.text")); // NOI18N + + jTextArea1.setEditable(false); + jTextArea1.setColumns(20); + jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N + jTextArea1.setLineWrap(true); + jTextArea1.setRows(5); + jTextArea1.setText(org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jTextArea1.text")); // NOI18N + jTextArea1.setWrapStyleWord(true); + jTextArea1.setBorder(null); + jTextArea1.setOpaque(false); + jScrollPane1.setViewportView(jTextArea1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(11, 11, 11) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(correlationTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton1) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void jTextField1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField1PropertyChange + //DLG: + }//GEN-LAST:event_jTextField1PropertyChange + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + search(); + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1InputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jTextField1InputMethodTextChanged + //DLG: + }//GEN-LAST:event_jTextField1InputMethodTextChanged + + private void customizeComponents() { + jButton1.setEnabled(false); + correlationTypeComboBox.setEnabled(false); + + /* + * Add correlation types to the combo-box. + */ + try { + EamDb dbManager = EamDb.getInstance(); + correlationTypes.clear(); + correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); + } catch (EamDbException ex) { + Exceptions.printStackTrace(ex); + } + + for (CorrelationAttributeInstance.Type type : correlationTypes) { + correlationTypeComboBox.addItem(type.getDisplayName()); + } + + /* + * Create listener for text input. + */ + jTextField1.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void changedUpdate(DocumentEvent e) { + validateInput(); + } + + @Override + public void insertUpdate(DocumentEvent e) { + validateInput(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + validateInput(); + } + + private void validateInput() { + Matcher matcher = md5Pattern.matcher(jTextField1.getText().trim()); + if (matcher.find()) { + jButton1.setEnabled(true); + correlationTypeComboBox.setEnabled(true); + correlationTypeComboBox.setSelectedItem(FILES_CORRELATION_TYPE); + } else { + jButton1.setEnabled(false); + correlationTypeComboBox.setEnabled(false); + } + } + }); + } + + public void display() { + this.setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); + setVisible(true); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox correlationTypeComboBox; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextArea jTextArea1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} From 1da24f1aec0544e161e5651010b111afd1e08549 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Thu, 15 Nov 2018 00:49:53 -0500 Subject: [PATCH 2/6] Cleanup. --- Core/src/org/sleuthkit/autopsy/core/layer.xml | 5 - .../Bundle.properties | 7 + .../CorrelationAttributeInstanceNode.java} | 110 +++--- .../CorrelationPropertyFilterChildren.java | 84 ++++ .../CorrelationPropertyFilterNode.java | 134 +++++++ .../CorrelationPropertySearchAction.java} | 22 +- .../CorrelationPropertySearchChildren.java | 49 +++ .../CorrelationPropertySearchDialog.form | 135 +++++++ .../CorrelationPropertySearchDialog.java | 359 ++++++++++++++++++ .../CorrelationPropertySearchNode.java | 50 +++ .../datamodel/DisplayableItemNodeVisitor.java | 14 +- .../autopsy/md5search/Bundle.properties | 6 - ...CorrelationAttributeInstanceChildNode.java | 123 ------ ...tionAttributeInstanceChildNodeFactory.java | 68 ---- .../CorrelationAttributeSearchResults.java | 25 -- .../DlgCorrelationAttributeInstanceNode.java | 143 ------- .../autopsy/md5search/DlgFilterChildren.java | 39 -- .../autopsy/md5search/DlgFilterNode.java | 79 ---- .../autopsy/md5search/DlgSearchChildren.java | 34 -- .../autopsy/md5search/DlgSearchNode.java | 29 -- .../autopsy/md5search/Md5SearchDialog.form | 145 ------- .../autopsy/md5search/Md5SearchDialog.java | 282 -------------- .../autopsy/report/ReportWizardAction.java | 4 +- .../AutoIngestDashboardOpenAction.java | 4 +- 24 files changed, 884 insertions(+), 1066 deletions(-) create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties rename Core/src/org/sleuthkit/autopsy/{md5search/CorrelationAttributeInstanceRootNode.java => correlationpropertysearch/CorrelationAttributeInstanceNode.java} (59%) create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java rename Core/src/org/sleuthkit/autopsy/{md5search/Md5SearchAction.java => correlationpropertysearch/CorrelationPropertySearchAction.java} (55%) create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java create mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form delete mode 100755 Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java diff --git a/Core/src/org/sleuthkit/autopsy/core/layer.xml b/Core/src/org/sleuthkit/autopsy/core/layer.xml index 546ec757ec..8bdde0f317 100644 --- a/Core/src/org/sleuthkit/autopsy/core/layer.xml +++ b/Core/src/org/sleuthkit/autopsy/core/layer.xml @@ -78,7 +78,6 @@ - @@ -202,10 +201,6 @@ - - - - diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties new file mode 100755 index 0000000000..e3ceab0960 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties @@ -0,0 +1,7 @@ +CorrelationPropertySearchDialog.errorLabel.text= +CorrelationPropertySearchDialog.correlationValueTextField.text= +CorrelationPropertySearchDialog.correlationTypeLabel.text=Correlation Property Type: +CorrelationPropertySearchDialog.correlationValueLabel.text=Correlation Property Value: +CorrelationPropertySearchDialog.searchButton.text=Search +CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleName=Search +CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleDescription= diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java similarity index 59% rename from Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java rename to Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java index 43b67b57a9..c277154033 100755 --- a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceRootNode.java +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java @@ -1,5 +1,4 @@ /* - * * Autopsy Forensic Browser * * Copyright 2018 Basis Technology Corp. @@ -17,43 +16,45 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.md5search; +package org.sleuthkit.autopsy.correlationpropertysearch; -import org.sleuthkit.autopsy.commonfilesearch.*; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.Action; -import org.openide.nodes.ChildFactory; import org.openide.nodes.Children; -import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; +import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; import org.sleuthkit.autopsy.datamodel.NodeProperty; /** - * Used by the Common Files search feature to encapsulate instances of a given - * MD5s matched in the search. These nodes will be children of Md5Nodes. - * - * Use this type for files which are not in the current case, but from the - * Central Repo. Contrast with SleuthkitCase which should be used - * when the FileInstance was found in the case presently open in Autopsy. + * Used by the Correlation Property Search feature to encapsulate instances of a + * given search match. */ -final class CorrelationAttributeInstanceRootNode extends DisplayableItemNode { +public class CorrelationAttributeInstanceNode extends DisplayableItemNode { - public CorrelationAttributeInstanceRootNode(Children children) { - super(children); - } - - //private final CorrelationAttributeInstance crFile; + private final CorrelationAttributeInstance instance; - //CorrelationAttributeInstanceRootNode(CorrelationAttributeSearchResults data) { - //super(Children.create(new FileInstanceNodeFactory(data), true)); - //} + CorrelationAttributeInstanceNode(CorrelationAttributeInstance content) { + super(Children.LEAF, Lookups.fixed(content)); + this.instance = content; + this.setDisplayName(new File(this.instance.getFilePath()).getName()); + } + + /** + * Get the CorrelationAttributeInstance attached to the node. + * + * @return The CorrelationAttributeInstance object. + */ + public CorrelationAttributeInstance getCorrelationAttributeInstance(){ + return this.instance; + } @Override public Action[] getActions(boolean context){ @@ -66,8 +67,7 @@ final class CorrelationAttributeInstanceRootNode extends DisplayableItemNode { @Override public T accept(DisplayableItemNodeVisitor visitor) { - return null; - //return visitor.visit(this); + return visitor.visit(this); } @Override @@ -77,12 +77,11 @@ final class CorrelationAttributeInstanceRootNode extends DisplayableItemNode { @Override public String getItemType() { - //objects of type FileNode will co-occur in the treetable with objects - // of this type and they will need to provide the same key - return CaseDBCommonAttributeInstanceNode.class.getName(); + return CorrelationAttributeInstanceNode.class.getName(); } @NbBundle.Messages({ + "CorrelationAttributeInstanceNode.columnName.name=Name", "CorrelationAttributeInstanceNode.columnName.case=Case", "CorrelationAttributeInstanceNode.columnName.dataSource=Data Source", "CorrelationAttributeInstanceNode.columnName.known=Known", @@ -93,7 +92,7 @@ final class CorrelationAttributeInstanceRootNode extends DisplayableItemNode { @Override protected Sheet createSheet(){ Sheet sheet = new Sheet(); - /*Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); + Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); if(sheetSet == null){ sheetSet = Sheet.createPropertiesSet(); @@ -102,61 +101,40 @@ final class CorrelationAttributeInstanceRootNode extends DisplayableItemNode { final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance(); - final String caseName = centralRepoFile.getCorrelationCase().getDisplayName(); - final String dataSourceName = centralRepoFile.getCorrelationDataSource().getName(); - //DLG: final ? knownStatus - final String fullPath = centralRepoFile.getFilePath(); - //DLG: final String comment - //DLG: final String deviceId - - final File file = new File(fullPath); + final String path = centralRepoFile.getFilePath(); + final File file = new File(path); final String name = file.getName(); - final String parent = file.getParent(); - + final String caseName = centralRepoFile.getCorrelationCase().getDisplayName(); + final CorrelationDataSource dataSource = centralRepoFile.getCorrelationDataSource(); + final String dataSourceName = dataSource.getName(); + final String known = centralRepoFile.getKnownStatus().getName(); + final String comment = centralRepoFile.getComment(); + final String device = dataSource.getDeviceID(); + final String NO_DESCR = ""; + + sheetSet.put(new NodeProperty<>( + Bundle.CorrelationAttributeInstanceNode_columnName_name(), + Bundle.CorrelationAttributeInstanceNode_columnName_name(), NO_DESCR, name)); sheetSet.put(new NodeProperty<>( Bundle.CorrelationAttributeInstanceNode_columnName_case(), - Bundle.CorrelationAttributeInstanceNode_columnName_case(), "", name)); + Bundle.CorrelationAttributeInstanceNode_columnName_case(), NO_DESCR, caseName)); sheetSet.put(new NodeProperty<>( Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), - Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), "", parent)); + Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), NO_DESCR, dataSourceName)); sheetSet.put(new NodeProperty<>( Bundle.CorrelationAttributeInstanceNode_columnName_known(), - Bundle.CorrelationAttributeInstanceNode_columnName_known(), "", "")); + Bundle.CorrelationAttributeInstanceNode_columnName_known(), NO_DESCR, known)); sheetSet.put(new NodeProperty<>( Bundle.CorrelationAttributeInstanceNode_columnName_path(), - Bundle.CorrelationAttributeInstanceNode_columnName_path(), "", dataSourceName)); + Bundle.CorrelationAttributeInstanceNode_columnName_path(), NO_DESCR, path)); sheetSet.put(new NodeProperty<>( Bundle.CorrelationAttributeInstanceNode_columnName_comment(), - Bundle.CorrelationAttributeInstanceNode_columnName_comment(), "", "")); + Bundle.CorrelationAttributeInstanceNode_columnName_comment(), NO_DESCR, comment)); sheetSet.put(new NodeProperty<>( Bundle.CorrelationAttributeInstanceNode_columnName_device(), - Bundle.CorrelationAttributeInstanceNode_columnName_device(), "", caseName));*/ + Bundle.CorrelationAttributeInstanceNode_columnName_device(), NO_DESCR, device)); return sheet; } - - /** - * Child generator for SleuthkitCaseFileInstanceNode of - * CommonAttributeValueNode. - */ - static class FileInstanceNodeFactory extends ChildFactory { - - private final CommonAttributeValue descendants; - - FileInstanceNodeFactory(CommonAttributeValue descendants) { - this.descendants = descendants; - } - - @Override - protected boolean createKeys(List list) { - return true; - } - - /*@Override - protected Node[] createNodesForKey(AbstractCommonAttributeInstance searchResult) { - return null; - //return searchResult.generateNodes(); - }*/ - } } diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java new file mode 100755 index 0000000000..4c3c443944 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java @@ -0,0 +1,84 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 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.correlationpropertysearch; + +import org.openide.nodes.Children; +import org.openide.nodes.FilterNode; +import org.openide.nodes.Node; + +/** + * A Children implementation for a + * CorrelationPropertyFilterNode. + */ +class CorrelationPropertyFilterChildren extends FilterNode.Children { + + /** + * Create a new Children instance. + * + * @param wrappedNode The node to be wrapped. + * @param createChildren If false, return LEAF. Otherwise, return a new + * CorrelationPropertyFilterChildren instance. + * + * @return A Children instance. + */ + public static Children createInstance(Node wrappedNode, boolean createChildren) { + + if (createChildren) { + return new CorrelationPropertyFilterChildren(wrappedNode); + } else { + return Children.LEAF; + } + } + + /** + * Constructs a children (child factory) implementation for a + * CorrelationPropertyFilterNode. + * + * @param wrappedNode The node wrapped by CorrelationPropertyFilterNode. + */ + CorrelationPropertyFilterChildren(Node wrappedNode) { + super(wrappedNode); + } + + /** + * Copies a CorrelationPropertyFilterNode, with the children (child factory) + * flag set to false. + * + * @param nodeToCopy The CorrelationPropertyFilterNode to copy. + * + * @return A copy of a CorrelationPropertyFilterNode. + */ + @Override + protected Node copyNode(Node nodeToCopy) { + return new CorrelationPropertyFilterNode(nodeToCopy, false); + } + + /** + * Creates the child nodes represented by this children (child factory) + * object. + * + * @param key The key, i.e., the node, for which to create the child nodes. + * + * @return A single-element node array. + */ + @Override + protected Node[] createNodes(Node key) { + return new Node[]{this.copyNode(key)}; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java new file mode 100755 index 0000000000..fa5c1ecaa1 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java @@ -0,0 +1,134 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 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.correlationpropertysearch; + +import org.openide.nodes.FilterNode; +import org.openide.nodes.Node; +import org.openide.util.NbBundle; +import org.openide.util.lookup.Lookups; +import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo; +import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; + +/** + * FilterNode containing properties and actions for Correlation Property Search. + */ +public class CorrelationPropertyFilterNode extends FilterNode { + + private final boolean createChildren; + private final boolean forceUseWrappedDisplayName; + private String columnOrderKey = "NONE"; + + /** + * Constructs a filter node that creates at most one layer of child nodes + * for the node it wraps. It is designed to be used in the results view to + * ensure the individual viewers display only the first layer of child + * nodes. + * + * @param node The node to wrap in the filter node. + * @param createChildren True if a Children object should be created for the + * wrapped node. + */ + public CorrelationPropertyFilterNode(Node node, boolean createChildren) { + super(node, CorrelationPropertyFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); + this.forceUseWrappedDisplayName = false; + this.createChildren = createChildren; + } + + /** + * Constructs a filter node that creates at most one layer of child nodes + * for the node it wraps. It is designed to be used in the results view to + * ensure the individual viewers display only the first layer of child + * nodes. + * + * @param node The node to wrap in the filter node. + * @param createChildren True if a Children object should be created for the + * wrapped node. + * @param columnOrderKey A key that represents the type of the original + * wrapped node and what is being displayed under that node. + */ + public CorrelationPropertyFilterNode(Node node, boolean createChildren, String columnOrderKey) { + super(node, CorrelationPropertyFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); + this.forceUseWrappedDisplayName = false; + this.createChildren = createChildren; + this.columnOrderKey = columnOrderKey; + } + + /** + * Gets the display name for the wrapped node, for use in the first column + * of an Autopsy table view. + * + * @return The display name. + */ + @Override + public String getDisplayName() { + if (this.forceUseWrappedDisplayName) { + return super.getDisplayName(); + } else if (createChildren) { + return NbBundle.getMessage(this.getClass(), "TableFilterNode.displayName.text"); + } else { + return super.getDisplayName(); + } + } + + /** + * Adds information about which child node of this node, if any, should be + * selected. Can be null. + * + * @param selectedChildNodeInfo The child node selection information. + */ + public void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) { + /* + * Currently, child selection is only supported for nodes selected in + * the tree view and decorated with a DataResultFilterNode. + */ + if (getOriginal() instanceof DataResultFilterNode) { + ((DataResultFilterNode) getOriginal()).setChildNodeSelectionInfo(selectedChildNodeInfo); + } + } + + /** + * Gets information about which child node of this node, if any, should be + * selected. + * + * @return The child node selection information, or null if no child should + * be selected. + */ + public NodeSelectionInfo getChildNodeSelectionInfo() { + /* + * Currently, child selection is only supported for nodes selected in + * the tree view and decorated with a DataResultFilterNode. + */ + if (getOriginal() instanceof DataResultFilterNode) { + return ((DataResultFilterNode) getOriginal()).getChildNodeSelectionInfo(); + } else { + return null; + } + } + + /** + * @return the column order key, which allows custom column ordering to be + * written into a properties file and be reloaded for future use in a table + * with the same root node or for different cases. This is done by + * DataResultViewerTable. The key should represent what kinds of items the + * table is showing. + */ + public String getColumnOrderKey() { + return columnOrderKey; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchAction.java similarity index 55% rename from Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java rename to Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchAction.java index a231e389fb..74facdff65 100755 --- a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchAction.java +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchAction.java @@ -16,22 +16,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.md5search; +package org.sleuthkit.autopsy.correlationpropertysearch; import java.awt.event.ActionEvent; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; /** - * //DLG: + * Action for accessing the Correlation Property Search dialog. */ -public class Md5SearchAction extends CallableSystemAction { +@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.correlationpropertysearch.CorrelationPropertySearchAction") +@ActionRegistration(displayName = "#CTL_CorrelationPropertySearchAction=Correlation Property Search", lazy = false) +@ActionReference(path = "Menu/Tools", position = 104) +@NbBundle.Messages({"CTL_CorrelationPropertySearchAction=Correlation Property Search"}) +public class CorrelationPropertySearchAction extends CallableSystemAction { @Override public boolean isEnabled() { - return super.isEnabled() && Case.isCaseOpen(); + return EamDb.isEnabled() && Case.isCaseOpen(); } @Override @@ -41,15 +49,15 @@ public class Md5SearchAction extends CallableSystemAction { @Override public void performAction() { - Md5SearchDialog dialog = new Md5SearchDialog(); + CorrelationPropertySearchDialog dialog = new CorrelationPropertySearchDialog(); dialog.display(); } @NbBundle.Messages({ - "Md5SearchAction.getName.text=Correlation Attribute Search"}) + "CorrelationPropertySearchAction.getName.text=Correlation Property Search"}) @Override public String getName() { - return Bundle.Md5SearchAction_getName_text(); + return Bundle.CorrelationPropertySearchAction_getName_text(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java new file mode 100755 index 0000000000..9e1d20f2ef --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java @@ -0,0 +1,49 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 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.correlationpropertysearch; + +import java.util.List; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; + +/** + * Creates CorrelationAttributeInstanceNodes from a collection of + * CorrelationAttributeInstances. + */ +class CorrelationPropertySearchChildren extends Children.Keys { + + /** + * Create an instance of CorrelationPropertySearchChildren. + * + * @param lazy Lazy load? + * @param fileList List of CorrelationAttributeInstances. + */ + CorrelationPropertySearchChildren(boolean lazy, List instances) { + super(lazy); + this.setKeys(instances); + } + + @Override + protected Node[] createNodes(CorrelationAttributeInstance t) { + Node[] node = new Node[1]; + node[0] = new CorrelationAttributeInstanceNode(t); + return node; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form new file mode 100755 index 0000000000..347008824c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form @@ -0,0 +1,135 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java new file mode 100755 index 0000000000..f22acbfea5 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java @@ -0,0 +1,359 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 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.correlationpropertysearch; + +import java.awt.Color; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.JFrame; +import javax.swing.SwingWorker; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.commonfilesearch.CommonAttributesSearchResultsViewerTable; +import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; +import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; +import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; +import org.sleuthkit.autopsy.corecomponents.TableFilterNode; +import org.sleuthkit.autopsy.corecomponents.TextPrompt; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.EmptyNode; + +@Messages({ + "CorrelationPropertySearchDialog.title.text=Correlation Property Search", + "CorrelationPropertySearchDialog.results.text=Correlation Properties", + "CorrelationPropertySearchDialog.emptyNode.text=No results found.", + "CorrelationPropertySearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash." +}) +/** + * The Correlation Property Search dialog allows users to search for specific + * types of correlation properties in the Central Repository. + */ +public class CorrelationPropertySearchDialog extends javax.swing.JDialog { + private static final Logger logger = Logger.getLogger(CorrelationPropertySearchDialog.class.getName()); + + private static final String FILES_CORRELATION_TYPE = "Files"; + + private final List correlationTypes; + private TextPrompt correlationValueTextFieldPrompt; + + /** + * Creates a new instance of the Correlation Property Search dialog. + */ + public CorrelationPropertySearchDialog() { + super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.CorrelationPropertySearchDialog_title_text(), true); + this.correlationTypes = new ArrayList<>(); + initComponents(); + customizeComponents(); + } + + /** + * Perform the correlation property search. + */ + private void search() { + new SwingWorker, Void>() { + + @Override + protected List doInBackground() { + List correlationTypes; + List correlationInstances = new ArrayList<>(); + + try { + correlationTypes = EamDb.getInstance().getDefinedCorrelationTypes(); + for (CorrelationAttributeInstance.Type type : correlationTypes) { + if (type.getDisplayName().equals((String) correlationTypeComboBox.getSelectedItem())) { + correlationInstances = EamDb.getInstance().getArtifactInstancesByTypeValue(type, correlationValueTextField.getText()); + break; + } + } + } catch (EamDbException ex) { + logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex); + } catch (CorrelationAttributeNormalizationException ex) { + logger.log(Level.SEVERE, "Unable to retrieve data from the Central Repository.", ex); + } + + return correlationInstances; + } + + @Override + protected void done() { + try { + super.done(); + List correlationInstances = this.get(); + DataResultViewerTable table = new CommonAttributesSearchResultsViewerTable(); + Collection viewers = new ArrayList<>(1); + viewers.add(table); + + CorrelationPropertySearchNode searchNode = new CorrelationPropertySearchNode(correlationInstances); + CorrelationPropertyFilterNode tableFilterNode = new CorrelationPropertyFilterNode(searchNode, true, searchNode.getName()); + + String resultsText = String.format("%s (%s; \"%s\")", + Bundle.CorrelationPropertySearchDialog_results_text(), + (String) correlationTypeComboBox.getSelectedItem(), + correlationValueTextField.getText()); + final TopComponent searchResultWin; + if (correlationInstances.isEmpty()) { + Node emptyNode = new TableFilterNode( + new EmptyNode(Bundle.CorrelationPropertySearchDialog_emptyNode_text()), true); + searchResultWin = DataResultTopComponent.createInstance( + resultsText, Bundle.CorrelationPropertySearchDialog_title_text(), emptyNode, 0); + } else { + searchResultWin = DataResultTopComponent.createInstance( + resultsText, Bundle.CorrelationPropertySearchDialog_title_text(), tableFilterNode, HIDE_ON_CLOSE, viewers); + } + searchResultWin.requestActive(); // make it the active top component + } catch (ExecutionException | InterruptedException ex) { + logger.log(Level.SEVERE, "Unable to get CorrelationAttributeInstances.", ex); + } + } + }.execute(); + } + + /** + * 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() { + + correlationValueLabel = new javax.swing.JLabel(); + correlationValueTextField = new javax.swing.JTextField(); + searchButton = new javax.swing.JButton(); + correlationTypeComboBox = new javax.swing.JComboBox<>(); + correlationTypeLabel = new javax.swing.JLabel(); + errorLabel = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + org.openide.awt.Mnemonics.setLocalizedText(correlationValueLabel, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.correlationValueLabel.text")); // NOI18N + + correlationValueTextField.setText(org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.correlationValueTextField.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.searchButton.text")); // NOI18N + searchButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchButtonActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(correlationTypeLabel, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.correlationTypeLabel.text")); // NOI18N + + errorLabel.setForeground(new java.awt.Color(255, 0, 0)); + org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.errorLabel.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(searchButton)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(correlationValueLabel) + .addComponent(correlationTypeLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(correlationTypeComboBox, 0, 289, Short.MAX_VALUE) + .addComponent(correlationValueTextField)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(correlationTypeLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(correlationValueLabel) + .addComponent(correlationValueTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(searchButton) + .addComponent(errorLabel)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + searchButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleName")); // NOI18N + searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleDescription")); // NOI18N + + pack(); + }// //GEN-END:initComponents + + private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed + if (validateInputs()) { + /* + * Just in case, we'll lock down the type and value components to + * avoid the possibly of a race condition. + */ + correlationTypeComboBox.setEnabled(false); + correlationValueTextField.setEnabled(false); + + search(); + dispose(); + } else { + searchButton.setEnabled(false); + errorLabel.setText(Bundle.CorrelationPropertySearchDialog_validation_invalidHash()); + correlationValueTextField.grabFocus(); + } + }//GEN-LAST:event_searchButtonActionPerformed + + /** + * Further customize the components beyond the standard initialization. + */ + private void customizeComponents() { + searchButton.setEnabled(false); + + /* + * Add correlation types to the combo-box. + */ + try { + EamDb dbManager = EamDb.getInstance(); + correlationTypes.clear(); + correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); + } catch (EamDbException ex) { + Exceptions.printStackTrace(ex); + } + + for (CorrelationAttributeInstance.Type type : correlationTypes) { + // We only support the "Files" type for now. + if (type.getDisplayName().equals(FILES_CORRELATION_TYPE)) { + correlationTypeComboBox.addItem(type.getDisplayName()); + } + } + correlationTypeComboBox.setSelectedIndex(0); + + correlationTypeComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + updateSearchButton(); + } + }); + + /* + * Create listener for text input. + */ + correlationValueTextField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void changedUpdate(DocumentEvent e) { + updateSearchButton(); + } + + @Override + public void insertUpdate(DocumentEvent e) { + updateSearchButton(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updateSearchButton(); + } + }); + + updateCorrelationValueTextFieldPrompt(); + } + + @Messages({ + "CorrelationPropertySearchDialog.correlationValueTextField.filesExample=Example: \"f0e1d2c3b4a5968778695a4b3c2d1e0f\"" + }) + /** + * Update the text prompt of the name text field based on the input type + * selection. + */ + private void updateCorrelationValueTextFieldPrompt() { + /** + * Add text prompt to the text field. + */ + String text = Bundle.CorrelationPropertySearchDialog_correlationValueTextField_filesExample(); + correlationValueTextFieldPrompt = new TextPrompt(text, correlationValueTextField); + + /** + * Sets the foreground color and transparency of the text prompt. + */ + correlationValueTextFieldPrompt.setForeground(Color.LIGHT_GRAY); + correlationValueTextFieldPrompt.changeAlpha(0.9f); // Mostly opaque + + validate(); + repaint(); + } + + /** + * Enable or disable the Search button depending on whether or not text has + * been provided for the correlation property value. + */ + private void updateSearchButton() { + searchButton.setEnabled(correlationValueTextField.getText().isEmpty() == false); + } + + /** + * Validate the value input. + * + * @return True if the input is valid for the selected type; otherwise false. + */ + private boolean validateInputs() { + Pattern md5Pattern = Pattern.compile("^[a-fA-F0-9]{32}$"); // NON-NLS + Matcher matcher = md5Pattern.matcher(correlationValueTextField.getText().trim()); + if (matcher.find()) { + return true; + } + return false; + } + + /** + * Display the Correlation Property Search dialog. + */ + public void display() { + this.setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); + setVisible(true); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox correlationTypeComboBox; + private javax.swing.JLabel correlationTypeLabel; + private javax.swing.JLabel correlationValueLabel; + private javax.swing.JTextField correlationValueTextField; + private javax.swing.JLabel errorLabel; + private javax.swing.JButton searchButton; + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java new file mode 100755 index 0000000000..17b1d979c4 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java @@ -0,0 +1,50 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 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.correlationpropertysearch; + +import java.util.List; +import org.openide.nodes.AbstractNode; +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; + +/** + * Parent node to CorrelationPropertySearchChildren. + */ +class CorrelationPropertySearchNode extends AbstractNode { + + private CorrelationPropertySearchChildren children; + + /** + * Create an instance of CorrelationPropertySearchNode. + * + * @param keys The list of CorrelationAttributeInstances. + */ + CorrelationPropertySearchNode(List keys) { + super(new CorrelationPropertySearchChildren(true, keys)); + this.children = (CorrelationPropertySearchChildren) this.getChildren(); + } + + @Messages({ + "CorrelationPropertySearchNode.getName.text=Correlation Property Search" + }) + @Override + public String getName() { + return Bundle.CorrelationPropertySearchNode_getName_text(); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java index dbd06ac8dc..d9d2ffea84 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java @@ -29,8 +29,7 @@ import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootChildren.FileSizeNod import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootNode; import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesNode; import org.sleuthkit.autopsy.datamodel.accounts.Accounts; -import org.sleuthkit.autopsy.md5search.CorrelationAttributeInstanceChildNode; -import org.sleuthkit.autopsy.md5search.DlgCorrelationAttributeInstanceNode; +import org.sleuthkit.autopsy.correlationpropertysearch.CorrelationAttributeInstanceNode; /** * Visitor pattern that goes over all nodes in the directory tree. This includes @@ -128,9 +127,7 @@ public interface DisplayableItemNodeVisitor { T visit(InstanceCountNode icn); - T visit(CorrelationAttributeInstanceChildNode caicn); - - T visit(DlgCorrelationAttributeInstanceNode cain); //DLG: + T visit(CorrelationAttributeInstanceNode cain); /* * Tags @@ -221,12 +218,7 @@ public interface DisplayableItemNodeVisitor { } @Override - public T visit(CorrelationAttributeInstanceChildNode caicn){ - return defaultVisit(caicn); - } - - @Override - public T visit(DlgCorrelationAttributeInstanceNode cain) { + public T visit(CorrelationAttributeInstanceNode cain) { return defaultVisit(cain); } diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties b/Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties deleted file mode 100755 index 59bdbf31bf..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/Bundle.properties +++ /dev/null @@ -1,6 +0,0 @@ - -Md5SearchDialog.jButton1.text=Search -Md5SearchDialog.jTextField1.text= -Md5SearchDialog.jLabel1.text=Correlation Property Value: -Md5SearchDialog.jLabel2.text=Correlation Property Type: -Md5SearchDialog.jTextArea1.text=Type a value into the Correlation Property Value field. When the input type is detected, the Correlation Property Type field will become available and default to the detected input type. diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java deleted file mode 100755 index 49c525bd7a..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNode.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import javax.swing.Action; -import org.openide.nodes.Children; -import org.openide.nodes.Sheet; -import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.commonfilesearch.CaseDBCommonAttributeInstanceNode; -import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; -import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; -import org.sleuthkit.autopsy.datamodel.NodeProperty; - -/** - * //DLG: - */ -public final class CorrelationAttributeInstanceChildNode extends DisplayableItemNode { - private String caseName; - private String dataSourceName; - //DLG: final ? knownStatus - private String fullPath; - //DLG: final String comment - //DLG: final String deviceId - private String name; - private String parent; - - public CorrelationAttributeInstanceChildNode(Children children) { - super(children); - } - - //CorrelationAttributeInstanceChildNode(Children children) { - // init(null); - //} - - private void init(Map map) { - caseName = (String)map.get("caseName"); - dataSourceName = (String)map.get("dataSourceName"); - fullPath = (String)map.get("fullPath"); - name = (String)map.get("name"); - parent = (String)map.get("parent"); - } - - @Override - public Action[] getActions(boolean context){ - List actionsList = new ArrayList<>(); - - actionsList.addAll(Arrays.asList(super.getActions(true))); - - return actionsList.toArray(new Action[actionsList.size()]); - } - - /*@Override - public T accept(DisplayableItemNodeVisitor visitor) { - return visitor.visit(this); - }*/ - - @Override - public T accept(DisplayableItemNodeVisitor visitor) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean isLeafTypeNode() { - return true; - } - - @Override - public String getItemType() { - //objects of type FileNode will co-occur in the treetable with objects - // of this type and they will need to provide the same key - return CorrelationAttributeInstanceChildNode.class.getName(); - } - - @NbBundle.Messages({ - "CorrelationAttributeInstanceChildNode.columnName.case=Case", - "CorrelationAttributeInstanceChildNode.columnName.dataSource=Data Source", - "CorrelationAttributeInstanceChildNode.columnName.known=Known", - "CorrelationAttributeInstanceChildNode.columnName.path=Path", - "CorrelationAttributeInstanceChildNode.columnName.comment=Comment", - "CorrelationAttributeInstanceChildNode.columnName.device=Device" - }) - @Override - protected Sheet createSheet(){ - Sheet sheet = new Sheet(); - Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); - - if(sheetSet == null){ - sheetSet = Sheet.createPropertiesSet(); - sheet.put(sheetSet); - } - - - sheetSet.put(new NodeProperty<>( - Bundle.CorrelationAttributeInstanceNode_columnName_case(), - Bundle.CorrelationAttributeInstanceNode_columnName_case(), "", name)); - sheetSet.put(new NodeProperty<>( - Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), - Bundle.CorrelationAttributeInstanceNode_columnName_dataSource(), "", parent)); - sheetSet.put(new NodeProperty<>( - Bundle.CorrelationAttributeInstanceNode_columnName_known(), - Bundle.CorrelationAttributeInstanceNode_columnName_known(), "", "")); - sheetSet.put(new NodeProperty<>( - Bundle.CorrelationAttributeInstanceNode_columnName_path(), - Bundle.CorrelationAttributeInstanceNode_columnName_path(), "", dataSourceName)); - sheetSet.put(new NodeProperty<>( - Bundle.CorrelationAttributeInstanceNode_columnName_comment(), - Bundle.CorrelationAttributeInstanceNode_columnName_comment(), "", "")); - sheetSet.put(new NodeProperty<>( - Bundle.CorrelationAttributeInstanceNode_columnName_device(), - Bundle.CorrelationAttributeInstanceNode_columnName_device(), "", caseName)); - - return sheet; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java deleted file mode 100755 index b30a11e06f..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeInstanceChildNodeFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import java.io.File; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.openide.nodes.ChildFactory; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.datamodel.KeyValue; -import org.sleuthkit.autopsy.datamodel.KeyValueNode; - -/** - * //DLG: - */ -final class CorrelationAttributeInstanceChildNodeFactory extends ChildFactory { - private final Collection correlationInstances; - - CorrelationAttributeInstanceChildNodeFactory(Collection correlationInstances) { - this.correlationInstances = correlationInstances; - } - - @Override - protected boolean createKeys(List list) { - for (CorrelationAttributeInstance instance : correlationInstances) { - Map properties = new HashMap<>(); //DLG: - - final String caseName = instance.getCorrelationCase().getDisplayName(); - final String dataSourceName = instance.getCorrelationDataSource().getName(); - //DLG: final ? knownStatus - final String fullPath = instance.getFilePath(); - //DLG: final String comment - //DLG: final String deviceId - - final File file = new File(fullPath); - final String name = file.getName(); - final String parent = file.getParent(); - - properties.put("caseName", caseName); - properties.put("dataSourceName", dataSourceName); - properties.put("knownStatus", ""); //DLG: - properties.put("fullPath", fullPath); - properties.put("comment", ""); //DLG: - properties.put("deviceId", ""); //DLG: - properties.put("name", name); - properties.put("parent", parent); - - list.add(new KeyValue(String.valueOf(instance.getID()), properties, instance.getID())); - } - return true; - } - - @Override - protected Node createNodeForKey(KeyValue key) { - Map map = key.getMap(); - Node kvNode = new KeyValueNode(key, Children.LEAF, Lookups.fixed(correlationInstances.toArray())); - //DLG: Node resultNode = new CorrelationAttributeInstanceChildNode(kvNode); - return null; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java b/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java deleted file mode 100755 index 5c1e0ee004..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/CorrelationAttributeSearchResults.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import java.util.ArrayList; -import java.util.List; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; - -/** - * //DLG: - */ -public class CorrelationAttributeSearchResults { - List correlationInstances = new ArrayList<>(); - - CorrelationAttributeSearchResults(List correlationInstances) { - this.correlationInstances = correlationInstances; - } - - List getCorrelationAttributeInstances() { - return correlationInstances; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java deleted file mode 100755 index 1e6a51850c..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/DlgCorrelationAttributeInstanceNode.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Autopsy Forensic Browser - * - * Copyright 2018 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.md5search; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.swing.Action; -import org.openide.nodes.Children; -import org.openide.nodes.Sheet; -import org.openide.util.NbBundle; -import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; -import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; -import org.sleuthkit.autopsy.datamodel.NodeProperty; - -/** - * Used by the Common Files search feature to encapsulate instances of a given - * MD5s matched in the search. These nodes will be children of Md5Nodes. - * - * Use this type for files which are not in the current case, but from the - * Central Repo. Contrast with SleuthkitCase which should be used - * when the FileInstance was found in the case presently open in Autopsy. - */ -public class DlgCorrelationAttributeInstanceNode extends DisplayableItemNode { - - private final CorrelationAttributeInstance crFile; - - DlgCorrelationAttributeInstanceNode(CorrelationAttributeInstance content) { - super(Children.LEAF, Lookups.fixed(content)); - this.crFile = content; - this.setDisplayName(new File(this.crFile.getFilePath()).getName()); - } - - public CorrelationAttributeInstance getCorrelationAttributeInstance(){ - return this.crFile; - } - - @Override - public Action[] getActions(boolean context){ - List actionsList = new ArrayList<>(); - - actionsList.addAll(Arrays.asList(super.getActions(true))); - - return actionsList.toArray(new Action[actionsList.size()]); - } - - @Override - public T accept(DisplayableItemNodeVisitor visitor) { - return visitor.visit(this); - } - - @Override - public boolean isLeafTypeNode() { - return true; - } - - @Override - public String getItemType() { - //objects of type FileNode will co-occur in the treetable with objects - // of this type and they will need to provide the same key - return DlgCorrelationAttributeInstanceNode.class.getName(); - } - - @NbBundle.Messages({ - "DlgCorrelationAttributeInstanceNode.columnName.name=Name", - "DlgCorrelationAttributeInstanceNode.columnName.case=Case", - "DlgCorrelationAttributeInstanceNode.columnName.dataSource=Data Source", - "DlgCorrelationAttributeInstanceNode.columnName.known=Known", - "DlgCorrelationAttributeInstanceNode.columnName.path=Path", - "DlgCorrelationAttributeInstanceNode.columnName.comment=Comment", - "DlgCorrelationAttributeInstanceNode.columnName.device=Device" - }) - @Override - protected Sheet createSheet(){ - Sheet sheet = new Sheet(); - Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); - - if(sheetSet == null){ - sheetSet = Sheet.createPropertiesSet(); - sheet.put(sheetSet); - } - - final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance(); - - final String path = centralRepoFile.getFilePath(); - final File file = new File(path); - final String name = file.getName(); - //DLG: final String parent = file.getParent(); - final String caseName = centralRepoFile.getCorrelationCase().getDisplayName(); - final CorrelationDataSource dataSource = centralRepoFile.getCorrelationDataSource(); - final String dataSourceName = dataSource.getName(); - final String known = centralRepoFile.getKnownStatus().getName(); - final String comment = centralRepoFile.getComment(); - final String device = dataSource.getDeviceID(); - - final String NO_DESCR = ""; - - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_name(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_name(), NO_DESCR, name)); - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_case(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_case(), NO_DESCR, caseName)); - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_dataSource(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_dataSource(), NO_DESCR, dataSourceName)); - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_known(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_known(), NO_DESCR, known)); - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_path(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_path(), NO_DESCR, path)); - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_comment(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_comment(), NO_DESCR, comment)); - sheetSet.put(new NodeProperty<>( - Bundle.DlgCorrelationAttributeInstanceNode_columnName_device(), - Bundle.DlgCorrelationAttributeInstanceNode_columnName_device(), NO_DESCR, device)); - - return sheet; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java deleted file mode 100755 index 6ca7c7540c..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterChildren.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import org.openide.nodes.Children; -import org.openide.nodes.FilterNode; -import org.openide.nodes.Node; - -/** - * //DLG: - */ -class DlgFilterChildren extends FilterNode.Children { - - public static Children createInstance(Node wrappedNode, boolean createChildren) { - - if (createChildren) { - return new DlgFilterChildren(wrappedNode); - } else { - return Children.LEAF; - } - } - - DlgFilterChildren(Node wrappedNode) { - super(wrappedNode); - } - - @Override - protected Node copyNode(Node nodeToCopy) { - return new DlgFilterNode(nodeToCopy, false); - } - - @Override - protected Node[] createNodes(Node key) { - return new Node[]{this.copyNode(key)}; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java deleted file mode 100755 index c746637544..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/DlgFilterNode.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import org.openide.nodes.FilterNode; -import org.openide.nodes.Node; -import org.openide.util.NbBundle; -import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo; -import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; - -/** - * //DLG: - */ -public class DlgFilterNode extends FilterNode { - - private final boolean createChildren; - private final boolean forceUseWrappedDisplayName; - private String columnOrderKey = "NONE"; - - public DlgFilterNode(Node node, boolean createChildren) { - super(node, DlgFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); - this.forceUseWrappedDisplayName = false; - this.createChildren = createChildren; - } - - public DlgFilterNode(Node node, boolean createChildren, String columnOrderKey) { - super(node, DlgFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); - this.forceUseWrappedDisplayName = false; - this.createChildren = createChildren; - this.columnOrderKey = columnOrderKey; - } - - /*public DlgFilterNode(Node node, int childLayerDepth) { - super(node, TableFilterChildrenWithDescendants.createInstance(node, childLayerDepth), Lookups.proxy(node)); - this.createChildren = true; - this.forceUseWrappedDisplayName = true; - }*/ - - @Override - public String getDisplayName() { - if (this.forceUseWrappedDisplayName) { - return super.getDisplayName(); - } else if (createChildren) { - return NbBundle.getMessage(this.getClass(), "TableFilterNode.displayName.text"); - } else { - return super.getDisplayName(); - } - } - - public void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) { - /* - * Currently, child selection is only supported for nodes selected in - * the tree view and decorated with a DataResultFilterNode. - */ - if (getOriginal() instanceof DataResultFilterNode) { - ((DataResultFilterNode) getOriginal()).setChildNodeSelectionInfo(selectedChildNodeInfo); - } - } - - public NodeSelectionInfo getChildNodeSelectionInfo() { - /* - * Currently, child selection is only supported for nodes selected in - * the tree view and decorated with a DataResultFilterNode. - */ - if (getOriginal() instanceof DataResultFilterNode) { - return ((DataResultFilterNode) getOriginal()).getChildNodeSelectionInfo(); - } else { - return null; - } - } - - public String getColumnOrderKey() { - return columnOrderKey; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java deleted file mode 100755 index 3f2c2ad403..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchChildren.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import java.util.List; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; -import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; -import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent; - -/** - * //DLG: - */ -class DlgSearchChildren extends Children.Keys { - - DlgSearchChildren(boolean lazy, List fileList) { - super(lazy); - this.setKeys(fileList); - } - - @Override - protected Node[] createNodes(CorrelationAttributeInstance t) { - //DLG: - Node[] node = new Node[1]; - //DLG: - node[0] = new DlgCorrelationAttributeInstanceNode(t); - return node; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java b/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java deleted file mode 100755 index 6d1a75d39b..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/DlgSearchNode.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import java.util.List; -import org.openide.nodes.AbstractNode; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; - -/** - * //DLG: - */ -class DlgSearchNode extends AbstractNode { - - private DlgSearchChildren children; - - DlgSearchNode(List keys) { - super(new DlgSearchChildren(true, keys)); - this.children = (DlgSearchChildren) this.getChildren(); - } - - @Override - public String getName() { - //DLG: - return /*NbBundle.getMessage(this.getClass(), */"SearchNode.getName.text"/*)*/; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form deleted file mode 100755 index 2ecd2f4475..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.form +++ /dev/null @@ -1,145 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java b/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java deleted file mode 100755 index 3d6413e82a..0000000000 --- a/Core/src/org/sleuthkit/autopsy/md5search/Md5SearchDialog.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.md5search; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.swing.JFrame; -import javax.swing.SwingWorker; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import org.openide.explorer.ExplorerManager; -import org.openide.nodes.AbstractNode; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -import org.openide.util.Exceptions; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults; -import org.sleuthkit.autopsy.commonfilesearch.CommonAttributesSearchResultsViewerTable; -import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; -import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; -import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; -import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; - -/** - * - * @author dgrove - */ -public class Md5SearchDialog extends javax.swing.JDialog { - private static final String FILES_CORRELATION_TYPE = "Files"; - private final List correlationTypes; - private final Pattern md5Pattern; - - /** - * Creates new form Md5SearchDialog - */ - @NbBundle.Messages({"Md5SearchDialog.title=Correlation Property Search"}) - public Md5SearchDialog() { - super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.Md5SearchDialog_title(), true); - this.correlationTypes = new ArrayList<>(); - this.md5Pattern = Pattern.compile("^[a-fA-F0-9]{32}$"); // NON-NLS - initComponents(); - customizeComponents(); - } - - private void search() { - new SwingWorker, Void>() { - - @Override - protected List doInBackground() { - List correlationTypes; - List correlationInstances = new ArrayList<>(); - - try { - correlationTypes = EamDb.getInstance().getDefinedCorrelationTypes(); - for (CorrelationAttributeInstance.Type type : correlationTypes) { - if (type.getId() == CorrelationAttributeInstance.FILES_TYPE_ID) { - correlationInstances = EamDb.getInstance().getArtifactInstancesByTypeValue(type, jTextField1.getText()); - break; - } - } - } catch (Exception ex) { - //DLG: - } - - return correlationInstances; - } - - @Override - protected void done() { - try { - super.done(); - List correlationInstances = this.get(); - //DLG: Node rootNode = new CorrelationAttributeInstanceRootNode(searchResults); - //DataResultFilterNode dataResultFilterNode = new DataResultFilterNode(rootNode, ExplorerManager.find(Md5SearchDialog.this)); - //TableFilterNode tableFilterWithDescendantsNode = new TableFilterNode(dataResultFilterNode, 3); - DataResultViewerTable table = new CommonAttributesSearchResultsViewerTable(); - Collection viewers = new ArrayList<>(1); - viewers.add(table); - - DlgSearchNode searchNode = new DlgSearchNode(correlationInstances); - DlgFilterNode tableFilterNode = new DlgFilterNode(searchNode, true, searchNode.getName()); - - //Node rootNode; - //Children childNodes = Children.create(new CorrelationAttributeInstanceChildNodeFactory(correlationInstances), true); - //rootNode = new AbstractNode(childNodes); - DataResultTopComponent results = DataResultTopComponent.createInstance( - "Files", "Correlation Property Search", tableFilterNode, HIDE_ON_CLOSE, viewers); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); //DLG: - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); //DLG: - } - } - }.execute(); - } - - /** - * 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() { - - jLabel1 = new javax.swing.JLabel(); - jTextField1 = new javax.swing.JTextField(); - jButton1 = new javax.swing.JButton(); - correlationTypeComboBox = new javax.swing.JComboBox<>(); - jLabel2 = new javax.swing.JLabel(); - jScrollPane1 = new javax.swing.JScrollPane(); - jTextArea1 = new javax.swing.JTextArea(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setResizable(false); - - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jLabel1.text")); // NOI18N - - jTextField1.setText(org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jTextField1.text")); // NOI18N - jTextField1.addInputMethodListener(new java.awt.event.InputMethodListener() { - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } - public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { - jTextField1InputMethodTextChanged(evt); - } - }); - jTextField1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - jTextField1PropertyChange(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jButton1.text")); // NOI18N - jButton1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton1ActionPerformed(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jLabel2.text")); // NOI18N - - jTextArea1.setEditable(false); - jTextArea1.setColumns(20); - jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N - jTextArea1.setLineWrap(true); - jTextArea1.setRows(5); - jTextArea1.setText(org.openide.util.NbBundle.getMessage(Md5SearchDialog.class, "Md5SearchDialog.jTextArea1.text")); // NOI18N - jTextArea1.setWrapStyleWord(true); - jTextArea1.setBorder(null); - jTextArea1.setOpaque(false); - jScrollPane1.setViewportView(jTextArea1); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(11, 11, 11) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel2) - .addComponent(jLabel1)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(correlationTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel2)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jButton1) - .addContainerGap()) - ); - - pack(); - }// //GEN-END:initComponents - - private void jTextField1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField1PropertyChange - //DLG: - }//GEN-LAST:event_jTextField1PropertyChange - - private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed - search(); - }//GEN-LAST:event_jButton1ActionPerformed - - private void jTextField1InputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jTextField1InputMethodTextChanged - //DLG: - }//GEN-LAST:event_jTextField1InputMethodTextChanged - - private void customizeComponents() { - jButton1.setEnabled(false); - correlationTypeComboBox.setEnabled(false); - - /* - * Add correlation types to the combo-box. - */ - try { - EamDb dbManager = EamDb.getInstance(); - correlationTypes.clear(); - correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); - } catch (EamDbException ex) { - Exceptions.printStackTrace(ex); - } - - for (CorrelationAttributeInstance.Type type : correlationTypes) { - correlationTypeComboBox.addItem(type.getDisplayName()); - } - - /* - * Create listener for text input. - */ - jTextField1.getDocument().addDocumentListener(new DocumentListener() { - @Override - public void changedUpdate(DocumentEvent e) { - validateInput(); - } - - @Override - public void insertUpdate(DocumentEvent e) { - validateInput(); - } - - @Override - public void removeUpdate(DocumentEvent e) { - validateInput(); - } - - private void validateInput() { - Matcher matcher = md5Pattern.matcher(jTextField1.getText().trim()); - if (matcher.find()) { - jButton1.setEnabled(true); - correlationTypeComboBox.setEnabled(true); - correlationTypeComboBox.setSelectedItem(FILES_CORRELATION_TYPE); - } else { - jButton1.setEnabled(false); - correlationTypeComboBox.setEnabled(false); - } - } - }); - } - - public void display() { - this.setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); - setVisible(true); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JComboBox correlationTypeComboBox; - private javax.swing.JButton jButton1; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JTextArea jTextArea1; - private javax.swing.JTextField jTextField1; - // End of variables declaration//GEN-END:variables -} diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportWizardAction.java b/Core/src/org/sleuthkit/autopsy/report/ReportWizardAction.java index 618cba2a38..8ed4c46111 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportWizardAction.java @@ -50,8 +50,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact; @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.report.ReportWizardAction") @ActionRegistration(displayName = "#CTL_ReportWizardAction", lazy = false) @ActionReferences(value = { - @ActionReference(path = "Menu/Tools", position = 103), - @ActionReference(path = "Toolbars/Case", position = 103)}) + @ActionReference(path = "Menu/Tools", position = 105), + @ActionReference(path = "Toolbars/Case", position = 105)}) public final class ReportWizardAction extends CallableSystemAction implements Presenter.Toolbar, ActionListener { private final JButton toolbarButton = new JButton(); diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardOpenAction.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardOpenAction.java index 45563a4f4b..56f13e172a 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardOpenAction.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardOpenAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017 Basis Technology Corp. + * Copyright 2017-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,7 @@ import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.experimental.autoingest.AutoIngestDashboardOpenAction") -@ActionReference(path = "Menu/Tools", position = 104) +@ActionReference(path = "Menu/Tools", position = 106) @ActionRegistration(displayName = "#CTL_AutoIngestDashboardOpenAction", lazy = false) @Messages({"CTL_AutoIngestDashboardOpenAction=Auto Ingest Dashboard"}) public final class AutoIngestDashboardOpenAction extends CallableSystemAction { From 4b804ed22660b07fd037fe4b112e2d86304ec719 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Thu, 15 Nov 2018 10:03:08 -0500 Subject: [PATCH 3/6] Updated access modifiers. --- .../CorrelationAttributeInstanceNode.java | 2 +- .../CorrelationPropertyFilterChildren.java | 4 ++-- .../CorrelationPropertyFilterNode.java | 12 ++++++------ .../CorrelationPropertySearchDialog.java | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java index c277154033..e0b1b378c0 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java @@ -37,7 +37,7 @@ import org.sleuthkit.autopsy.datamodel.NodeProperty; * Used by the Correlation Property Search feature to encapsulate instances of a * given search match. */ -public class CorrelationAttributeInstanceNode extends DisplayableItemNode { +public final class CorrelationAttributeInstanceNode extends DisplayableItemNode { private final CorrelationAttributeInstance instance; diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java index 4c3c443944..04a6ebf605 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java @@ -26,7 +26,7 @@ import org.openide.nodes.Node; * A Children implementation for a * CorrelationPropertyFilterNode. */ -class CorrelationPropertyFilterChildren extends FilterNode.Children { +final class CorrelationPropertyFilterChildren extends FilterNode.Children { /** * Create a new Children instance. @@ -37,7 +37,7 @@ class CorrelationPropertyFilterChildren extends FilterNode.Children { * * @return A Children instance. */ - public static Children createInstance(Node wrappedNode, boolean createChildren) { + static Children createInstance(Node wrappedNode, boolean createChildren) { if (createChildren) { return new CorrelationPropertyFilterChildren(wrappedNode); diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java index fa5c1ecaa1..bca214edb9 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java @@ -28,7 +28,7 @@ import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; /** * FilterNode containing properties and actions for Correlation Property Search. */ -public class CorrelationPropertyFilterNode extends FilterNode { +final class CorrelationPropertyFilterNode extends FilterNode { private final boolean createChildren; private final boolean forceUseWrappedDisplayName; @@ -44,7 +44,7 @@ public class CorrelationPropertyFilterNode extends FilterNode { * @param createChildren True if a Children object should be created for the * wrapped node. */ - public CorrelationPropertyFilterNode(Node node, boolean createChildren) { + CorrelationPropertyFilterNode(Node node, boolean createChildren) { super(node, CorrelationPropertyFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); this.forceUseWrappedDisplayName = false; this.createChildren = createChildren; @@ -62,7 +62,7 @@ public class CorrelationPropertyFilterNode extends FilterNode { * @param columnOrderKey A key that represents the type of the original * wrapped node and what is being displayed under that node. */ - public CorrelationPropertyFilterNode(Node node, boolean createChildren, String columnOrderKey) { + CorrelationPropertyFilterNode(Node node, boolean createChildren, String columnOrderKey) { super(node, CorrelationPropertyFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); this.forceUseWrappedDisplayName = false; this.createChildren = createChildren; @@ -92,7 +92,7 @@ public class CorrelationPropertyFilterNode extends FilterNode { * * @param selectedChildNodeInfo The child node selection information. */ - public void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) { + void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) { /* * Currently, child selection is only supported for nodes selected in * the tree view and decorated with a DataResultFilterNode. @@ -109,7 +109,7 @@ public class CorrelationPropertyFilterNode extends FilterNode { * @return The child node selection information, or null if no child should * be selected. */ - public NodeSelectionInfo getChildNodeSelectionInfo() { + NodeSelectionInfo getChildNodeSelectionInfo() { /* * Currently, child selection is only supported for nodes selected in * the tree view and decorated with a DataResultFilterNode. @@ -128,7 +128,7 @@ public class CorrelationPropertyFilterNode extends FilterNode { * DataResultViewerTable. The key should represent what kinds of items the * table is showing. */ - public String getColumnOrderKey() { + String getColumnOrderKey() { return columnOrderKey; } } diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java index f22acbfea5..6dc500d471 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java @@ -61,7 +61,7 @@ import org.sleuthkit.autopsy.datamodel.EmptyNode; * The Correlation Property Search dialog allows users to search for specific * types of correlation properties in the Central Repository. */ -public class CorrelationPropertySearchDialog extends javax.swing.JDialog { +final class CorrelationPropertySearchDialog extends javax.swing.JDialog { private static final Logger logger = Logger.getLogger(CorrelationPropertySearchDialog.class.getName()); private static final String FILES_CORRELATION_TYPE = "Files"; @@ -72,7 +72,7 @@ public class CorrelationPropertySearchDialog extends javax.swing.JDialog { /** * Creates a new instance of the Correlation Property Search dialog. */ - public CorrelationPropertySearchDialog() { + CorrelationPropertySearchDialog() { super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.CorrelationPropertySearchDialog_title_text(), true); this.correlationTypes = new ArrayList<>(); initComponents(); From 9ee54cf46e28764cace739433c6b8d880b4c0019 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Thu, 15 Nov 2018 11:58:22 -0500 Subject: [PATCH 4/6] Renamed feature; added description to dialog. --- .../Bundle.properties | 7 -- .../datamodel/DisplayableItemNodeVisitor.java | 2 +- .../othercasessearch/Bundle.properties | 9 +++ .../CorrelationAttributeInstanceNode.java | 7 +- .../OtherCasesFilterChildren.java} | 10 +-- .../OtherCasesFilterNode.java} | 14 ++-- .../OtherCasesSearchAction.java} | 19 ++--- .../OtherCasesSearchChildren.java} | 8 +- .../OtherCasesSearchDialog.form} | 31 +++++--- .../OtherCasesSearchDialog.java} | 74 +++++++++++-------- .../OtherCasesSearchNode.java} | 21 +++--- 11 files changed, 115 insertions(+), 87 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties create mode 100755 Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch => othercasessearch}/CorrelationAttributeInstanceNode.java (96%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertyFilterChildren.java => othercasessearch/OtherCasesFilterChildren.java} (87%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertyFilterNode.java => othercasessearch/OtherCasesFilterNode.java} (88%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertySearchAction.java => othercasessearch/OtherCasesSearchAction.java} (67%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertySearchChildren.java => othercasessearch/OtherCasesSearchChildren.java} (81%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertySearchDialog.form => othercasessearch/OtherCasesSearchDialog.form} (70%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertySearchDialog.java => othercasessearch/OtherCasesSearchDialog.java} (80%) rename Core/src/org/sleuthkit/autopsy/{correlationpropertysearch/CorrelationPropertySearchNode.java => othercasessearch/OtherCasesSearchNode.java} (61%) diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties deleted file mode 100755 index e3ceab0960..0000000000 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/Bundle.properties +++ /dev/null @@ -1,7 +0,0 @@ -CorrelationPropertySearchDialog.errorLabel.text= -CorrelationPropertySearchDialog.correlationValueTextField.text= -CorrelationPropertySearchDialog.correlationTypeLabel.text=Correlation Property Type: -CorrelationPropertySearchDialog.correlationValueLabel.text=Correlation Property Value: -CorrelationPropertySearchDialog.searchButton.text=Search -CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleName=Search -CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleDescription= diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java index d9d2ffea84..df1358833f 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNodeVisitor.java @@ -29,7 +29,7 @@ import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootChildren.FileSizeNod import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootNode; import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesNode; import org.sleuthkit.autopsy.datamodel.accounts.Accounts; -import org.sleuthkit.autopsy.correlationpropertysearch.CorrelationAttributeInstanceNode; +import org.sleuthkit.autopsy.othercasessearch.CorrelationAttributeInstanceNode; /** * Visitor pattern that goes over all nodes in the directory tree. This includes diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties new file mode 100755 index 0000000000..ff51e4ca22 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties @@ -0,0 +1,9 @@ + +OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription= +OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleName=Search +OtherCasesSearchDialog.searchButton.text=Search +OtherCasesSearchDialog.correlationValueTextField.text= +OtherCasesSearchDialog.correlationValueLabel.text=Correlation Property Value: +OtherCasesSearchDialog.descriptionLabel.text=Search data in the Central Repository from other cases. +OtherCasesSearchDialog.errorLabel.text= +OtherCasesSearchDialog.correlationTypeLabel.text=Correlation Property Type: diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/CorrelationAttributeInstanceNode.java similarity index 96% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/CorrelationAttributeInstanceNode.java index e0b1b378c0..f3248d293b 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationAttributeInstanceNode.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/CorrelationAttributeInstanceNode.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import java.io.File; import java.util.ArrayList; @@ -29,13 +29,14 @@ import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; +import org.sleuthkit.autopsy.othercasessearch.Bundle; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; import org.sleuthkit.autopsy.datamodel.NodeProperty; /** - * Used by the Correlation Property Search feature to encapsulate instances of a - * given search match. + * Used by the Other Cases Search feature to encapsulate instances of a given + * search match. */ public final class CorrelationAttributeInstanceNode extends DisplayableItemNode { diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java similarity index 87% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java index 04a6ebf605..72edf98cd9 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterChildren.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import org.openide.nodes.Children; import org.openide.nodes.FilterNode; @@ -26,7 +26,7 @@ import org.openide.nodes.Node; * A Children implementation for a * CorrelationPropertyFilterNode. */ -final class CorrelationPropertyFilterChildren extends FilterNode.Children { +final class OtherCasesFilterChildren extends FilterNode.Children { /** * Create a new Children instance. @@ -40,7 +40,7 @@ final class CorrelationPropertyFilterChildren extends FilterNode.Children { static Children createInstance(Node wrappedNode, boolean createChildren) { if (createChildren) { - return new CorrelationPropertyFilterChildren(wrappedNode); + return new OtherCasesFilterChildren(wrappedNode); } else { return Children.LEAF; } @@ -52,7 +52,7 @@ final class CorrelationPropertyFilterChildren extends FilterNode.Children { * * @param wrappedNode The node wrapped by CorrelationPropertyFilterNode. */ - CorrelationPropertyFilterChildren(Node wrappedNode) { + OtherCasesFilterChildren(Node wrappedNode) { super(wrappedNode); } @@ -66,7 +66,7 @@ final class CorrelationPropertyFilterChildren extends FilterNode.Children { */ @Override protected Node copyNode(Node nodeToCopy) { - return new CorrelationPropertyFilterNode(nodeToCopy, false); + return new OtherCasesFilterNode(nodeToCopy, false); } /** diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java similarity index 88% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java index bca214edb9..8cf27fd507 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertyFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import org.openide.nodes.FilterNode; import org.openide.nodes.Node; @@ -26,9 +26,9 @@ import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo; import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; /** - * FilterNode containing properties and actions for Correlation Property Search. + * FilterNode containing properties and actions for the other cases search. */ -final class CorrelationPropertyFilterNode extends FilterNode { +final class OtherCasesFilterNode extends FilterNode { private final boolean createChildren; private final boolean forceUseWrappedDisplayName; @@ -44,8 +44,8 @@ final class CorrelationPropertyFilterNode extends FilterNode { * @param createChildren True if a Children object should be created for the * wrapped node. */ - CorrelationPropertyFilterNode(Node node, boolean createChildren) { - super(node, CorrelationPropertyFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); + OtherCasesFilterNode(Node node, boolean createChildren) { + super(node, OtherCasesFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); this.forceUseWrappedDisplayName = false; this.createChildren = createChildren; } @@ -62,8 +62,8 @@ final class CorrelationPropertyFilterNode extends FilterNode { * @param columnOrderKey A key that represents the type of the original * wrapped node and what is being displayed under that node. */ - CorrelationPropertyFilterNode(Node node, boolean createChildren, String columnOrderKey) { - super(node, CorrelationPropertyFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); + OtherCasesFilterNode(Node node, boolean createChildren, String columnOrderKey) { + super(node, OtherCasesFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); this.forceUseWrappedDisplayName = false; this.createChildren = createChildren; this.columnOrderKey = columnOrderKey; diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchAction.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchAction.java similarity index 67% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchAction.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchAction.java index 74facdff65..55dcda0a24 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchAction.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchAction.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import java.awt.event.ActionEvent; import org.openide.awt.ActionID; @@ -27,15 +27,16 @@ import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; +import org.sleuthkit.autopsy.othercasessearch.Bundle; /** - * Action for accessing the Correlation Property Search dialog. + * Action for accessing the Search Other Cases dialog. */ -@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.correlationpropertysearch.CorrelationPropertySearchAction") -@ActionRegistration(displayName = "#CTL_CorrelationPropertySearchAction=Correlation Property Search", lazy = false) +@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.othercasessearch.OtherCasesSearchAction") +@ActionRegistration(displayName = "#CTL_OtherCasesSearchAction=Search Other Cases", lazy = false) @ActionReference(path = "Menu/Tools", position = 104) -@NbBundle.Messages({"CTL_CorrelationPropertySearchAction=Correlation Property Search"}) -public class CorrelationPropertySearchAction extends CallableSystemAction { +@NbBundle.Messages({"CTL_OtherCasesSearchAction=Search Other Cases"}) +public class OtherCasesSearchAction extends CallableSystemAction { @Override public boolean isEnabled() { @@ -49,15 +50,15 @@ public class CorrelationPropertySearchAction extends CallableSystemAction { @Override public void performAction() { - CorrelationPropertySearchDialog dialog = new CorrelationPropertySearchDialog(); + OtherCasesSearchDialog dialog = new OtherCasesSearchDialog(); dialog.display(); } @NbBundle.Messages({ - "CorrelationPropertySearchAction.getName.text=Correlation Property Search"}) + "OtherCasesSearchAction.getName.text=Search Other Cases"}) @Override public String getName() { - return Bundle.CorrelationPropertySearchAction_getName_text(); + return Bundle.OtherCasesSearchAction_getName_text(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchChildren.java similarity index 81% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchChildren.java index 9e1d20f2ef..eea55a6518 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchChildren.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchChildren.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import java.util.List; import org.openide.nodes.Children; @@ -27,15 +27,15 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns * Creates CorrelationAttributeInstanceNodes from a collection of * CorrelationAttributeInstances. */ -class CorrelationPropertySearchChildren extends Children.Keys { +class OtherCasesSearchChildren extends Children.Keys { /** - * Create an instance of CorrelationPropertySearchChildren. + * Create an instance of OtherCasesSearchChildren. * * @param lazy Lazy load? * @param fileList List of CorrelationAttributeInstances. */ - CorrelationPropertySearchChildren(boolean lazy, List instances) { + OtherCasesSearchChildren(boolean lazy, List instances) { super(lazy); this.setKeys(instances); } diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form similarity index 70% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form index 347008824c..cbe9506133 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.form +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form @@ -43,6 +43,10 @@ + + + + @@ -50,8 +54,10 @@ - + + + @@ -61,7 +67,7 @@ - + @@ -75,29 +81,29 @@ - + - + - + - + - + @@ -117,7 +123,7 @@ - + @@ -127,7 +133,14 @@ - + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java similarity index 80% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java index 6dc500d471..d691e078cb 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import java.awt.Color; import java.awt.event.ItemEvent; @@ -34,7 +34,6 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.openide.nodes.Node; import org.openide.util.Exceptions; -import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; @@ -49,20 +48,22 @@ import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; import org.sleuthkit.autopsy.corecomponents.TextPrompt; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.othercasessearch.Bundle; import org.sleuthkit.autopsy.datamodel.EmptyNode; @Messages({ - "CorrelationPropertySearchDialog.title.text=Correlation Property Search", - "CorrelationPropertySearchDialog.results.text=Correlation Properties", - "CorrelationPropertySearchDialog.emptyNode.text=No results found.", - "CorrelationPropertySearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash." + "OtherCasesSearchDialog.dialogTitle.text=Search Other Cases", + "OtherCasesSearchDialog.resultsTitle.text=Other Cases", + "OtherCasesSearchDialog.resultsDescription.text=Other Cases Search", + "OtherCasesSearchDialog.emptyNode.text=No results found.", + "OtherCasesSearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash." }) /** - * The Correlation Property Search dialog allows users to search for specific + * The Search Other Cases dialog allows users to search for specific * types of correlation properties in the Central Repository. */ -final class CorrelationPropertySearchDialog extends javax.swing.JDialog { - private static final Logger logger = Logger.getLogger(CorrelationPropertySearchDialog.class.getName()); +final class OtherCasesSearchDialog extends javax.swing.JDialog { + private static final Logger logger = Logger.getLogger(OtherCasesSearchDialog.class.getName()); private static final String FILES_CORRELATION_TYPE = "Files"; @@ -70,17 +71,17 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { private TextPrompt correlationValueTextFieldPrompt; /** - * Creates a new instance of the Correlation Property Search dialog. + * Creates a new instance of the Search Other Cases dialog. */ - CorrelationPropertySearchDialog() { - super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.CorrelationPropertySearchDialog_title_text(), true); + OtherCasesSearchDialog() { + super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.OtherCasesSearchDialog_dialogTitle_text(), true); this.correlationTypes = new ArrayList<>(); initComponents(); customizeComponents(); } /** - * Perform the correlation property search. + * Perform the other cases search. */ private void search() { new SwingWorker, Void>() { @@ -116,22 +117,22 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { Collection viewers = new ArrayList<>(1); viewers.add(table); - CorrelationPropertySearchNode searchNode = new CorrelationPropertySearchNode(correlationInstances); - CorrelationPropertyFilterNode tableFilterNode = new CorrelationPropertyFilterNode(searchNode, true, searchNode.getName()); + OtherCasesSearchNode searchNode = new OtherCasesSearchNode(correlationInstances); + OtherCasesFilterNode tableFilterNode = new OtherCasesFilterNode(searchNode, true, searchNode.getName()); String resultsText = String.format("%s (%s; \"%s\")", - Bundle.CorrelationPropertySearchDialog_results_text(), + Bundle.OtherCasesSearchDialog_resultsTitle_text(), (String) correlationTypeComboBox.getSelectedItem(), correlationValueTextField.getText()); final TopComponent searchResultWin; if (correlationInstances.isEmpty()) { Node emptyNode = new TableFilterNode( - new EmptyNode(Bundle.CorrelationPropertySearchDialog_emptyNode_text()), true); + new EmptyNode(Bundle.OtherCasesSearchDialog_emptyNode_text()), true); searchResultWin = DataResultTopComponent.createInstance( - resultsText, Bundle.CorrelationPropertySearchDialog_title_text(), emptyNode, 0); + resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), emptyNode, 0); } else { searchResultWin = DataResultTopComponent.createInstance( - resultsText, Bundle.CorrelationPropertySearchDialog_title_text(), tableFilterNode, HIDE_ON_CLOSE, viewers); + resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), tableFilterNode, HIDE_ON_CLOSE, viewers); } searchResultWin.requestActive(); // make it the active top component } catch (ExecutionException | InterruptedException ex) { @@ -156,25 +157,28 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { correlationTypeComboBox = new javax.swing.JComboBox<>(); correlationTypeLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel(); + descriptionLabel = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); - org.openide.awt.Mnemonics.setLocalizedText(correlationValueLabel, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.correlationValueLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(correlationValueLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.correlationValueLabel.text")); // NOI18N - correlationValueTextField.setText(org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.correlationValueTextField.text")); // NOI18N + correlationValueTextField.setText(org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.correlationValueTextField.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.searchButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.searchButton.text")); // NOI18N searchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchButtonActionPerformed(evt); } }); - org.openide.awt.Mnemonics.setLocalizedText(correlationTypeLabel, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.correlationTypeLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(correlationTypeLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.correlationTypeLabel.text")); // NOI18N errorLabel.setForeground(new java.awt.Color(255, 0, 0)); - org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.errorLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.errorLabel.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.descriptionLabel.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); @@ -194,13 +198,18 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(correlationTypeComboBox, 0, 289, Short.MAX_VALUE) - .addComponent(correlationValueTextField)))) + .addComponent(correlationValueTextField))) + .addGroup(layout.createSequentialGroup() + .addComponent(descriptionLabel) + .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() + .addComponent(descriptionLabel) + .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(correlationTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(correlationTypeLabel)) @@ -215,8 +224,8 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - searchButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleName")); // NOI18N - searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CorrelationPropertySearchDialog.class, "CorrelationPropertySearchDialog.searchButton.AccessibleContext.accessibleDescription")); // NOI18N + searchButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleName")); // NOI18N + searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription")); // NOI18N pack(); }// //GEN-END:initComponents @@ -234,7 +243,7 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { dispose(); } else { searchButton.setEnabled(false); - errorLabel.setText(Bundle.CorrelationPropertySearchDialog_validation_invalidHash()); + errorLabel.setText(Bundle.OtherCasesSearchDialog_validation_invalidHash()); correlationValueTextField.grabFocus(); } }//GEN-LAST:event_searchButtonActionPerformed @@ -295,7 +304,7 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { } @Messages({ - "CorrelationPropertySearchDialog.correlationValueTextField.filesExample=Example: \"f0e1d2c3b4a5968778695a4b3c2d1e0f\"" + "OtherCasesSearchDialog.correlationValueTextField.filesExample=Example: \"f0e1d2c3b4a5968778695a4b3c2d1e0f\"" }) /** * Update the text prompt of the name text field based on the input type @@ -305,7 +314,7 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { /** * Add text prompt to the text field. */ - String text = Bundle.CorrelationPropertySearchDialog_correlationValueTextField_filesExample(); + String text = Bundle.OtherCasesSearchDialog_correlationValueTextField_filesExample(); correlationValueTextFieldPrompt = new TextPrompt(text, correlationValueTextField); /** @@ -341,7 +350,7 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { } /** - * Display the Correlation Property Search dialog. + * Display the Search Other Cases dialog. */ public void display() { this.setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); @@ -353,6 +362,7 @@ final class CorrelationPropertySearchDialog extends javax.swing.JDialog { private javax.swing.JLabel correlationTypeLabel; private javax.swing.JLabel correlationValueLabel; private javax.swing.JTextField correlationValueTextField; + private javax.swing.JLabel descriptionLabel; private javax.swing.JLabel errorLabel; private javax.swing.JButton searchButton; // End of variables declaration//GEN-END:variables diff --git a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java similarity index 61% rename from Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java rename to Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java index 17b1d979c4..312744ffdc 100755 --- a/Core/src/org/sleuthkit/autopsy/correlationpropertysearch/CorrelationPropertySearchNode.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java @@ -16,35 +16,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.correlationpropertysearch; +package org.sleuthkit.autopsy.othercasessearch; import java.util.List; import org.openide.nodes.AbstractNode; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.othercasessearch.Bundle; /** - * Parent node to CorrelationPropertySearchChildren. + * Parent node to OtherCasesSearchChildren. */ -class CorrelationPropertySearchNode extends AbstractNode { +class OtherCasesSearchNode extends AbstractNode { - private CorrelationPropertySearchChildren children; + private OtherCasesSearchChildren children; /** - * Create an instance of CorrelationPropertySearchNode. + * Create an instance of OtherCasesSearchNode. * * @param keys The list of CorrelationAttributeInstances. */ - CorrelationPropertySearchNode(List keys) { - super(new CorrelationPropertySearchChildren(true, keys)); - this.children = (CorrelationPropertySearchChildren) this.getChildren(); + OtherCasesSearchNode(List keys) { + super(new OtherCasesSearchChildren(true, keys)); + this.children = (OtherCasesSearchChildren) this.getChildren(); } @Messages({ - "CorrelationPropertySearchNode.getName.text=Correlation Property Search" + "OtherCasesSearchNode.getName.text=Other Cases Search" }) @Override public String getName() { - return Bundle.CorrelationPropertySearchNode_getName_text(); + return Bundle.OtherCasesSearchNode_getName_text(); } } From 03af3136acfe5fd0148cd90eef7c63f9f901d191 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Tue, 20 Nov 2018 00:59:29 -0500 Subject: [PATCH 5/6] Fixed column sorting bug; added case count to dialog. --- .../othercasessearch/Bundle.properties | 3 +- .../OtherCasesFilterChildren.java | 3 +- .../OtherCasesFilterNode.java | 134 ------------------ .../OtherCasesSearchDialog.form | 25 +++- .../OtherCasesSearchDialog.java | 38 +++-- .../OtherCasesSearchNode.java | 4 - 6 files changed, 46 insertions(+), 161 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties index ff51e4ca22..17ea13ee0b 100755 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/Bundle.properties @@ -5,5 +5,6 @@ OtherCasesSearchDialog.searchButton.text=Search OtherCasesSearchDialog.correlationValueTextField.text= OtherCasesSearchDialog.correlationValueLabel.text=Correlation Property Value: OtherCasesSearchDialog.descriptionLabel.text=Search data in the Central Repository from other cases. -OtherCasesSearchDialog.errorLabel.text= +OtherCasesSearchDialog.errorLabel.text=\ OtherCasesSearchDialog.correlationTypeLabel.text=Correlation Property Type: +OtherCasesSearchDialog.casesLabel.text=\ diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java index 72edf98cd9..abe37bb15e 100755 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterChildren.java @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.othercasessearch; import org.openide.nodes.Children; import org.openide.nodes.FilterNode; import org.openide.nodes.Node; +import org.sleuthkit.autopsy.corecomponents.TableFilterNode; /** * A Children implementation for a @@ -66,7 +67,7 @@ final class OtherCasesFilterChildren extends FilterNode.Children { */ @Override protected Node copyNode(Node nodeToCopy) { - return new OtherCasesFilterNode(nodeToCopy, false); + return new TableFilterNode(nodeToCopy, false); } /** diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java deleted file mode 100755 index 8cf27fd507..0000000000 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesFilterNode.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2018 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.othercasessearch; - -import org.openide.nodes.FilterNode; -import org.openide.nodes.Node; -import org.openide.util.NbBundle; -import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.datamodel.NodeSelectionInfo; -import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; - -/** - * FilterNode containing properties and actions for the other cases search. - */ -final class OtherCasesFilterNode extends FilterNode { - - private final boolean createChildren; - private final boolean forceUseWrappedDisplayName; - private String columnOrderKey = "NONE"; - - /** - * Constructs a filter node that creates at most one layer of child nodes - * for the node it wraps. It is designed to be used in the results view to - * ensure the individual viewers display only the first layer of child - * nodes. - * - * @param node The node to wrap in the filter node. - * @param createChildren True if a Children object should be created for the - * wrapped node. - */ - OtherCasesFilterNode(Node node, boolean createChildren) { - super(node, OtherCasesFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); - this.forceUseWrappedDisplayName = false; - this.createChildren = createChildren; - } - - /** - * Constructs a filter node that creates at most one layer of child nodes - * for the node it wraps. It is designed to be used in the results view to - * ensure the individual viewers display only the first layer of child - * nodes. - * - * @param node The node to wrap in the filter node. - * @param createChildren True if a Children object should be created for the - * wrapped node. - * @param columnOrderKey A key that represents the type of the original - * wrapped node and what is being displayed under that node. - */ - OtherCasesFilterNode(Node node, boolean createChildren, String columnOrderKey) { - super(node, OtherCasesFilterChildren.createInstance(node, createChildren), Lookups.proxy(node)); - this.forceUseWrappedDisplayName = false; - this.createChildren = createChildren; - this.columnOrderKey = columnOrderKey; - } - - /** - * Gets the display name for the wrapped node, for use in the first column - * of an Autopsy table view. - * - * @return The display name. - */ - @Override - public String getDisplayName() { - if (this.forceUseWrappedDisplayName) { - return super.getDisplayName(); - } else if (createChildren) { - return NbBundle.getMessage(this.getClass(), "TableFilterNode.displayName.text"); - } else { - return super.getDisplayName(); - } - } - - /** - * Adds information about which child node of this node, if any, should be - * selected. Can be null. - * - * @param selectedChildNodeInfo The child node selection information. - */ - void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) { - /* - * Currently, child selection is only supported for nodes selected in - * the tree view and decorated with a DataResultFilterNode. - */ - if (getOriginal() instanceof DataResultFilterNode) { - ((DataResultFilterNode) getOriginal()).setChildNodeSelectionInfo(selectedChildNodeInfo); - } - } - - /** - * Gets information about which child node of this node, if any, should be - * selected. - * - * @return The child node selection information, or null if no child should - * be selected. - */ - NodeSelectionInfo getChildNodeSelectionInfo() { - /* - * Currently, child selection is only supported for nodes selected in - * the tree view and decorated with a DataResultFilterNode. - */ - if (getOriginal() instanceof DataResultFilterNode) { - return ((DataResultFilterNode) getOriginal()).getChildNodeSelectionInfo(); - } else { - return null; - } - } - - /** - * @return the column order key, which allows custom column ordering to be - * written into a properties file and be reloaded for future use in a table - * with the same root node or for different cases. This is done by - * DataResultViewerTable. The key should represent what kinds of items the - * table is showing. - */ - String getColumnOrderKey() { - return columnOrderKey; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form index cbe9506133..00eb862b4a 100755 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.form @@ -28,10 +28,14 @@ - + + + + + @@ -41,12 +45,9 @@ + - - - - @@ -67,10 +68,12 @@ - + + + - + @@ -144,5 +147,13 @@ + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java index d691e078cb..86d037865e 100755 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java @@ -41,14 +41,12 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.commonfilesearch.CommonAttributesSearchResultsViewerTable; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; import org.sleuthkit.autopsy.corecomponents.TextPrompt; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.othercasessearch.Bundle; import org.sleuthkit.autopsy.datamodel.EmptyNode; @Messages({ @@ -56,7 +54,9 @@ import org.sleuthkit.autopsy.datamodel.EmptyNode; "OtherCasesSearchDialog.resultsTitle.text=Other Cases", "OtherCasesSearchDialog.resultsDescription.text=Other Cases Search", "OtherCasesSearchDialog.emptyNode.text=No results found.", - "OtherCasesSearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash." + "OtherCasesSearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash.", + "# {0} - number of cases", + "OtherCasesSearchDialog.caseLabel.text=The current Central Repository contains {0} case(s)." }) /** * The Search Other Cases dialog allows users to search for specific @@ -113,12 +113,12 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { try { super.done(); List correlationInstances = this.get(); - DataResultViewerTable table = new CommonAttributesSearchResultsViewerTable(); + DataResultViewerTable table = new DataResultViewerTable(); Collection viewers = new ArrayList<>(1); viewers.add(table); OtherCasesSearchNode searchNode = new OtherCasesSearchNode(correlationInstances); - OtherCasesFilterNode tableFilterNode = new OtherCasesFilterNode(searchNode, true, searchNode.getName()); + TableFilterNode tableFilterNode = new TableFilterNode(searchNode, true, searchNode.getName()); String resultsText = String.format("%s (%s; \"%s\")", Bundle.OtherCasesSearchDialog_resultsTitle_text(), @@ -132,7 +132,7 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), emptyNode, 0); } else { searchResultWin = DataResultTopComponent.createInstance( - resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), tableFilterNode, HIDE_ON_CLOSE, viewers); + resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), tableFilterNode, correlationInstances.size(), viewers); } searchResultWin.requestActive(); // make it the active top component } catch (ExecutionException | InterruptedException ex) { @@ -158,6 +158,7 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { correlationTypeLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel(); descriptionLabel = new javax.swing.JLabel(); + casesLabel = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); @@ -180,6 +181,9 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.descriptionLabel.text")); // NOI18N + casesLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + org.openide.awt.Mnemonics.setLocalizedText(casesLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.casesLabel.text")); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -188,9 +192,12 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(casesLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(searchButton)) + .addGroup(layout.createSequentialGroup() + .addComponent(descriptionLabel) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(correlationValueLabel) @@ -198,10 +205,8 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(correlationTypeComboBox, 0, 289, Short.MAX_VALUE) - .addComponent(correlationValueTextField))) - .addGroup(layout.createSequentialGroup() - .addComponent(descriptionLabel) - .addGap(0, 0, Short.MAX_VALUE))) + .addComponent(correlationValueTextField) + .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); layout.setVerticalGroup( @@ -217,10 +222,12 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(correlationValueLabel) .addComponent(correlationValueTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(errorLabel) + .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(searchButton) - .addComponent(errorLabel)) + .addComponent(casesLabel)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); @@ -261,8 +268,10 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { EamDb dbManager = EamDb.getInstance(); correlationTypes.clear(); correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); + int numberOfCases = dbManager.getCases().size(); + casesLabel.setText(Bundle.OtherCasesSearchDialog_caseLabel_text(numberOfCases)); } catch (EamDbException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex); } for (CorrelationAttributeInstance.Type type : correlationTypes) { @@ -358,6 +367,7 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel casesLabel; private javax.swing.JComboBox correlationTypeComboBox; private javax.swing.JLabel correlationTypeLabel; private javax.swing.JLabel correlationValueLabel; diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java index 312744ffdc..ff9c3a6d80 100755 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchNode.java @@ -22,15 +22,12 @@ import java.util.List; import org.openide.nodes.AbstractNode; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.othercasessearch.Bundle; /** * Parent node to OtherCasesSearchChildren. */ class OtherCasesSearchNode extends AbstractNode { - private OtherCasesSearchChildren children; - /** * Create an instance of OtherCasesSearchNode. * @@ -38,7 +35,6 @@ class OtherCasesSearchNode extends AbstractNode { */ OtherCasesSearchNode(List keys) { super(new OtherCasesSearchChildren(true, keys)); - this.children = (OtherCasesSearchChildren) this.getChildren(); } @Messages({ From ab78771f52c153f749970634f8f354b7e7a88a27 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Tue, 20 Nov 2018 10:44:37 -0500 Subject: [PATCH 6/6] Added missing annotation for Codacy. --- .../autopsy/othercasessearch/OtherCasesSearchDialog.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java index 86d037865e..51e21631d2 100755 --- a/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/othercasessearch/OtherCasesSearchDialog.java @@ -62,8 +62,10 @@ import org.sleuthkit.autopsy.datamodel.EmptyNode; * The Search Other Cases dialog allows users to search for specific * types of correlation properties in the Central Repository. */ +@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives final class OtherCasesSearchDialog extends javax.swing.JDialog { private static final Logger logger = Logger.getLogger(OtherCasesSearchDialog.class.getName()); + private static final long serialVersionUID = 1L; private static final String FILES_CORRELATION_TYPE = "Files";