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.event.TreeExpansionEvent;
44 import javax.swing.event.TreeExpansionListener;
45 import javax.swing.tree.TreeSelectionModel;
46 import org.apache.commons.lang3.StringUtils;
47 import org.openide.explorer.ExplorerManager;
48 import org.openide.explorer.ExplorerUtils;
49 import org.openide.explorer.view.BeanTreeView;
50 import org.openide.explorer.view.Visualizer;
51 import org.openide.nodes.AbstractNode;
52 import org.openide.nodes.Children;
53 import org.openide.nodes.Node;
54 import org.openide.nodes.NodeNotFoundException;
55 import org.openide.nodes.NodeOp;
56 import org.openide.util.NbBundle;
57 import org.openide.util.NbBundle.Messages;
58 import org.openide.windows.TopComponent;
59 import org.openide.windows.WindowManager;
99 "DirectoryTreeTopComponent.resultsView.title=Listing"
101 @SuppressWarnings(
"PMD.SingularField")
104 private final transient ExplorerManager em =
new ExplorerManager();
110 private static final String PREFERRED_ID =
"DirectoryTreeTopComponent";
116 private static final long DEFAULT_DATASOURCE_GROUPING_THRESHOLD = 5;
117 private static final String GROUPING_THRESHOLD_NAME =
"GroupDataSourceThreshold";
118 private static final String SETTINGS_FILE =
"CasePreferences.properties";
127 getTree().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
130 ((ExpansionBeanTreeView) getTree()).addTreeExpansionListener(
new TreeExpansionListener() {
132 public void treeExpanded(TreeExpansionEvent event) {
139 Node expandedNode = Visualizer.findNode(event.getPath().getLastPathComponent());
140 for (Node child : em.getRootContext().getChildren().getNodes()) {
141 if (child.equals(expandedNode)) {
142 preExpandNodes(child.getChildren());
148 public void treeCollapsed(TreeExpansionEvent event) {
154 putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
158 subscribeToChangeEvents();
159 associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
162 this.backList =
new LinkedList<>();
163 this.forwardList =
new LinkedList<>();
164 backButton.setEnabled(
false);
165 forwardButton.setEnabled(
false);
167 viewPreferencesPopupMenu.add(viewPreferencesPanel);
168 viewPreferencesPopupMenu.setSize(viewPreferencesPanel.getPreferredSize().width + 6, viewPreferencesPanel.getPreferredSize().height + 6);
169 viewPreferencesPopupMenu.addPopupMenuListener(
new PopupMenuListener() {
171 public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
172 openViewPreferencesButton.setSelected(
true);
176 public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
177 openViewPreferencesButton.setSelected(
false);
181 public void popupMenuCanceled(PopupMenuEvent e) {
182 openViewPreferencesButton.setSelected(
false);
194 BeanTreeView tree = getTree();
197 if (!Objects.isNull(results)) {
198 tree.expandNode(results);
199 Children resultsChildren = results.getChildren();
200 Arrays.stream(resultsChildren.getNodes()).forEach(tree::expandNode);
204 if (!Objects.isNull(views)) {
205 tree.expandNode(views);
215 public void preferenceChange(PreferenceChangeEvent evt) {
216 switch (evt.getKey()) {
225 refreshContentTreeSafe();
233 refreshContentTreeSafe();
240 this.em.addPropertyChangeListener(
this);
244 this.dataResult.requestActive();
248 this.dataResult.
open();
252 return this.dataResult;
261 return showRejectedResults;
271 this.showRejectedResults = showRejectedResults;
272 if (accounts != null) {
285 viewPreferencesPopupMenu =
new javax.swing.JPopupMenu();
286 treeView =
new ExpansionBeanTreeView();
287 backButton =
new javax.swing.JButton();
288 forwardButton =
new javax.swing.JButton();
289 openViewPreferencesButton =
new javax.swing.JButton();
291 treeView.setBorder(null);
293 backButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back.png")));
294 org.openide.awt.Mnemonics.setLocalizedText(backButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.backButton.text"));
295 backButton.setBorderPainted(
false);
296 backButton.setContentAreaFilled(
false);
297 backButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_disabled.png")));
298 backButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
299 backButton.setMaximumSize(
new java.awt.Dimension(55, 100));
300 backButton.setMinimumSize(
new java.awt.Dimension(5, 5));
301 backButton.setPreferredSize(
new java.awt.Dimension(24, 24));
302 backButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_hover.png")));
303 backButton.addActionListener(
new java.awt.event.ActionListener() {
304 public void actionPerformed(java.awt.event.ActionEvent evt) {
305 backButtonActionPerformed(evt);
309 forwardButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward.png")));
310 org.openide.awt.Mnemonics.setLocalizedText(forwardButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.forwardButton.text"));
311 forwardButton.setBorderPainted(
false);
312 forwardButton.setContentAreaFilled(
false);
313 forwardButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_disabled.png")));
314 forwardButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
315 forwardButton.setMaximumSize(
new java.awt.Dimension(55, 100));
316 forwardButton.setMinimumSize(
new java.awt.Dimension(5, 5));
317 forwardButton.setPreferredSize(
new java.awt.Dimension(24, 24));
318 forwardButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_hover.png")));
319 forwardButton.addActionListener(
new java.awt.event.ActionListener() {
320 public void actionPerformed(java.awt.event.ActionEvent evt) {
321 forwardButtonActionPerformed(evt);
325 openViewPreferencesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/view-preferences-23.png")));
326 org.openide.awt.Mnemonics.setLocalizedText(openViewPreferencesButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.openViewPreferencesButton.text"));
327 openViewPreferencesButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
328 openViewPreferencesButton.setBorderPainted(
false);
329 openViewPreferencesButton.setContentAreaFilled(
false);
330 openViewPreferencesButton.setMaximumSize(
new java.awt.Dimension(24, 24));
331 openViewPreferencesButton.setMinimumSize(
new java.awt.Dimension(24, 24));
332 openViewPreferencesButton.setPreferredSize(
new java.awt.Dimension(24, 24));
333 openViewPreferencesButton.addActionListener(
new java.awt.event.ActionListener() {
334 public void actionPerformed(java.awt.event.ActionEvent evt) {
335 openViewPreferencesButtonActionPerformed(evt);
339 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
340 this.setLayout(layout);
341 layout.setHorizontalGroup(
342 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
343 .addComponent(treeView)
344 .addGroup(layout.createSequentialGroup()
346 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
347 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
348 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
349 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
350 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
353 layout.setVerticalGroup(
354 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
355 .addGroup(layout.createSequentialGroup()
357 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
358 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
359 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
360 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
361 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
362 .addComponent(treeView, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE))
368 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
371 String[] currentNodePath = backList.pollLast();
372 forwardList.addLast(currentNodePath);
373 forwardButton.setEnabled(
true);
380 String[] newCurrentNodePath = backList.peekLast();
383 if (backList.size() > 1) {
384 backButton.setEnabled(
true);
386 backButton.setEnabled(
false);
390 setSelectedNode(newCurrentNodePath, null);
392 this.setCursor(null);
397 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
399 String[] newCurrentNodePath = forwardList.pollLast();
400 if (!forwardList.isEmpty()) {
401 forwardButton.setEnabled(
true);
403 forwardButton.setEnabled(
false);
406 backList.addLast(newCurrentNodePath);
407 backButton.setEnabled(
true);
410 setSelectedNode(newCurrentNodePath, null);
412 this.setCursor(null);
416 viewPreferencesPanel.
load();
417 viewPreferencesPopupMenu.show(openViewPreferencesButton, 0, openViewPreferencesButton.getHeight() - 1);
437 if (instance == null) {
450 WindowManager winManager = WindowManager.
getDefault();
451 TopComponent win = winManager.findTopComponent(PREFERRED_ID);
454 "Cannot find " + PREFERRED_ID +
" component. It will not be located properly in the window system.");
458 return (DirectoryTreeTopComponent) win;
461 "There seem to be multiple components with the '" + PREFERRED_ID
462 +
"' ID. That is a potential source of errors and unexpected behavior.");
474 return TopComponent.PERSISTENCE_NEVER;
485 GroupDataSourcesDialog dialog =
new GroupDataSourcesDialog(dataSourceCount);
487 if (dialog.groupByDataSourceSelected()) {
489 refreshContentTreeSafe();
503 @NbBundle.Messages({
"# {0} - dataSourceCount",
504 "DirectoryTreeTopComponent.componentOpened.groupDataSources.text=This case contains {0} data sources. Would you like to group by data source for faster loading?",
505 "DirectoryTreeTopComponent.componentOpened.groupDataSources.title=Group by data source?"})
509 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
510 Case currentCase = null;
518 if (null == currentCase || currentCase.hasData() ==
false) {
519 getTree().setRootVisible(
false);
524 long threshold = DEFAULT_DATASOURCE_GROUPING_THRESHOLD;
528 }
catch (NumberFormatException ex) {
529 LOGGER.log(Level.SEVERE,
"Group data sources threshold is not a number", ex);
536 int dataSourceCount = currentCase.getDataSources().size();
538 && dataSourceCount > threshold) {
539 promptForDataSourceGrouping(dataSourceCount);
541 }
catch (TskCoreException ex) {
542 LOGGER.log(Level.SEVERE,
"Error loading data sources", ex);
548 autopsyTreeChildren = Children.create(autopsyTreeChildFactory,
true);
549 Node root =
new AbstractNode(autopsyTreeChildren) {
556 public Action[] getActions(
boolean popup) {
557 return new Action[]{};
563 public Node.Handle getHandle() {
564 return new Node.Handle() {
566 public Node getNode()
throws IOException {
567 return em.getRootContext();
573 root =
new DirectoryTreeFilterNode(root,
true);
575 em.setRootContext(root);
576 em.getRootContext().setName(currentCase.getName());
577 em.getRootContext().setDisplayName(currentCase.getName());
578 getTree().setRootVisible(
false);
582 new SwingWorker<Node[], Void>() {
584 protected Node[] doInBackground()
throws Exception {
585 Children rootChildren = em.getRootContext().getChildren();
586 preExpandNodes(rootChildren);
596 if (rootChildren.getNodesCount() > 0) {
597 return new Node[]{rootChildren.getNodeAt(0)};
603 protected void done() {
607 if (!dataResult.isOpened()) {
618 Node[] selections =
get();
619 if (selections != null && selections.length > 0) {
620 em.setSelectedNodes(selections);
622 }
catch (PropertyVetoException ex) {
623 LOGGER.log(Level.SEVERE,
"Error setting default selected node.", ex);
624 }
catch (InterruptedException | ExecutionException ex) {
625 LOGGER.log(Level.SEVERE,
"Error expanding tree to initial state.", ex);
643 autopsyTreeChildren = null;
646 void writeProperties(java.util.Properties p) {
649 p.setProperty(
"version",
"1.0");
653 Object readProperties(java.util.Properties p) {
654 if (instance == null) {
662 String version = p.getProperty(
"version");
685 return openCase.
hasData() ==
false;
708 return new Action[]{};
719 Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
720 if (selectedNodes.length > 0) {
721 result = selectedNodes[0];
735 String changed =
event.getPropertyName();
745 if (event.getOldValue() != null &&
event.getNewValue() == null) {
747 SwingUtilities.invokeLater(() -> {
748 Node emptyNode =
new AbstractNode(Children.LEAF);
749 em.setRootContext(emptyNode);
751 }
else if (event.getNewValue() != null) {
753 Case newCase = (
Case) event.getNewValue();
754 final String newCaseName = newCase.
getName();
755 SwingUtilities.invokeLater(() -> {
756 em.getRootContext().setName(newCaseName);
757 em.getRootContext().setDisplayName(newCaseName);
787 SwingUtilities.invokeLater(() -> {
798 else if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) {
799 respondSelection((Node[]) event.getOldValue(), (Node[]) event.getNewValue());
812 @NbBundle.Messages(
"DirectoryTreeTopComponent.emptyMimeNode.text=Data not available. Run file type identification module.")
813 void respondSelection(
final Node[] oldNodes,
final Node[] newNodes) {
823 EventQueue.invokeLater(() -> {
825 DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
827 Node treeNode = DirectoryTreeTopComponent.this.getSelectedNode();
828 if (treeNode != null) {
829 Node originNode = ((DirectoryTreeFilterNode) treeNode).getOriginal();
831 Node drfn =
new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em);
833 if (FileTypesByMimeType.isEmptyMimeTypeNode(originNode)) {
836 EmptyNode emptyNode =
new EmptyNode(Bundle.DirectoryTreeTopComponent_emptyMimeNode_text());
837 dataResult.
setNode(
new TableFilterNode(emptyNode,
true,
"This Node Is Empty"));
838 }
else if (originNode instanceof DisplayableItemNode) {
839 dataResult.
setNode(
new TableFilterNode(drfn,
true, ((DisplayableItemNode) originNode).getItemType()));
841 dataResult.
setNode(
new TableFilterNode(drfn,
true));
843 String displayName =
"";
844 Content content = originNode.getLookup().lookup(Content.class);
845 if (content != null) {
847 displayName = content.getUniquePath();
848 }
catch (TskCoreException ex) {
849 LOGGER.log(Level.SEVERE,
"Exception while calling Content.getUniquePath() for node: {0}", originNode);
851 }
else if (originNode.getLookup().lookup(String.class) != null) {
852 displayName = originNode.getLookup().lookup(String.class);
854 dataResult.
setPath(displayName);
857 if (oldNodes != null && newNodes != null
858 && (oldNodes.length == newNodes.length)) {
859 boolean sameNodes =
true;
860 for (
int i = 0; i < oldNodes.length; i++) {
861 sameNodes = sameNodes && oldNodes[i].getName().equals(newNodes[i].getName());
864 dataResult.requestActive();
873 updateHistory(em.getSelectedNodes());
877 if (selectedNodes.length == 0) {
881 Node selectedNode = selectedNodes[0];
882 String selectedNodeName = selectedNode.getName();
890 String[] currentLast = backList.peekLast();
891 String lastNodeName = null;
892 if (currentLast != null && currentLast.length > 0) {
893 lastNodeName = currentLast[currentLast.length - 1];
896 if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
898 final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
899 backList.addLast(selectedPath);
900 if (backList.size() > 1) {
901 backButton.setEnabled(
true);
903 backButton.setEnabled(
false);
907 forwardButton.setEnabled(
false);
919 backButton.setEnabled(
false);
920 forwardButton.setEnabled(
false);
928 BeanTreeView getTree() {
929 return (BeanTreeView) this.treeView;
936 SwingUtilities.invokeLater(this::rebuildTree);
943 SwingUtilities.invokeLater(() -> {
945 if (autopsyTreeChildren == null) {
950 for (Node dataSource : autopsyTreeChildren.getNodes()) {
952 if (tagsNode != null) {
959 if (tagsNode != null) {
980 if (null == currentCase || currentCase.
hasData() ==
false) {
990 new SwingWorker<Void, Void>() {
993 protected Void doInBackground()
throws Exception {
998 protected void done() {
1003 preExpandNodes(em.getRootContext().getChildren());
1004 }
catch (InterruptedException | ExecutionException ex) {
1005 LOGGER.log(Level.SEVERE,
"Error selecting tree node.", ex);
1018 private void setSelectedNode(
final String[] previouslySelectedNodePath,
final String rootNodeName) {
1019 if (previouslySelectedNodePath == null) {
1022 SwingUtilities.invokeLater(
new Runnable() {
1025 if (previouslySelectedNodePath.length > 0 && (rootNodeName == null || previouslySelectedNodePath[0].equals(rootNodeName))) {
1026 Node selectedNode = null;
1027 ArrayList<String> selectedNodePath =
new ArrayList<>(Arrays.asList(previouslySelectedNodePath));
1028 while (null == selectedNode && !selectedNodePath.isEmpty()) {
1030 selectedNode = NodeOp.findPath(em.getRootContext(), selectedNodePath.toArray(
new String[selectedNodePath.size()]));
1031 }
catch (NodeNotFoundException ex) {
1033 if (selectedNodePath.size() > 1) {
1034 selectedNodePath.remove(selectedNodePath.size() - 1);
1036 StringBuilder nodePath =
new StringBuilder();
1037 for (
int i = 0; i < previouslySelectedNodePath.length; ++i) {
1038 nodePath.append(previouslySelectedNodePath[i]).append(
"/");
1040 LOGGER.log(Level.WARNING,
"Failed to find any nodes to select on path " + nodePath.toString(), ex);
1046 if (null != selectedNode) {
1047 if (rootNodeName != null) {
1050 backList.pollLast();
1053 em.setExploredContextAndSelection(selectedNode,
new Node[]{selectedNode});
1054 }
catch (PropertyVetoException ex) {
1055 LOGGER.log(Level.WARNING,
"Property veto from ExplorerManager setting selection to " + selectedNode.getName(), ex);
1074 int typeID = art.getArtifactTypeID();
1075 String typeName = art.getArtifactTypeName();
1076 Children rootChilds = em.getRootContext().getChildren();
1077 Node treeNode = null;
1079 Children resultsChilds = resultsNode.getChildren();
1080 if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
1081 Node hashsetRootNode = resultsChilds.findChild(typeName);
1082 Children hashsetRootChilds = hashsetRootNode.getChildren();
1084 String setName = null;
1085 List<BlackboardAttribute> attributes = art.getAttributes();
1086 for (BlackboardAttribute att : attributes) {
1087 int typeId = att.getAttributeType().getTypeID();
1088 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1089 setName = att.getValueString();
1092 treeNode = hashsetRootChilds.findChild(setName);
1093 }
catch (TskCoreException ex) {
1094 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1096 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
1097 Node keywordRootNode = resultsChilds.findChild(typeName);
1098 Children keywordRootChilds = keywordRootNode.getChildren();
1100 String listName = null;
1101 String keywordName = null;
1102 String regex = null;
1103 List<BlackboardAttribute> attributes = art.getAttributes();
1104 for (BlackboardAttribute att : attributes) {
1105 int typeId = att.getAttributeType().getTypeID();
1106 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1107 listName = att.getValueString();
1108 }
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()) {
1109 keywordName = att.getValueString();
1110 }
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()) {
1111 regex = att.getValueString();
1114 if (listName == null) {
1115 if (regex == null) {
1116 listName = NbBundle.getMessage(
KeywordHits.class,
"KeywordHits.simpleLiteralSearch.text");
1118 listName = NbBundle.getMessage(
KeywordHits.class,
"KeywordHits.singleRegexSearch.text");
1121 Node listNode = keywordRootChilds.findChild(listName);
1122 if (listNode == null) {
1125 Children listChildren = listNode.getChildren();
1126 if (listChildren == null) {
1129 if (regex != null) {
1130 Node regexNode = listChildren.findChild(regex);
1131 if (regexNode == null) {
1134 listChildren = regexNode.getChildren();
1135 if (listChildren == null) {
1140 treeNode = listChildren.findChild(keywordName);
1142 }
catch (TskCoreException ex) {
1143 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1145 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
1146 || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
1147 Node interestingItemsRootNode = resultsChilds.findChild(NbBundle
1148 .getMessage(
InterestingHits.class,
"InterestingHits.interestingItems.text"));
1149 Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
1151 String setName = null;
1152 List<BlackboardAttribute> attributes = art.getAttributes();
1153 for (BlackboardAttribute att : attributes) {
1154 int typeId = att.getAttributeType().getTypeID();
1155 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1156 setName = att.getValueString();
1159 Node setNode = interestingItemsRootChildren.findChild(setName);
1160 if (setNode == null) {
1163 Children interestingChildren = setNode.getChildren();
1164 if (interestingChildren == null) {
1167 treeNode = interestingChildren.findChild(art.getDisplayName());
1168 }
catch (TskCoreException ex) {
1169 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1171 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
1172 Node emailMsgRootNode = resultsChilds.findChild(typeName);
1173 Children emailMsgRootChilds = emailMsgRootNode.getChildren();
1174 Map<String, String> parsedPath = null;
1176 List<BlackboardAttribute> attributes = art.getAttributes();
1177 for (BlackboardAttribute att : attributes) {
1178 int typeId = att.getAttributeType().getTypeID();
1179 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) {
1184 if (parsedPath == null) {
1187 Node defaultNode = emailMsgRootChilds.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class,
"EmailExtracted.defaultAcct.text")));
1188 Children defaultChildren = defaultNode.getChildren();
1189 treeNode = defaultChildren.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class,
"EmailExtracted.defaultFolder.text")));
1190 }
catch (TskCoreException ex) {
1191 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1194 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
1195 Node accountRootNode = resultsChilds.findChild(art.getDisplayName());
1196 Children accountRootChilds = accountRootNode.getChildren();
1197 List<BlackboardAttribute> attributes;
1198 String accountType = null;
1199 String ccNumberName = null;
1201 attributes = art.getAttributes();
1202 for (BlackboardAttribute att : attributes) {
1203 int typeId = att.getAttributeType().getTypeID();
1204 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID()) {
1205 accountType = att.getValueString();
1207 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CARD_NUMBER.getTypeID()) {
1208 ccNumberName = att.getValueString();
1211 if (accountType == null) {
1215 if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) {
1216 Node accountNode = accountRootChilds.findChild(Account.Type.CREDIT_CARD.getDisplayName());
1217 if (accountNode == null) {
1220 Children accountChildren = accountNode.getChildren();
1221 if (accountChildren == null) {
1224 Node binNode = accountChildren.findChild(NbBundle.getMessage(
Accounts.class,
"Accounts.ByBINNode.name"));
1225 if (binNode == null) {
1228 Children binChildren = binNode.getChildren();
1229 if (ccNumberName == null) {
1234 String binName = StringUtils.rightPad(ccNumberName, 8,
"0");
1235 binName = binName.substring(0, 8);
1238 bin = Integer.parseInt(binName);
1239 }
catch (NumberFormatException ex) {
1240 LOGGER.log(Level.WARNING,
"Unable to parseInt a BIN for node selection from string binName=" + binName, ex);
1244 if (binInfo != null) {
1245 int startBin = ((
BINRange) binInfo).getBINstart();
1246 int endBin = ((
BINRange) binInfo).getBINend();
1247 if (startBin != endBin) {
1248 binName = Integer.toString(startBin) +
"-" + Integer.toString(endBin).substring(5);
1251 if (binName == null) {
1254 treeNode = binChildren.findChild(binName);
1256 treeNode = accountRootChilds.findChild(accountType);
1258 }
catch (TskCoreException ex) {
1259 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1263 Children extractedChilds = extractedContent.getChildren();
1264 if (extractedChilds == null) {
1267 treeNode = extractedChilds.findChild(typeName);
1270 if (treeNode == null) {
1274 DisplayableItemNode undecoratedParentNode = (DisplayableItemNode) ((DirectoryTreeFilterNode) treeNode).getOriginal();
1276 getTree().expandNode(treeNode);
1277 if (this.getSelectedNode().equals(treeNode)) {
1278 this.setDirectoryListingActive();
1279 this.respondSelection(em.getSelectedNodes(),
new Node[]{treeNode});
1282 em.setExploredContextAndSelection(treeNode,
new Node[]{treeNode});
1283 }
catch (PropertyVetoException ex) {
1284 LOGGER.log(Level.WARNING,
"Property Veto: ", ex);
1292 NbBundle.getMessage(
this.getClass(),
"DirectoryTreeTopComponent.action.viewArtContent.text"),
static synchronized String getConfigSetting(String moduleName, String settingName)
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
DataResultTopComponent getDirectoryListing()
final LinkedList< String[]> forwardList
void setDirectoryListingActive()
static boolean runningWithGUI
void setShowRejected(boolean showRejected)
static final String HIDE_SCO_COLUMNS
void setSelectedNode(final String[] previouslySelectedNodePath, final String rootNodeName)
javax.swing.JButton openViewPreferencesButton
boolean hasMenuOpenAction()
static void openCoreWindows()
static final String TEXT_TRANSLATOR_NAME
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
static synchronized boolean settingExists(String moduleName, String settingName)
DirectoryTreeTopComponent()
static synchronized DirectoryTreeTopComponent getDefault()
static final String DISPLAY_TIMES_IN_LOCAL_TIME
javax.swing.JButton forwardButton
static void setGroupItemsInTreeByDataSource(boolean value)
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
void preExpandNodes(Children rootChildren)
static Boolean getGroupItemsInTreeByDataSource()
static DirectoryTreeTopComponent instance
void addOnFinishedListener(PropertyChangeListener l)
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 isCaseOpen()
void openViewPreferencesButtonActionPerformed(java.awt.event.ActionEvent evt)
void setNode(Node selectedNode)