Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ContextViewer.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.contentviewers.contextviewer;
20 
21 import java.awt.Component;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.Comparator;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.logging.Level;
29 import javax.swing.BoxLayout;
30 import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
31 import org.apache.commons.lang.StringUtils;
32 import org.openide.nodes.Node;
33 import org.openide.util.NbBundle;
34 import org.openide.util.lookup.ServiceProvider;
39 import org.sleuthkit.datamodel.AbstractFile;
40 import org.sleuthkit.datamodel.BlackboardArtifact;
41 import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
42 import org.sleuthkit.datamodel.BlackboardAttribute;
43 import org.sleuthkit.datamodel.SleuthkitCase;
44 import org.sleuthkit.datamodel.TskCoreException;
45 
51 @ServiceProvider(service = DataContentViewer.class, position = 7)
52 public final class ContextViewer extends javax.swing.JPanel implements DataContentViewer {
53 
54  private static final long serialVersionUID = 1L;
55  private static final Logger logger = Logger.getLogger(ContextViewer.class.getName());
56  private static final int ARTIFACT_STR_MAX_LEN = 1024;
57  private static final int ATTRIBUTE_STR_MAX_LEN = 200;
58 
59  // defines a list of artifacts that provide context for a file
60  private static final List<BlackboardArtifact.ARTIFACT_TYPE> CONTEXT_ARTIFACTS = new ArrayList<>();
61  private final List<ContextSourcePanel> contextSourcePanels = new ArrayList<>();
62  private final List<ContextUsagePanel> contextUsagePanels = new ArrayList<>();
63 
64  static {
65  CONTEXT_ARTIFACTS.add(TSK_ASSOCIATED_OBJECT);
66  }
67 
71  public ContextViewer() {
72 
73  initComponents();
74  jScrollPane.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
75  }
76 
82  @SuppressWarnings("unchecked")
83  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
84  private void initComponents() {
85 
86  jSourcePanel = new javax.swing.JPanel();
87  javax.swing.JLabel jSourceLabel = new javax.swing.JLabel();
88  jUsagePanel = new javax.swing.JPanel();
89  javax.swing.JLabel jUsageLabel = new javax.swing.JLabel();
90  jUnknownPanel = new javax.swing.JPanel();
91  javax.swing.JLabel jUnknownLabel = new javax.swing.JLabel();
92  jScrollPane = new javax.swing.JScrollPane();
93 
94  jSourcePanel.setBackground(javax.swing.UIManager.getDefaults().getColor("window"));
95 
96  jSourceLabel.setFont(jSourceLabel.getFont().deriveFont(jSourceLabel.getFont().getStyle() | java.awt.Font.BOLD, jSourceLabel.getFont().getSize()+1));
97  org.openide.awt.Mnemonics.setLocalizedText(jSourceLabel, org.openide.util.NbBundle.getMessage(ContextViewer.class, "ContextViewer.jSourceLabel.text")); // NOI18N
98 
99  javax.swing.GroupLayout jSourcePanelLayout = new javax.swing.GroupLayout(jSourcePanel);
100  jSourcePanel.setLayout(jSourcePanelLayout);
101  jSourcePanelLayout.setHorizontalGroup(
102  jSourcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
103  .addGroup(jSourcePanelLayout.createSequentialGroup()
104  .addGap(40, 40, 40)
105  .addComponent(jSourceLabel)
106  .addContainerGap(304, Short.MAX_VALUE))
107  );
108  jSourcePanelLayout.setVerticalGroup(
109  jSourcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
110  .addGroup(jSourcePanelLayout.createSequentialGroup()
111  .addGap(5, 5, 5)
112  .addComponent(jSourceLabel)
113  .addGap(2, 2, 2))
114  );
115 
116  jUsagePanel.setBackground(javax.swing.UIManager.getDefaults().getColor("window"));
117 
118  jUsageLabel.setFont(jUsageLabel.getFont().deriveFont(jUsageLabel.getFont().getStyle() | java.awt.Font.BOLD, jUsageLabel.getFont().getSize()+1));
119  org.openide.awt.Mnemonics.setLocalizedText(jUsageLabel, org.openide.util.NbBundle.getMessage(ContextViewer.class, "ContextViewer.jUsageLabel.text")); // NOI18N
120 
121  javax.swing.GroupLayout jUsagePanelLayout = new javax.swing.GroupLayout(jUsagePanel);
122  jUsagePanel.setLayout(jUsagePanelLayout);
123  jUsagePanelLayout.setHorizontalGroup(
124  jUsagePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
125  .addGroup(jUsagePanelLayout.createSequentialGroup()
126  .addGap(40, 40, 40)
127  .addComponent(jUsageLabel)
128  .addContainerGap(298, Short.MAX_VALUE))
129  );
130  jUsagePanelLayout.setVerticalGroup(
131  jUsagePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
132  .addGroup(jUsagePanelLayout.createSequentialGroup()
133  .addGap(2, 2, 2)
134  .addComponent(jUsageLabel)
135  .addGap(2, 2, 2))
136  );
137 
138  jUnknownPanel.setBackground(new java.awt.Color(255, 255, 255));
139 
140  org.openide.awt.Mnemonics.setLocalizedText(jUnknownLabel, org.openide.util.NbBundle.getMessage(ContextViewer.class, "ContextViewer.jUnknownLabel.text")); // NOI18N
141 
142  javax.swing.GroupLayout jUnknownPanelLayout = new javax.swing.GroupLayout(jUnknownPanel);
143  jUnknownPanel.setLayout(jUnknownPanelLayout);
144  jUnknownPanelLayout.setHorizontalGroup(
145  jUnknownPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
146  .addGroup(jUnknownPanelLayout.createSequentialGroup()
147  .addGap(50, 50, 50)
148  .addComponent(jUnknownLabel)
149  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
150  );
151  jUnknownPanelLayout.setVerticalGroup(
152  jUnknownPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
153  .addGroup(jUnknownPanelLayout.createSequentialGroup()
154  .addGap(2, 2, 2)
155  .addComponent(jUnknownLabel)
156  .addGap(2, 2, 2))
157  );
158 
159  setBackground(new java.awt.Color(255, 255, 255));
160  setPreferredSize(new java.awt.Dimension(495, 358));
161 
162  jScrollPane.setBackground(new java.awt.Color(255, 255, 255));
163 
164  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
165  this.setLayout(layout);
166  layout.setHorizontalGroup(
167  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
168  .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 509, Short.MAX_VALUE)
169  );
170  layout.setVerticalGroup(
171  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
172  .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE)
173  );
174  }// </editor-fold>//GEN-END:initComponents
175 
176  @Override
177  public void setNode(Node selectedNode) {
178  if ((selectedNode == null) || (!isSupported(selectedNode))) {
179  resetComponent();
180  return;
181  }
182 
183  AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class);
184  try {
185  populatePanels(file);
186  } catch (NoCurrentCaseException | TskCoreException ex) {
187  logger.log(Level.SEVERE, String.format("Exception displaying context for file %s", file.getName()), ex); //NON-NLS
188  }
189  }
190 
191  @NbBundle.Messages({
192  "ContextViewer.title=Context",
193  "ContextViewer.toolTip=Displays context for selected file."
194  })
195 
196  @Override
197  public String getTitle() {
198  return Bundle.ContextViewer_title();
199  }
200 
201  @Override
202  public String getToolTip() {
203  return Bundle.ContextViewer_toolTip();
204  }
205 
206  @Override
207  public DataContentViewer createInstance() {
208  return new ContextViewer();
209  }
210 
211  @Override
212  public Component getComponent() {
213  return this;
214  }
215 
216  @Override
217  public void resetComponent() {
218  contextSourcePanels.clear();
219  contextUsagePanels.clear();
220  }
221 
222  @Override
223  public boolean isSupported(Node node) {
224 
225  // check if the node has an abstract file and the file has any context defining artifacts.
226  if (node.getLookup().lookup(AbstractFile.class) != null) {
227  AbstractFile abstractFile = node.getLookup().lookup(AbstractFile.class);
228  for (BlackboardArtifact.ARTIFACT_TYPE artifactType : CONTEXT_ARTIFACTS) {
229  List<BlackboardArtifact> artifactsList;
230  try {
231  artifactsList = abstractFile.getArtifacts(artifactType);
232  if (!artifactsList.isEmpty()) {
233  return true;
234  }
235  } catch (TskCoreException ex) {
236  logger.log(Level.SEVERE, String.format("Exception while looking up context artifacts for file %s", abstractFile), ex); //NON-NLS
237  }
238  }
239 
240  }
241 
242  return false;
243  }
244 
245  @Override
246  public int isPreferred(Node node) {
247  // this is a low preference viewer.
248  return 1;
249  }
250 
251  @NbBundle.Messages({
252  "ContextViewer.unknownSource=Unknown ",
253  })
263  private void populatePanels(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException {
264 
265  SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase();
266 
267  // Check for all context artifacts
268  boolean foundASource = false;
269  for (BlackboardArtifact.ARTIFACT_TYPE artifactType : CONTEXT_ARTIFACTS) {
270  List<BlackboardArtifact> artifactsList = tskCase.getBlackboardArtifacts(artifactType, sourceFile.getId());
271 
272  foundASource = !artifactsList.isEmpty();
273  for (BlackboardArtifact contextArtifact : artifactsList) {
274  addAssociatedArtifactToPanel(contextArtifact);
275  }
276  }
277  javax.swing.JPanel contextContainer = new javax.swing.JPanel();
278  contextContainer.add(jSourcePanel);
279  contextContainer.setLayout(new BoxLayout(contextContainer, BoxLayout.Y_AXIS));
280  if (contextSourcePanels.isEmpty()) {
281  contextContainer.add(jUnknownPanel);
282  } else {
283  for (javax.swing.JPanel sourcePanel : contextSourcePanels) {
284  contextContainer.add(sourcePanel);
285  }
286  }
287  contextContainer.add(jUsagePanel);
288  if (contextUsagePanels.isEmpty()) {
289  contextContainer.add(jUnknownPanel);
290  } else {
291  for (javax.swing.JPanel usagePanel : contextUsagePanels) {
292  contextContainer.add(usagePanel);
293  }
294  }
295 
296  contextContainer.setBackground(javax.swing.UIManager.getDefaults().getColor("window"));
297  contextContainer.setEnabled(foundASource);
298  contextContainer.setVisible(foundASource);
299  jScrollPane.getViewport().setView(contextContainer);
300  jScrollPane.setEnabled(foundASource);
301  jScrollPane.setVisible(foundASource);
302  jScrollPane.repaint();
303  jScrollPane.revalidate();
304 
305 
306  }
307 
316  private void addAssociatedArtifactToPanel(BlackboardArtifact artifact) throws TskCoreException {
317 
318  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT.getTypeID() == artifact.getArtifactTypeID()) {
319  BlackboardAttribute associatedArtifactAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
320  if (associatedArtifactAttribute != null) {
321  long artifactId = associatedArtifactAttribute.getValueLong();
322  BlackboardArtifact associatedArtifact = artifact.getSleuthkitCase().getBlackboardArtifact(artifactId);
323 
324  addArtifactToPanels(associatedArtifact);
325  }
326  }
327  }
328 
336  @NbBundle.Messages({
337  "ContextViewer.attachmentSource=Attached to: ",
338  "ContextViewer.downloadSource=Downloaded from: ",
339  "ContextViewer.recentDocs=Recent Documents: ",
340  "ContextViewer.programExecution=Program Execution: "
341  })
342  private void addArtifactToPanels(BlackboardArtifact associatedArtifact) throws TskCoreException {
343  Long dateTime = getArtifactDateTime(associatedArtifact);
344  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID() == associatedArtifact.getArtifactTypeID()
345  || BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID() == associatedArtifact.getArtifactTypeID()) {
346  String sourceName = Bundle.ContextViewer_attachmentSource();
347  String sourceText = msgArtifactToAbbreviatedString(associatedArtifact);
348  ContextSourcePanel sourcePanel = new ContextSourcePanel(sourceName, sourceText, associatedArtifact, dateTime);
349  contextSourcePanels.add(sourcePanel);
350 
351  } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == associatedArtifact.getArtifactTypeID()
352  || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == associatedArtifact.getArtifactTypeID()) {
353  String sourceName = Bundle.ContextViewer_downloadSource();
354  String sourceText = webDownloadArtifactToString(associatedArtifact);
355  ContextSourcePanel sourcePanel = new ContextSourcePanel(sourceName, sourceText, associatedArtifact, dateTime);
356  contextSourcePanels.add(sourcePanel);
357 
358  } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == associatedArtifact.getArtifactTypeID()) {
359  String sourceName = Bundle.ContextViewer_recentDocs();
360  String sourceText = recentDocArtifactToString(associatedArtifact);
361  ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime);
362  contextUsagePanels.add(usagePanel);
363 
364  } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == associatedArtifact.getArtifactTypeID()) {
365  String sourceName = Bundle.ContextViewer_programExecution();
366  String sourceText = programExecArtifactToString(associatedArtifact);
367  ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime);
368  contextUsagePanels.add(usagePanel);
369  }
370 
371  Collections.sort(contextSourcePanels, new SortByDateTime());
372  Collections.sort(contextUsagePanels, new SortByDateTime());
373  }
374 
385  @NbBundle.Messages({
386  "ContextViewer.downloadURL=URL",
387  "ContextViewer.downloadedOn=On"
388  })
389  private String webDownloadArtifactToString(BlackboardArtifact artifact) throws TskCoreException {
390  StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN);
391  Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap = getAttributesMap(artifact);
392 
393  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifact.getArtifactTypeID()
394  || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == artifact.getArtifactTypeID()) {
395  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, attributesMap, Bundle.ContextViewer_downloadURL());
396  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED, attributesMap, Bundle.ContextViewer_downloadedOn());
397  }
398  return sb.toString();
399  }
400 
411  @NbBundle.Messages({
412  "ContextViewer.on=Opened at",
413  "ContextViewer.unknown=Opened at unknown time"
414  })
415  private String recentDocArtifactToString(BlackboardArtifact artifact) throws TskCoreException {
416  StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN);
417  Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap = getAttributesMap(artifact);
418 
419  BlackboardAttribute attribute = attributesMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
420 
421  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == artifact.getArtifactTypeID()) {
422  if (attribute != null && attribute.getValueLong() > 0) {
423  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_on());
424  } else {
425  sb.append(Bundle.ContextViewer_unknown());
426  }
427  }
428  return sb.toString();
429  }
430 
441  @NbBundle.Messages({
442  "ContextViewer.runOn=Program Run On",
443  "ContextViewer.runUnknown= Program Run at unknown time"
444  })
445  private String programExecArtifactToString(BlackboardArtifact artifact) throws TskCoreException {
446  StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN);
447  Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap = getAttributesMap(artifact);
448 
449  BlackboardAttribute attribute = attributesMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
450 
451  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == artifact.getArtifactTypeID()) {
452  if (attribute != null && attribute.getValueLong() > 0) {
453  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_runOn());
454  } else {
455  sb.append(Bundle.ContextViewer_runUnknown());
456  }
457  }
458  return sb.toString();
459  }
460 
470  @NbBundle.Messages({
471  "ContextViewer.message=Message",
472  "ContextViewer.email=Email",
473  "ContextViewer.messageFrom=From",
474  "ContextViewer.messageTo=To",
475  "ContextViewer.messageOn=On",})
476  private String msgArtifactToAbbreviatedString(BlackboardArtifact artifact) throws TskCoreException {
477 
478  StringBuilder sb = new StringBuilder(ARTIFACT_STR_MAX_LEN);
479  Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap = getAttributesMap(artifact);
480 
481  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID() == artifact.getArtifactTypeID()) {
482  sb.append(Bundle.ContextViewer_message()).append(' ');
483  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, attributesMap, Bundle.ContextViewer_messageFrom());
484  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, attributesMap, Bundle.ContextViewer_messageTo());
485  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, attributesMap, Bundle.ContextViewer_messageOn());
486  } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID() == artifact.getArtifactTypeID()) {
487  sb.append(Bundle.ContextViewer_email()).append(' ');
488  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM, attributesMap, Bundle.ContextViewer_messageFrom());
489  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO, attributesMap, Bundle.ContextViewer_messageTo());
490  appendAttributeString(sb, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT, attributesMap, Bundle.ContextViewer_messageOn());
491  }
492  return sb.toString();
493  }
494 
505  private void appendAttributeString(StringBuilder sb, BlackboardAttribute.ATTRIBUTE_TYPE attribType,
506  Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributesMap, String prependStr) {
507 
508  BlackboardAttribute attribute = attributesMap.get(attribType);
509  if (attribute != null) {
510  String attrVal = attribute.getDisplayString();
511  if (!StringUtils.isEmpty(attrVal)) {
512  if (!StringUtils.isEmpty(prependStr)) {
513  sb.append(prependStr).append(' ');
514  }
515  sb.append(StringUtils.abbreviate(attrVal, ATTRIBUTE_STR_MAX_LEN)).append(' ');
516  }
517  }
518  }
519 
530  private Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> getAttributesMap(BlackboardArtifact artifact) throws TskCoreException {
531  Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap = new HashMap<>();
532 
533  List<BlackboardAttribute> attributeList = artifact.getAttributes();
534  for (BlackboardAttribute attribute : attributeList) {
535  BlackboardAttribute.ATTRIBUTE_TYPE type = BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attribute.getAttributeType().getTypeID());
536  attributeMap.put(type, attribute);
537  }
538 
539  return attributeMap;
540  }
541 
542  interface DateTimePanel {
548  Long getDateTime();
549  }
550 
560  private Long getArtifactDateTime(BlackboardArtifact artifact) throws TskCoreException {
561  BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME));
562 
563  if (BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID() == artifact.getArtifactTypeID()) {
564  attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT));
565  } else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == artifact.getArtifactTypeID()
566  || BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() == artifact.getArtifactTypeID()) {
567  attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED));
568  }
569  return (attribute != null ? attribute.getValueLong() : null);
570  }
571 
575  class SortByDateTime implements Comparator<DateTimePanel> {
576 
577  @Override
578  public int compare(DateTimePanel panel1, DateTimePanel panel2) {
579  Long dateTime1 = panel1.getDateTime();
580  Long dateTime2 = panel2.getDateTime();
581 
582  if(dateTime1 == null && dateTime2 == null) {
583  return 0;
584  } else if(dateTime1 == null) {
585  return -1;
586  } else if(dateTime2 == null) {
587  return 1;
588  }
589 
590  return dateTime1.compareTo(dateTime2);
591  }
592 
593  }
594 
595 
596  // Variables declaration - do not modify//GEN-BEGIN:variables
597  private javax.swing.JScrollPane jScrollPane;
598  private javax.swing.JPanel jSourcePanel;
599  private javax.swing.JPanel jUnknownPanel;
600  private javax.swing.JPanel jUsagePanel;
601  // End of variables declaration//GEN-END:variables
602 }
Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > getAttributesMap(BlackboardArtifact artifact)
void appendAttributeString(StringBuilder sb, BlackboardAttribute.ATTRIBUTE_TYPE attribType, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > attributesMap, String prependStr)
void addArtifactToPanels(BlackboardArtifact associatedArtifact)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
String msgArtifactToAbbreviatedString(BlackboardArtifact artifact)

Copyright © 2012-2021 Basis Technology. Generated on: Tue Jan 19 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.