19 package org.sleuthkit.autopsy.directorytree;
21 import java.awt.Cursor;
22 import java.awt.EventQueue;
23 import java.beans.PropertyChangeEvent;
24 import java.beans.PropertyChangeListener;
25 import java.beans.PropertyVetoException;
26 import java.io.IOException;
27 import java.util.ArrayList;
28 import java.util.Arrays;
29 import java.util.EnumSet;
30 import java.util.LinkedList;
31 import java.util.List;
33 import java.util.Objects;
34 import java.util.concurrent.ExecutionException;
35 import java.util.logging.Level;
36 import java.util.prefs.PreferenceChangeEvent;
37 import java.util.prefs.PreferenceChangeListener;
38 import javax.swing.Action;
39 import javax.swing.SwingUtilities;
40 import javax.swing.SwingWorker;
41 import javax.swing.event.PopupMenuEvent;
42 import javax.swing.event.PopupMenuListener;
43 import javax.swing.tree.TreeSelectionModel;
44 import org.apache.commons.lang3.StringUtils;
45 import org.openide.explorer.ExplorerManager;
46 import org.openide.explorer.ExplorerUtils;
47 import org.openide.explorer.view.BeanTreeView;
48 import org.openide.explorer.view.TreeView;
49 import org.openide.nodes.AbstractNode;
50 import org.openide.nodes.Children;
51 import org.openide.nodes.Node;
52 import org.openide.nodes.NodeNotFoundException;
53 import org.openide.nodes.NodeOp;
54 import org.openide.util.NbBundle;
55 import org.openide.util.NbBundle.Messages;
56 import org.openide.windows.TopComponent;
57 import org.openide.windows.WindowManager;
98 "DirectoryTreeTopComponent.resultsView.title=Listing"
100 @SuppressWarnings(
"PMD.SingularField")
103 private final transient ExplorerManager em =
new ExplorerManager();
109 private static final String PREFERRED_ID =
"DirectoryTreeTopComponent";
115 private static final long DEFAULT_DATASOURCE_GROUPING_THRESHOLD = 5;
116 private static final String GROUPING_THRESHOLD_NAME =
"GroupDataSourceThreshold";
117 private static final String SETTINGS_FILE =
"CasePreferences.properties";
126 getTree().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
128 putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
132 subscribeToChangeEvents();
133 associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
136 this.backList =
new LinkedList<>();
137 this.forwardList =
new LinkedList<>();
138 backButton.setEnabled(
false);
139 forwardButton.setEnabled(
false);
141 viewPreferencesPopupMenu.add(viewPreferencesPanel);
142 viewPreferencesPopupMenu.setSize(viewPreferencesPanel.getPreferredSize().width + 6, viewPreferencesPanel.getPreferredSize().height + 6);
143 viewPreferencesPopupMenu.addPopupMenuListener(
new PopupMenuListener() {
145 public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
146 openViewPreferencesButton.setSelected(
true);
150 public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
151 openViewPreferencesButton.setSelected(
false);
155 public void popupMenuCanceled(PopupMenuEvent e) {
156 openViewPreferencesButton.setSelected(
false);
167 public void preferenceChange(PreferenceChangeEvent evt) {
168 switch (evt.getKey()) {
176 refreshContentTreeSafe();
184 refreshContentTreeSafe();
191 this.em.addPropertyChangeListener(
this);
197 this.dataResult.requestActive();
201 this.dataResult.
open();
205 return this.dataResult;
214 return showRejectedResults;
224 this.showRejectedResults = showRejectedResults;
225 if (accounts != null) {
238 viewPreferencesPopupMenu =
new javax.swing.JPopupMenu();
239 treeView =
new BeanTreeView();
240 backButton =
new javax.swing.JButton();
241 forwardButton =
new javax.swing.JButton();
242 openViewPreferencesButton =
new javax.swing.JButton();
244 treeView.setBorder(null);
246 backButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back.png")));
247 org.openide.awt.Mnemonics.setLocalizedText(backButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.backButton.text"));
248 backButton.setBorderPainted(
false);
249 backButton.setContentAreaFilled(
false);
250 backButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_disabled.png")));
251 backButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
252 backButton.setMaximumSize(
new java.awt.Dimension(55, 100));
253 backButton.setMinimumSize(
new java.awt.Dimension(5, 5));
254 backButton.setPreferredSize(
new java.awt.Dimension(24, 24));
255 backButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_hover.png")));
256 backButton.addActionListener(
new java.awt.event.ActionListener() {
257 public void actionPerformed(java.awt.event.ActionEvent evt) {
258 backButtonActionPerformed(evt);
262 forwardButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward.png")));
263 org.openide.awt.Mnemonics.setLocalizedText(forwardButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.forwardButton.text"));
264 forwardButton.setBorderPainted(
false);
265 forwardButton.setContentAreaFilled(
false);
266 forwardButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_disabled.png")));
267 forwardButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
268 forwardButton.setMaximumSize(
new java.awt.Dimension(55, 100));
269 forwardButton.setMinimumSize(
new java.awt.Dimension(5, 5));
270 forwardButton.setPreferredSize(
new java.awt.Dimension(24, 24));
271 forwardButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_hover.png")));
272 forwardButton.addActionListener(
new java.awt.event.ActionListener() {
273 public void actionPerformed(java.awt.event.ActionEvent evt) {
274 forwardButtonActionPerformed(evt);
278 openViewPreferencesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/view-preferences-23.png")));
279 org.openide.awt.Mnemonics.setLocalizedText(openViewPreferencesButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.openViewPreferencesButton.text"));
280 openViewPreferencesButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
281 openViewPreferencesButton.setBorderPainted(
false);
282 openViewPreferencesButton.setContentAreaFilled(
false);
283 openViewPreferencesButton.setMaximumSize(
new java.awt.Dimension(24, 24));
284 openViewPreferencesButton.setMinimumSize(
new java.awt.Dimension(24, 24));
285 openViewPreferencesButton.setPreferredSize(
new java.awt.Dimension(24, 24));
286 openViewPreferencesButton.addActionListener(
new java.awt.event.ActionListener() {
287 public void actionPerformed(java.awt.event.ActionEvent evt) {
288 openViewPreferencesButtonActionPerformed(evt);
292 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
293 this.setLayout(layout);
294 layout.setHorizontalGroup(
295 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
296 .addComponent(treeView)
297 .addGroup(layout.createSequentialGroup()
299 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
300 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
301 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
302 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
303 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
306 layout.setVerticalGroup(
307 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
308 .addGroup(layout.createSequentialGroup()
310 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
311 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
312 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
313 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
314 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
315 .addComponent(treeView, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE))
321 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
324 String[] currentNodePath = backList.pollLast();
325 forwardList.addLast(currentNodePath);
326 forwardButton.setEnabled(
true);
333 String[] newCurrentNodePath = backList.peekLast();
336 if (backList.size() > 1) {
337 backButton.setEnabled(
true);
339 backButton.setEnabled(
false);
343 setSelectedNode(newCurrentNodePath, null);
345 this.setCursor(null);
350 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
352 String[] newCurrentNodePath = forwardList.pollLast();
353 if (!forwardList.isEmpty()) {
354 forwardButton.setEnabled(
true);
356 forwardButton.setEnabled(
false);
359 backList.addLast(newCurrentNodePath);
360 backButton.setEnabled(
true);
363 setSelectedNode(newCurrentNodePath, null);
365 this.setCursor(null);
369 viewPreferencesPanel.
load();
370 viewPreferencesPopupMenu.show(openViewPreferencesButton, 0, openViewPreferencesButton.getHeight() - 1);
390 if (instance == null) {
403 WindowManager winManager = WindowManager.
getDefault();
404 TopComponent win = winManager.findTopComponent(PREFERRED_ID);
407 "Cannot find " + PREFERRED_ID +
" component. It will not be located properly in the window system.");
411 return (DirectoryTreeTopComponent) win;
414 "There seem to be multiple components with the '" + PREFERRED_ID
415 +
"' ID. That is a potential source of errors and unexpected behavior.");
427 return TopComponent.PERSISTENCE_NEVER;
438 GroupDataSourcesDialog dialog =
new GroupDataSourcesDialog(dataSourceCount);
440 if (dialog.groupByDataSourceSelected()) {
442 refreshContentTreeSafe();
456 @NbBundle.Messages({
"# {0} - dataSourceCount",
457 "DirectoryTreeTopComponent.componentOpened.groupDataSources.text=This case contains {0} data sources. Would you like to group by data source for faster loading?",
458 "DirectoryTreeTopComponent.componentOpened.groupDataSources.title=Group by data source?"})
462 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
463 Case currentCase = null;
471 if (null == currentCase || currentCase.hasData() ==
false) {
472 getTree().setRootVisible(
false);
477 long threshold = DEFAULT_DATASOURCE_GROUPING_THRESHOLD;
481 }
catch (NumberFormatException ex) {
482 LOGGER.log(Level.SEVERE,
"Group data sources threshold is not a number", ex);
489 int dataSourceCount = currentCase.getDataSources().size();
491 && dataSourceCount > threshold) {
492 promptForDataSourceGrouping(dataSourceCount);
494 }
catch (TskCoreException ex) {
495 LOGGER.log(Level.SEVERE,
"Error loading data sources", ex);
501 autopsyTreeChildren = Children.create(autopsyTreeChildFactory,
true);
502 Node root =
new AbstractNode(autopsyTreeChildren) {
509 public Action[] getActions(
boolean popup) {
510 return new Action[]{};
516 public Node.Handle getHandle() {
517 return new Node.Handle() {
519 public Node getNode()
throws IOException {
520 return em.getRootContext();
526 root =
new DirectoryTreeFilterNode(root,
true);
528 em.setRootContext(root);
529 em.getRootContext().setName(currentCase.getName());
530 em.getRootContext().setDisplayName(currentCase.getName());
531 getTree().setRootVisible(
false);
535 new SwingWorker<Node[], Void>() {
537 protected Node[] doInBackground()
throws Exception {
538 Children rootChildren = em.getRootContext().getChildren();
539 TreeView tree = getTree();
542 if (!Objects.isNull(results)) {
543 tree.expandNode(results);
544 Children resultsChildren = results.getChildren();
545 Arrays.stream(resultsChildren.getNodes()).forEach(tree::expandNode);
551 if (!Objects.isNull(views)) {
552 Arrays.stream(views.getChildren().getNodes()).forEach(tree::expandNode);
553 tree.collapseNode(views);
564 if (rootChildren.getNodesCount() > 0) {
565 return new Node[]{rootChildren.getNodeAt(0)};
571 protected void done() {
575 if (!dataResult.isOpened()) {
586 Node[] selections =
get();
587 if (selections != null && selections.length > 0) {
588 em.setSelectedNodes(selections);
590 }
catch (PropertyVetoException ex) {
591 LOGGER.log(Level.SEVERE,
"Error setting default selected node.", ex);
592 }
catch (InterruptedException | ExecutionException ex) {
593 LOGGER.log(Level.SEVERE,
"Error expanding tree to initial state.", ex);
611 autopsyTreeChildren = null;
614 void writeProperties(java.util.Properties p) {
617 p.setProperty(
"version",
"1.0");
621 Object readProperties(java.util.Properties p) {
622 if (instance == null) {
630 String version = p.getProperty(
"version");
653 return openCase.
hasData() ==
false;
676 return new Action[]{};
687 Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
688 if (selectedNodes.length > 0) {
689 result = selectedNodes[0];
703 String changed =
event.getPropertyName();
713 if (event.getOldValue() != null &&
event.getNewValue() == null) {
715 SwingUtilities.invokeLater(() -> {
716 Node emptyNode =
new AbstractNode(Children.LEAF);
717 em.setRootContext(emptyNode);
719 }
else if (event.getNewValue() != null) {
721 Case newCase = (
Case) event.getNewValue();
722 final String newCaseName = newCase.
getName();
723 SwingUtilities.invokeLater(() -> {
724 em.getRootContext().setName(newCaseName);
725 em.getRootContext().setDisplayName(newCaseName);
755 SwingUtilities.invokeLater(() -> {
766 else if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) {
767 respondSelection((Node[]) event.getOldValue(), (Node[]) event.getNewValue());
783 @NbBundle.Messages(
"DirectoryTreeTopComponent.emptyMimeNode.text=Data not available. Run file type identification module.")
784 void respondSelection(
final Node[] oldNodes,
final Node[] newNodes) {
794 EventQueue.invokeLater(() -> {
796 DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
798 Node treeNode = DirectoryTreeTopComponent.this.getSelectedNode();
799 if (treeNode != null) {
800 Node originNode = ((DirectoryTreeFilterNode) treeNode).getOriginal();
802 Node drfn =
new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em);
804 if (FileTypesByMimeType.isEmptyMimeTypeNode(originNode)) {
807 EmptyNode emptyNode =
new EmptyNode(Bundle.DirectoryTreeTopComponent_emptyMimeNode_text());
808 dataResult.
setNode(
new TableFilterNode(emptyNode,
true,
"This Node Is Empty"));
809 }
else if (originNode instanceof DisplayableItemNode) {
810 dataResult.
setNode(
new TableFilterNode(drfn,
true, ((DisplayableItemNode) originNode).getItemType()));
812 dataResult.
setNode(
new TableFilterNode(drfn,
true));
814 String displayName =
"";
815 Content content = originNode.getLookup().lookup(Content.class);
816 if (content != null) {
818 displayName = content.getUniquePath();
819 }
catch (TskCoreException ex) {
820 LOGGER.log(Level.SEVERE,
"Exception while calling Content.getUniquePath() for node: {0}", originNode);
822 }
else if (originNode.getLookup().lookup(String.class) != null) {
823 displayName = originNode.getLookup().lookup(String.class);
825 dataResult.
setPath(displayName);
828 if (oldNodes != null && newNodes != null
829 && (oldNodes.length == newNodes.length)) {
830 boolean sameNodes =
true;
831 for (
int i = 0; i < oldNodes.length; i++) {
832 sameNodes = sameNodes && oldNodes[i].getName().equals(newNodes[i].getName());
835 dataResult.requestActive();
844 updateHistory(em.getSelectedNodes());
848 if (selectedNodes.length == 0) {
852 Node selectedNode = selectedNodes[0];
853 String selectedNodeName = selectedNode.getName();
861 String[] currentLast = backList.peekLast();
862 String lastNodeName = null;
863 if (currentLast != null && currentLast.length > 0) {
864 lastNodeName = currentLast[currentLast.length - 1];
867 if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
869 final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
870 backList.addLast(selectedPath);
871 if (backList.size() > 1) {
872 backButton.setEnabled(
true);
874 backButton.setEnabled(
false);
878 forwardButton.setEnabled(
false);
890 backButton.setEnabled(
false);
891 forwardButton.setEnabled(
false);
900 return (BeanTreeView) this.treeView;
907 SwingUtilities.invokeLater(this::rebuildTree);
914 SwingUtilities.invokeLater(() -> {
916 if (autopsyTreeChildren == null) {
921 for (Node dataSource : autopsyTreeChildren.getNodes()) {
923 if (tagsNode != null) {
930 if (tagsNode != null) {
951 if (null == currentCase || currentCase.
hasData() ==
false) {
961 new SwingWorker<Void, Void>() {
964 protected Void doInBackground()
throws Exception {
969 protected void done() {
973 selectFirstChildNode();
975 }
catch (InterruptedException | ExecutionException ex) {
976 LOGGER.log(Level.SEVERE,
"Error selecting tree node.", ex);
987 Children rootChildren = em.getRootContext().getChildren();
989 if (rootChildren.getNodesCount() > 0) {
990 Node firstNode = rootChildren.getNodeAt(0);
991 if (firstNode != null) {
992 final String[] selectedPath = NodeOp.createPath(firstNode, em.getRootContext());
993 setSelectedNode(selectedPath, null);
1005 private void setSelectedNode(
final String[] previouslySelectedNodePath,
final String rootNodeName) {
1006 if (previouslySelectedNodePath == null) {
1009 SwingUtilities.invokeLater(
new Runnable() {
1012 if (previouslySelectedNodePath.length > 0 && (rootNodeName == null || previouslySelectedNodePath[0].equals(rootNodeName))) {
1013 Node selectedNode = null;
1014 ArrayList<String> selectedNodePath =
new ArrayList<>(Arrays.asList(previouslySelectedNodePath));
1015 while (null == selectedNode && !selectedNodePath.isEmpty()) {
1017 selectedNode = NodeOp.findPath(em.getRootContext(), selectedNodePath.toArray(
new String[selectedNodePath.size()]));
1018 }
catch (NodeNotFoundException ex) {
1020 if (selectedNodePath.size() > 1) {
1021 selectedNodePath.remove(selectedNodePath.size() - 1);
1023 StringBuilder nodePath =
new StringBuilder();
1024 for (
int i = 0; i < previouslySelectedNodePath.length; ++i) {
1025 nodePath.append(previouslySelectedNodePath[i]).append(
"/");
1027 LOGGER.log(Level.WARNING,
"Failed to find any nodes to select on path " + nodePath.toString(), ex);
1033 if (null != selectedNode) {
1034 if (rootNodeName != null) {
1037 backList.pollLast();
1040 em.setExploredContextAndSelection(selectedNode,
new Node[]{selectedNode});
1041 }
catch (PropertyVetoException ex) {
1042 LOGGER.log(Level.WARNING,
"Property veto from ExplorerManager setting selection to " + selectedNode.getName(), ex);
1061 int typeID = art.getArtifactTypeID();
1062 String typeName = art.getArtifactTypeName();
1063 Children rootChilds = em.getRootContext().getChildren();
1064 Node treeNode = null;
1066 Children resultsChilds = resultsNode.getChildren();
1067 if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
1068 Node hashsetRootNode = resultsChilds.findChild(typeName);
1069 Children hashsetRootChilds = hashsetRootNode.getChildren();
1071 String setName = null;
1072 List<BlackboardAttribute> attributes = art.getAttributes();
1073 for (BlackboardAttribute att : attributes) {
1074 int typeId = att.getAttributeType().getTypeID();
1075 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1076 setName = att.getValueString();
1079 treeNode = hashsetRootChilds.findChild(setName);
1080 }
catch (TskCoreException ex) {
1081 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1083 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
1084 Node keywordRootNode = resultsChilds.findChild(typeName);
1085 Children keywordRootChilds = keywordRootNode.getChildren();
1087 String listName = null;
1088 String keywordName = null;
1089 String regex = null;
1090 List<BlackboardAttribute> attributes = art.getAttributes();
1091 for (BlackboardAttribute att : attributes) {
1092 int typeId = att.getAttributeType().getTypeID();
1093 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1094 listName = att.getValueString();
1095 }
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()) {
1096 keywordName = att.getValueString();
1097 }
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()) {
1098 regex = att.getValueString();
1101 if (listName == null) {
1102 if (regex == null) {
1103 listName = NbBundle.getMessage(
KeywordHits.class,
"KeywordHits.simpleLiteralSearch.text");
1105 listName = NbBundle.getMessage(
KeywordHits.class,
"KeywordHits.singleRegexSearch.text");
1108 Node listNode = keywordRootChilds.findChild(listName);
1109 if (listNode == null) {
1112 Children listChildren = listNode.getChildren();
1113 if (listChildren == null) {
1116 if (regex != null) {
1117 Node regexNode = listChildren.findChild(regex);
1118 if (regexNode == null) {
1121 listChildren = regexNode.getChildren();
1122 if (listChildren == null) {
1127 treeNode = listChildren.findChild(keywordName);
1129 }
catch (TskCoreException ex) {
1130 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1132 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
1133 || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
1134 Node interestingItemsRootNode = resultsChilds.findChild(NbBundle
1135 .getMessage(
InterestingHits.class,
"InterestingHits.interestingItems.text"));
1136 Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
1138 String setName = null;
1139 List<BlackboardAttribute> attributes = art.getAttributes();
1140 for (BlackboardAttribute att : attributes) {
1141 int typeId = att.getAttributeType().getTypeID();
1142 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1143 setName = att.getValueString();
1146 Node setNode = interestingItemsRootChildren.findChild(setName);
1147 if (setNode == null) {
1150 Children interestingChildren = setNode.getChildren();
1151 if (interestingChildren == null) {
1154 treeNode = interestingChildren.findChild(art.getDisplayName());
1155 }
catch (TskCoreException ex) {
1156 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1158 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
1159 Node emailMsgRootNode = resultsChilds.findChild(typeName);
1160 Children emailMsgRootChilds = emailMsgRootNode.getChildren();
1161 Map<String, String> parsedPath = null;
1163 List<BlackboardAttribute> attributes = art.getAttributes();
1164 for (BlackboardAttribute att : attributes) {
1165 int typeId = att.getAttributeType().getTypeID();
1166 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) {
1171 if (parsedPath == null) {
1174 Node defaultNode = emailMsgRootChilds.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class,
"EmailExtracted.defaultAcct.text")));
1175 Children defaultChildren = defaultNode.getChildren();
1176 treeNode = defaultChildren.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class,
"EmailExtracted.defaultFolder.text")));
1177 }
catch (TskCoreException ex) {
1178 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1181 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
1182 Node accountRootNode = resultsChilds.findChild(art.getDisplayName());
1183 Children accountRootChilds = accountRootNode.getChildren();
1184 List<BlackboardAttribute> attributes;
1185 String accountType = null;
1186 String ccNumberName = null;
1188 attributes = art.getAttributes();
1189 for (BlackboardAttribute att : attributes) {
1190 int typeId = att.getAttributeType().getTypeID();
1191 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID()) {
1192 accountType = att.getValueString();
1194 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CARD_NUMBER.getTypeID()) {
1195 ccNumberName = att.getValueString();
1198 if (accountType == null) {
1202 if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) {
1203 Node accountNode = accountRootChilds.findChild(Account.Type.CREDIT_CARD.getDisplayName());
1204 if (accountNode == null) {
1207 Children accountChildren = accountNode.getChildren();
1208 if (accountChildren == null) {
1211 Node binNode = accountChildren.findChild(NbBundle.getMessage(
Accounts.class,
"Accounts.ByBINNode.name"));
1212 if (binNode == null) {
1215 Children binChildren = binNode.getChildren();
1216 if (ccNumberName == null) {
1221 String binName = StringUtils.rightPad(ccNumberName, 8,
"0");
1222 binName = binName.substring(0, 8);
1225 bin = Integer.parseInt(binName);
1226 }
catch (NumberFormatException ex) {
1227 LOGGER.log(Level.WARNING,
"Unable to parseInt a BIN for node selection from string binName=" + binName, ex);
1231 if (binInfo != null) {
1232 int startBin = ((
BINRange) binInfo).getBINstart();
1233 int endBin = ((
BINRange) binInfo).getBINend();
1234 if (startBin != endBin) {
1235 binName = Integer.toString(startBin) +
"-" + Integer.toString(endBin).substring(5);
1238 if (binName == null) {
1241 treeNode = binChildren.findChild(binName);
1243 treeNode = accountRootChilds.findChild(accountType);
1245 }
catch (TskCoreException ex) {
1246 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1250 Children extractedChilds = extractedContent.getChildren();
1251 if (extractedChilds == null) {
1254 treeNode = extractedChilds.findChild(typeName);
1257 if (treeNode == null) {
1261 DisplayableItemNode undecoratedParentNode = (DisplayableItemNode) ((DirectoryTreeFilterNode) treeNode).getOriginal();
1263 getTree().expandNode(treeNode);
1264 if (this.getSelectedNode().equals(treeNode)) {
1265 this.setDirectoryListingActive();
1266 this.respondSelection(em.getSelectedNodes(),
new Node[]{treeNode});
1269 em.setExploredContextAndSelection(treeNode,
new Node[]{treeNode});
1270 }
catch (PropertyVetoException ex) {
1271 LOGGER.log(Level.WARNING,
"Property Veto: ", ex);
1279 NbBundle.getMessage(
this.getClass(),
"DirectoryTreeTopComponent.action.viewArtContent.text"),
TopComponent getTopComponent()
Children autopsyTreeChildren
void viewArtifact(final BlackboardArtifact art)
static final String HIDE_SLACK_FILES_IN_VIEWS_TREE
javax.swing.JScrollPane treeView
static final String HIDE_KNOWN_FILES_IN_VIEWS_TREE
static synchronized IngestManager getInstance()
DataResultTopComponent getDirectoryListing()
final LinkedList< String[]> forwardList
void setDirectoryListingActive()
static boolean runningWithGUI
void setShowRejected(boolean showRejected)
void setSelectedNode(final String[] previouslySelectedNodePath, final String rootNodeName)
javax.swing.JButton openViewPreferencesButton
boolean hasMenuOpenAction()
static void openCoreWindows()
void updateHistory(Node[] selectedNodes)
final LinkedList< String[]> backList
static synchronized BankIdentificationNumber getBINInfo(int bin)
void openDirectoryListing()
void refreshContentTreeSafe()
void readPropertiesImpl(java.util.Properties p)
void backButtonActionPerformed(java.awt.event.ActionEvent evt)
void setShowRejectedResults(boolean showRejectedResults)
static final String SHOW_ONLY_CURRENT_USER_TAGS
void propertyChange(PropertyChangeEvent event)
static final String HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE
AutopsyTreeChildFactory autopsyTreeChildFactory
void selectFirstChildNode()
DirectoryTreeTopComponent()
static synchronized DirectoryTreeTopComponent getDefault()
static final String DISPLAY_TIMES_IN_LOCAL_TIME
javax.swing.JButton forwardButton
static void setGroupItemsInTreeByDataSource(boolean value)
void addIngestJobEventListener(final PropertyChangeListener listener)
static final String KEEP_PREFERRED_VIEWER
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
boolean showRejectedResults
void viewArtifactContent(BlackboardArtifact art)
static final String DISPLAY_TRANSLATED_NAMES
void promptForDataSourceGrouping(int dataSourceCount)
ExplorerManager getExplorerManager()
javax.swing.JButton backButton
static final String HIDE_SLACK_FILES_IN_DATA_SRCS_TREE
static Boolean getGroupItemsInTreeByDataSource()
static String getConfigSetting(String moduleName, String settingName)
static DirectoryTreeTopComponent instance
void addOnFinishedListener(PropertyChangeListener l)
void addIngestModuleEventListener(final PropertyChangeListener listener)
static final String MAIN_SETTINGS
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
boolean getShowRejectedResults()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void addChangeListener(PreferenceChangeListener listener)
javax.swing.JPopupMenu viewPreferencesPopupMenu
void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo)
void forwardButtonActionPerformed(java.awt.event.ActionEvent evt)
void subscribeToChangeEvents()
static synchronized DirectoryTreeTopComponent findInstance()
void setPath(String pathText)
static final String TIME_ZONE_FOR_DISPLAYS
static boolean settingExists(String moduleName, String settingName)
static final String HIDE_CENTRAL_REPO_COMMENTS_AND_OCCURRENCES
static boolean isCaseOpen()
void openViewPreferencesButtonActionPerformed(java.awt.event.ActionEvent evt)
void setNode(Node selectedNode)