mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #4704 from kellykelly3/1229-selectioninfo-implementation
1229 selectioninfo implementation
This commit is contained in:
commit
9bd4112d35
@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.communications;
|
|||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -36,11 +35,11 @@ import org.openide.nodes.AbstractNode;
|
|||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
import org.openide.util.Lookup;
|
import org.openide.util.Lookup;
|
||||||
import org.openide.util.lookup.ProxyLookup;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.AccountDeviceInstance;
|
import org.sleuthkit.datamodel.AccountDeviceInstance;
|
||||||
|
import org.sleuthkit.datamodel.CommunicationsFilter;
|
||||||
import org.sleuthkit.datamodel.CommunicationsManager;
|
import org.sleuthkit.datamodel.CommunicationsManager;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
@ -70,7 +69,7 @@ public final class AccountsBrowser extends JPanel implements ExplorerManager.Pro
|
|||||||
* This lookup proxies the selection lookup of both he accounts table and
|
* This lookup proxies the selection lookup of both he accounts table and
|
||||||
* the messages table.
|
* the messages table.
|
||||||
*/
|
*/
|
||||||
private final ProxyLookup proxyLookup;
|
private final Lookup lookup;
|
||||||
|
|
||||||
public AccountsBrowser() {
|
public AccountsBrowser() {
|
||||||
initComponents();
|
initComponents();
|
||||||
@ -95,16 +94,19 @@ public final class AccountsBrowser extends JPanel implements ExplorerManager.Pro
|
|||||||
} else if (ExplorerManager.PROP_EXPLORED_CONTEXT.equals(evt.getPropertyName())) {
|
} else if (ExplorerManager.PROP_EXPLORED_CONTEXT.equals(evt.getPropertyName())) {
|
||||||
SwingUtilities.invokeLater(this::setColumnWidths);
|
SwingUtilities.invokeLater(this::setColumnWidths);
|
||||||
} else if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
|
} else if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
|
||||||
relationshipBrowser.setSelectionInfo(new SelectionInfo());
|
final Node[] selectedNodes = accountsTableEM.getSelectedNodes();
|
||||||
|
final Set<AccountDeviceInstance> accountDeviceInstances = new HashSet<>();
|
||||||
|
|
||||||
|
CommunicationsFilter filter = null;
|
||||||
|
for (final Node node : selectedNodes) {
|
||||||
|
accountDeviceInstances.add(((AccountDeviceInstanceNode) node).getAccountDeviceInstance());
|
||||||
|
filter = ((AccountDeviceInstanceNode)node).getFilter();
|
||||||
|
}
|
||||||
|
relationshipBrowser.setSelectionInfo(new SelectionInfo(accountDeviceInstances, filter));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
final MessageBrowser messageBrowser = new MessageBrowser(accountsTableEM, messageBrowserEM);
|
|
||||||
|
lookup = ExplorerUtils.createLookup(accountsTableEM, getActionMap());
|
||||||
// jSplitPane1.setRightComponent(messageBrowser);
|
|
||||||
|
|
||||||
proxyLookup = new ProxyLookup(
|
|
||||||
messageBrowser.getLookup(),
|
|
||||||
ExplorerUtils.createLookup(accountsTableEM, getActionMap()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setColumnWidths() {
|
private void setColumnWidths() {
|
||||||
@ -176,6 +178,6 @@ public final class AccountsBrowser extends JPanel implements ExplorerManager.Pro
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Lookup getLookup() {
|
public Lookup getLookup() {
|
||||||
return proxyLookup;
|
return lookup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,3 @@ VisualizationPanel.hierarchyLayoutButton.text=Hierarchical
|
|||||||
VisualizationPanel.clearVizButton.text_1=Clear Viz.
|
VisualizationPanel.clearVizButton.text_1=Clear Viz.
|
||||||
VisualizationPanel.snapshotButton.text_1=Snapshot Report
|
VisualizationPanel.snapshotButton.text_1=Snapshot Report
|
||||||
ContactsViewer.testLabel.text=No Value Set
|
ContactsViewer.testLabel.text=No Value Set
|
||||||
MessagesViewer.testLabel.text=No Value Set
|
|
||||||
|
@ -23,6 +23,12 @@ FiltersPanel.deviceRequiredLabel.text=Select at least one.
|
|||||||
FiltersPanel.accountTypeRequiredLabel.text=Select at least one.
|
FiltersPanel.accountTypeRequiredLabel.text=Select at least one.
|
||||||
FiltersPanel.needsRefreshLabel.text=Displayed data is out of date. Press Refresh.
|
FiltersPanel.needsRefreshLabel.text=Displayed data is out of date. Press Refresh.
|
||||||
MessageBrowser.DataResultViewerTable.title=Messages
|
MessageBrowser.DataResultViewerTable.title=Messages
|
||||||
|
MessageViewer_columnHeader_Attms=Attachments
|
||||||
|
MessageViewer_columnHeader_Date=Date
|
||||||
|
MessageViewer_columnHeader_From=From
|
||||||
|
MessageViewer_columnHeader_Subject=Subject
|
||||||
|
MessageViewer_columnHeader_To=To
|
||||||
|
MessageViewer_tabTitle=Messages
|
||||||
OpenCVTAction.displayName=Communications
|
OpenCVTAction.displayName=Communications
|
||||||
PinAccountsAction.pluralText=Add Selected Accounts to Visualization
|
PinAccountsAction.pluralText=Add Selected Accounts to Visualization
|
||||||
PinAccountsAction.singularText=Add Selected Account to Visualization
|
PinAccountsAction.singularText=Add Selected Account to Visualization
|
||||||
@ -84,7 +90,6 @@ VisualizationPanel.hierarchyLayoutButton.text=Hierarchical
|
|||||||
VisualizationPanel.clearVizButton.text_1=Clear Viz.
|
VisualizationPanel.clearVizButton.text_1=Clear Viz.
|
||||||
VisualizationPanel.snapshotButton.text_1=Snapshot Report
|
VisualizationPanel.snapshotButton.text_1=Snapshot Report
|
||||||
ContactsViewer.testLabel.text=No Value Set
|
ContactsViewer.testLabel.text=No Value Set
|
||||||
MessagesViewer.testLabel.text=No Value Set
|
|
||||||
VisualizationPanel_action_dialogs_title=Communications
|
VisualizationPanel_action_dialogs_title=Communications
|
||||||
VisualizationPanel_action_name_text=Snapshot Report
|
VisualizationPanel_action_name_text=Snapshot Report
|
||||||
VisualizationPanel_module_name=Communications
|
VisualizationPanel_module_name=Communications
|
||||||
|
@ -47,7 +47,7 @@ public class ContactsViewer extends JPanel implements RelationshipsViewer{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectionInfo(SelectionInfo info) {
|
public void setSelectionInfo(SelectionInfo info) {
|
||||||
testLabel.setText(info.getString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,23 +18,156 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.communications;
|
package org.sleuthkit.autopsy.communications;
|
||||||
|
|
||||||
|
import java.util.TimeZone;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.openide.nodes.AbstractNode;
|
||||||
|
import org.openide.nodes.Children;
|
||||||
|
import org.openide.nodes.Sheet;
|
||||||
|
import org.openide.util.NbBundle.Messages;
|
||||||
|
import org.openide.util.lookup.Lookups;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
|
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME;
|
||||||
|
import org.sleuthkit.datamodel.TimeUtilities;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Wraps a BlackboardArtifact as an AbstractNode for use in an OutlookView
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
final class MessageNode extends BlackboardArtifactNode {
|
final class MessageNode extends AbstractNode {
|
||||||
private static final Logger logger = Logger.getLogger(RelationshipNode.class.getName());
|
private static final Logger logger = Logger.getLogger(RelationshipNode.class.getName());
|
||||||
|
|
||||||
|
private final BlackboardArtifact artifact;
|
||||||
|
|
||||||
MessageNode(BlackboardArtifact artifact) {
|
MessageNode(BlackboardArtifact artifact) {
|
||||||
super(artifact);
|
super(Children.LEAF, Lookups.fixed(artifact));
|
||||||
// Grabbed this from RelationshipNode, does always work even with internalization?
|
this.artifact = artifact;
|
||||||
|
|
||||||
final String stripEnd = StringUtils.stripEnd(artifact.getDisplayName(), "s"); // NON-NLS
|
final String stripEnd = StringUtils.stripEnd(artifact.getDisplayName(), "s"); // NON-NLS
|
||||||
String removeEndIgnoreCase = StringUtils.removeEndIgnoreCase(stripEnd, "message"); // NON-NLS
|
String removeEndIgnoreCase = StringUtils.removeEndIgnoreCase(stripEnd, "message"); // NON-NLS
|
||||||
setDisplayName(removeEndIgnoreCase.isEmpty() ? stripEnd : removeEndIgnoreCase);
|
setDisplayName(removeEndIgnoreCase.isEmpty() ? stripEnd : removeEndIgnoreCase);
|
||||||
|
|
||||||
|
int typeID = artifact.getArtifactTypeID();
|
||||||
|
|
||||||
|
String filePath = "org/sleuthkit/autopsy/images/"; //NON-NLS
|
||||||
|
if( typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
|
||||||
|
filePath = filePath + "mail-icon-16.png"; //NON-NLS
|
||||||
|
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
|
||||||
|
filePath = filePath + "message.png"; //NON-NLS
|
||||||
|
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()) {
|
||||||
|
filePath = filePath + "calllog.png"; //NON-NLS
|
||||||
|
}
|
||||||
|
|
||||||
|
setIconBaseWithExtension(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Messages({
|
||||||
|
"MessageNode_Node_Property_Type=Type",
|
||||||
|
"MessageNode_Node_Property_From=From",
|
||||||
|
"MessageNode_Node_Property_To=To",
|
||||||
|
"MessageNode_Node_Property_Date=Date",
|
||||||
|
"MessageNode_Node_Property_Subject=Subject",
|
||||||
|
"MessageNode_Node_Property_Attms=Attachments"
|
||||||
|
})
|
||||||
|
|
||||||
|
@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<>("Type", Bundle.MessageNode_Node_Property_Type(), "", getDisplayName())); //NON-NLS
|
||||||
|
|
||||||
|
BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
||||||
|
if (null != fromID) {
|
||||||
|
//Consider refactoring this to reduce boilerplate
|
||||||
|
switch (fromID) {
|
||||||
|
case TSK_EMAIL_MSG:
|
||||||
|
sheetSet.put(new NodeProperty<>("From", Bundle.MessageNode_Node_Property_From(), "",
|
||||||
|
StringUtils.strip(getAttributeDisplayString(artifact, TSK_EMAIL_FROM), " \t\n;"))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("To", Bundle.MessageNode_Node_Property_To(), "",
|
||||||
|
StringUtils.strip(getAttributeDisplayString(artifact, TSK_EMAIL_TO), " \t\n;"))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("Date", Bundle.MessageNode_Node_Property_Date(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_DATETIME_SENT))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("Subject", Bundle.MessageNode_Node_Property_Subject(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_SUBJECT))); //NON-NLS
|
||||||
|
try {
|
||||||
|
sheetSet.put(new NodeProperty<>("Attms", Bundle.MessageNode_Node_Property_Attms(), "", artifact.getChildrenCount())); //NON-NLS
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.WARNING, "Error loading attachment count for " + artifact, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case TSK_MESSAGE:
|
||||||
|
sheetSet.put(new NodeProperty<>("From", Bundle.MessageNode_Node_Property_From(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("To", Bundle.MessageNode_Node_Property_To(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("Date", Bundle.MessageNode_Node_Property_Date(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_DATETIME))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("Subject", Bundle.MessageNode_Node_Property_Subject(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_SUBJECT))); //NON-NLS
|
||||||
|
try {
|
||||||
|
sheetSet.put(new NodeProperty<>("Attms", Bundle.MessageNode_Node_Property_Attms(), "", artifact.getChildrenCount())); //NON-NLS
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.WARNING, "Error loading attachment count for " + artifact, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TSK_CALLLOG:
|
||||||
|
sheetSet.put(new NodeProperty<>("From", Bundle.MessageNode_Node_Property_From(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("To", Bundle.MessageNode_Node_Property_To(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO))); //NON-NLS
|
||||||
|
sheetSet.put(new NodeProperty<>("Date", Bundle.MessageNode_Node_Property_Date(), "",
|
||||||
|
getAttributeDisplayString(artifact, TSK_DATETIME_START))); //NON-NLS
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Get the display string for the attribute of the given type from the given
|
||||||
|
* artifact.
|
||||||
|
*
|
||||||
|
* @param artifact the value of artifact
|
||||||
|
* @param attributeType the value of TSK_SUBJECT1
|
||||||
|
*
|
||||||
|
* @return The display string, or an empty string if there is no such
|
||||||
|
* attribute or an an error.
|
||||||
|
*/
|
||||||
|
private static String getAttributeDisplayString(final BlackboardArtifact artifact, final BlackboardAttribute.ATTRIBUTE_TYPE attributeType) {
|
||||||
|
try {
|
||||||
|
BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attributeType.getTypeID())));
|
||||||
|
if (attribute == null) {
|
||||||
|
return "";
|
||||||
|
} else if (attributeType.getValueType() == DATETIME) {
|
||||||
|
return TimeUtilities.epochToTime(attribute.getValueLong(),
|
||||||
|
TimeZone.getTimeZone(Utils.getUserPreferredZoneId()));
|
||||||
|
} else {
|
||||||
|
return attribute.getDisplayString();
|
||||||
|
}
|
||||||
|
} catch (TskCoreException tskCoreException) {
|
||||||
|
logger.log(Level.WARNING, "Error getting attribute value.", tskCoreException); //NON-NLS
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2019 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.sleuthkit.autopsy.communications;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import org.openide.nodes.ChildFactory;
|
|
||||||
import org.openide.nodes.Node;
|
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class MessageNodeFactory extends ChildFactory<BlackboardArtifact> {
|
|
||||||
private final Collection<BlackboardArtifact> artifacts;
|
|
||||||
|
|
||||||
MessageNodeFactory(Collection<BlackboardArtifact> artifacts) {
|
|
||||||
this.artifacts = artifacts;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean createKeys(List<BlackboardArtifact> list) {
|
|
||||||
list.addAll(artifacts);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Node createNodeForKey(BlackboardArtifact key) {
|
|
||||||
return new MessageNode(key);
|
|
||||||
}
|
|
||||||
}
|
|
102
Core/src/org/sleuthkit/autopsy/communications/MessagesChildNodeFactory.java
Executable file
102
Core/src/org/sleuthkit/autopsy/communications/MessagesChildNodeFactory.java
Executable file
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2019 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.communications;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import org.openide.nodes.ChildFactory;
|
||||||
|
import org.openide.nodes.Node;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
|
import org.sleuthkit.datamodel.CommunicationsManager;
|
||||||
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ChildFactory that creates createKeys and nodes from a given selectionInfo for
|
||||||
|
* only emails, call logs and messages.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MessagesChildNodeFactory extends ChildFactory<BlackboardArtifact> {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(MessagesChildNodeFactory.class.getName());
|
||||||
|
|
||||||
|
private CommunicationsManager communicationManager = null;
|
||||||
|
private final SelectionInfo selectionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new MessageChildNodeFactory from the currently selectionInfo
|
||||||
|
*
|
||||||
|
* @param selectionInfo SelectionInfo object for the currently selected
|
||||||
|
* accounts
|
||||||
|
*/
|
||||||
|
MessagesChildNodeFactory(SelectionInfo selectionInfo) {
|
||||||
|
this.selectionInfo = selectionInfo;
|
||||||
|
|
||||||
|
try {
|
||||||
|
communicationManager = Case.getCurrentCaseThrows().getSleuthkitCase().getCommunicationsManager();
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Failed to get communications manager from case.", ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a list of Keys (BlackboardArtifact) for only messages for the
|
||||||
|
* currently selected accounts
|
||||||
|
* @param list List of BlackboardArtifact to populate
|
||||||
|
* @return True on success
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected boolean createKeys(List<BlackboardArtifact> list) {
|
||||||
|
if (communicationManager == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Content> relationshipSources;
|
||||||
|
|
||||||
|
try {
|
||||||
|
relationshipSources = communicationManager.getRelationshipSources(selectionInfo.getAccountDevicesInstances(), selectionInfo.getCommunicationsFilter());
|
||||||
|
|
||||||
|
relationshipSources.stream().filter((content) -> (content instanceof BlackboardArtifact)).forEachOrdered((content) -> {
|
||||||
|
|
||||||
|
BlackboardArtifact bba = (BlackboardArtifact) content;
|
||||||
|
BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(bba.getArtifactTypeID());
|
||||||
|
|
||||||
|
if (fromID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG
|
||||||
|
|| fromID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG
|
||||||
|
|| fromID == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE) {
|
||||||
|
list.add(bba);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Failed to get relationship sources.", ex); //NON-NLS
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Node createNodeForKey(BlackboardArtifact key) {
|
||||||
|
return new MessageNode(key);
|
||||||
|
}
|
||||||
|
}
|
@ -16,30 +16,20 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Component id="outlineView" alignment="0" pref="480" max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="testLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace pref="294" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Component id="outlineView" min="-2" pref="475" max="-2" attributes="0"/>
|
||||||
<Component id="testLabel" min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="0" pref="16" max="32767" attributes="0"/>
|
||||||
<EmptySpace pref="264" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JLabel" name="testLabel">
|
<Component class="org.openide.explorer.view.OutlineView" name="outlineView">
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="MessagesViewer.testLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -19,25 +19,61 @@
|
|||||||
package org.sleuthkit.autopsy.communications;
|
package org.sleuthkit.autopsy.communications;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.ListSelectionModel;
|
||||||
|
import org.netbeans.swing.outline.DefaultOutlineModel;
|
||||||
|
import org.netbeans.swing.outline.Outline;
|
||||||
|
import org.openide.explorer.ExplorerManager;
|
||||||
|
import org.openide.explorer.ExplorerUtils;
|
||||||
|
import org.openide.nodes.AbstractNode;
|
||||||
|
import org.openide.nodes.Children;
|
||||||
|
import org.openide.util.Lookup;
|
||||||
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visualation for Contacts
|
* Visualation for the messages of the currently selected accounts.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@ServiceProvider(service=RelationshipsViewer.class)
|
@ServiceProvider(service=RelationshipsViewer.class)
|
||||||
public class MessagesViewer extends JPanel implements RelationshipsViewer{
|
public class MessagesViewer extends JPanel implements RelationshipsViewer, ExplorerManager.Provider, Lookup.Provider {
|
||||||
|
|
||||||
|
private final ExplorerManager tableEM = new ExplorerManager();
|
||||||
|
private final Lookup lookup;
|
||||||
|
private final Outline outline;
|
||||||
|
|
||||||
|
@Messages({
|
||||||
|
"MessageViewer_tabTitle=Messages",
|
||||||
|
"MessageViewer_columnHeader_From=From",
|
||||||
|
"MessageViewer_columnHeader_To=To",
|
||||||
|
"MessageViewer_columnHeader_Date=Date",
|
||||||
|
"MessageViewer_columnHeader_Subject=Subject",
|
||||||
|
"MessageViewer_columnHeader_Attms=Attachments"
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form MessagesViewer
|
* Creates new form MessagesViewer
|
||||||
*/
|
*/
|
||||||
public MessagesViewer() {
|
public MessagesViewer() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
outline = outlineView.getOutline();
|
||||||
|
outlineView.setPropertyColumns(
|
||||||
|
"From", Bundle.MessageViewer_columnHeader_From(),
|
||||||
|
"To", Bundle.MessageViewer_columnHeader_To(),
|
||||||
|
"Date", Bundle.MessageViewer_columnHeader_Date(),
|
||||||
|
"Subject", Bundle.MessageViewer_columnHeader_Subject(),
|
||||||
|
"Attms", Bundle.MessageViewer_columnHeader_Attms()
|
||||||
|
|
||||||
|
);
|
||||||
|
outline.setRootVisible(false);
|
||||||
|
outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.AccountNode_accountName());
|
||||||
|
|
||||||
|
lookup = ExplorerUtils.createLookup(tableEM, getActionMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return "Messages";
|
return Bundle.MessageViewer_tabTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +83,17 @@ public class MessagesViewer extends JPanel implements RelationshipsViewer{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectionInfo(SelectionInfo info) {
|
public void setSelectionInfo(SelectionInfo info) {
|
||||||
testLabel.setText(info.getString());
|
tableEM.setRootContext(new AbstractNode(Children.create(new MessagesChildNodeFactory(info), true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExplorerManager getExplorerManager() {
|
||||||
|
return tableEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Lookup getLookup() {
|
||||||
|
return lookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,30 +105,24 @@ public class MessagesViewer extends JPanel implements RelationshipsViewer{
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
testLabel = new javax.swing.JLabel();
|
outlineView = new org.openide.explorer.view.OutlineView();
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(testLabel, org.openide.util.NbBundle.getMessage(MessagesViewer.class, "MessagesViewer.testLabel.text")); // NOI18N
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(outlineView, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(testLabel)
|
|
||||||
.addContainerGap(294, Short.MAX_VALUE))
|
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addComponent(outlineView, javax.swing.GroupLayout.PREFERRED_SIZE, 475, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(testLabel)
|
.addGap(0, 16, Short.MAX_VALUE))
|
||||||
.addContainerGap(264, Short.MAX_VALUE))
|
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JLabel testLabel;
|
private org.openide.explorer.view.OutlineView outlineView;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.communications;
|
package org.sleuthkit.autopsy.communications;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Set;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.datamodel.AccountDeviceInstance;
|
||||||
|
import org.sleuthkit.datamodel.CommunicationsFilter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,19 +31,22 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
public class SelectionInfo {
|
public class SelectionInfo {
|
||||||
|
|
||||||
private final String displayString;
|
static final private Logger logger = Logger.getLogger(SelectionInfo.class.getName());
|
||||||
|
|
||||||
|
private final Set<AccountDeviceInstance> accountDeviceInstances;
|
||||||
|
private final CommunicationsFilter communicationFilter;
|
||||||
|
|
||||||
SelectionInfo() {
|
SelectionInfo(Set<AccountDeviceInstance> accountDeviceInstances, CommunicationsFilter communicationFilter) {
|
||||||
displayString = (new Date()).toString();
|
this.accountDeviceInstances = accountDeviceInstances;
|
||||||
|
this.communicationFilter = communicationFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Set<AccountDeviceInstance> getAccountDevicesInstances(){
|
||||||
* Temporary function for testing data flow
|
return accountDeviceInstances;
|
||||||
*
|
}
|
||||||
* @return A String representing the time the object was created
|
|
||||||
*/
|
public CommunicationsFilter getCommunicationsFilter() {
|
||||||
public String getString() {
|
return communicationFilter;
|
||||||
return displayString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user