19 package org.sleuthkit.autopsy.contentviewers;
21 import java.awt.Color;
22 import java.awt.Component;
23 import java.util.Arrays;
24 import java.util.HashSet;
25 import java.util.List;
26 import java.util.Optional;
28 import java.util.logging.Level;
29 import java.util.stream.Collectors;
30 import javax.swing.text.JTextComponent;
31 import org.apache.commons.lang3.StringUtils;
32 import org.jsoup.Jsoup;
33 import org.jsoup.nodes.Document;
34 import org.openide.explorer.ExplorerManager;
35 import org.openide.nodes.AbstractNode;
36 import org.openide.nodes.Children;
37 import org.openide.nodes.Node;
38 import org.openide.nodes.Sheet;
39 import org.openide.util.NbBundle;
40 import org.openide.util.lookup.ServiceProvider;
51 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
52 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT;
53 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE;
55 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT;
56 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME;
57 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_RCVD;
58 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION;
59 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CC;
60 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML;
61 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN;
62 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF;
63 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM;
64 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO;
65 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS;
66 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM;
67 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO;
68 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT;
69 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT;
75 @ServiceProvider(service = DataContentViewer.class, position = 5)
76 @SuppressWarnings(
"PMD.SingularField")
79 private static final long serialVersionUID = 1L;
81 private static final BlackboardAttribute.Type TSK_ASSOCIATED_TYPE =
new BlackboardAttribute.Type(TSK_ASSOCIATED_ARTIFACT);
83 private static final int HDR_TAB_INDEX = 0;
84 private static final int TEXT_TAB_INDEX = 1;
85 private static final int HTML_TAB_INDEX = 2;
86 private static final int RTF_TAB_INDEX = 3;
87 private static final int ATTM_TAB_INDEX = 4;
101 @NbBundle.Messages(
"MessageContentViewer.AtrachmentsPanel.title=Attachments")
104 envelopePanel.setBackground(
new Color(0, 0, 0, 38));
106 attachmentsScrollPane.setViewportView(drp);
107 msgbodyTabbedPane.setEnabledAt(ATTM_TAB_INDEX,
true);
113 textAreas = Arrays.asList(headersTextArea, textbodyTextArea, null, rtfbodyTextPane);
126 drpExplorerManager.addPropertyChangeListener(evt
127 -> viewInNewWindowButton.setEnabled(drpExplorerManager.getSelectedNodes().length == 1));
135 @SuppressWarnings(
"unchecked")
137 private
void initComponents() {
139 envelopePanel =
new javax.swing.JPanel();
140 fromLabel =
new javax.swing.JLabel();
141 datetimeText =
new javax.swing.JLabel();
142 fromText =
new javax.swing.JLabel();
143 toLabel =
new javax.swing.JLabel();
144 toText =
new javax.swing.JLabel();
145 ccLabel =
new javax.swing.JLabel();
146 ccText =
new javax.swing.JLabel();
147 subjectLabel =
new javax.swing.JLabel();
148 subjectText =
new javax.swing.JLabel();
149 directionText =
new javax.swing.JLabel();
150 msgbodyTabbedPane =
new javax.swing.JTabbedPane();
151 headersScrollPane =
new javax.swing.JScrollPane();
152 headersTextArea =
new javax.swing.JTextArea();
153 textbodyScrollPane =
new javax.swing.JScrollPane();
154 textbodyTextArea =
new javax.swing.JTextArea();
155 htmlPane =
new javax.swing.JPanel();
157 rtfbodyScrollPane =
new javax.swing.JScrollPane();
158 rtfbodyTextPane =
new javax.swing.JTextPane();
159 attachmentsPanel =
new javax.swing.JPanel();
160 viewInNewWindowButton =
new javax.swing.JButton();
161 attachmentsScrollPane =
new javax.swing.JScrollPane();
163 envelopePanel.setBackground(
new java.awt.Color(204, 204, 204));
165 org.openide.awt.Mnemonics.setLocalizedText(fromLabel,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.fromLabel.text"));
167 datetimeText.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
168 org.openide.awt.Mnemonics.setLocalizedText(datetimeText,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.datetimeText.text"));
170 org.openide.awt.Mnemonics.setLocalizedText(fromText,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.fromText.text"));
172 org.openide.awt.Mnemonics.setLocalizedText(toLabel,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.toLabel.text"));
174 org.openide.awt.Mnemonics.setLocalizedText(toText,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.toText.text"));
175 toText.setAutoscrolls(
true);
176 toText.setMinimumSize(
new java.awt.Dimension(27, 14));
178 org.openide.awt.Mnemonics.setLocalizedText(ccLabel,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.ccLabel.text"));
180 org.openide.awt.Mnemonics.setLocalizedText(ccText,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.ccText.text"));
181 ccText.setMinimumSize(
new java.awt.Dimension(27, 14));
183 org.openide.awt.Mnemonics.setLocalizedText(subjectLabel,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.subjectLabel.text"));
185 org.openide.awt.Mnemonics.setLocalizedText(subjectText,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.subjectText.text"));
186 subjectText.setMinimumSize(
new java.awt.Dimension(26, 14));
188 directionText.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
189 org.openide.awt.Mnemonics.setLocalizedText(directionText,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.directionText.text"));
191 javax.swing.GroupLayout envelopePanelLayout =
new javax.swing.GroupLayout(envelopePanel);
192 envelopePanel.setLayout(envelopePanelLayout);
193 envelopePanelLayout.setHorizontalGroup(
194 envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
195 .addGroup(envelopePanelLayout.createSequentialGroup()
197 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
198 .addGroup(envelopePanelLayout.createSequentialGroup()
199 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
200 .addComponent(fromLabel)
201 .addComponent(toLabel))
202 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
203 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
204 .addGroup(envelopePanelLayout.createSequentialGroup()
205 .addComponent(toText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
206 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
207 .addComponent(directionText, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
208 .addGroup(envelopePanelLayout.createSequentialGroup()
209 .addComponent(fromText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
210 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
211 .addComponent(datetimeText, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))))
212 .addGroup(envelopePanelLayout.createSequentialGroup()
213 .addComponent(ccLabel)
215 .addComponent(ccText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
216 .addGroup(envelopePanelLayout.createSequentialGroup()
217 .addComponent(subjectLabel)
218 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
219 .addComponent(subjectText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
222 envelopePanelLayout.setVerticalGroup(
223 envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
224 .addGroup(envelopePanelLayout.createSequentialGroup()
226 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
227 .addComponent(fromLabel)
228 .addComponent(datetimeText)
229 .addComponent(fromText))
230 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
231 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
232 .addComponent(toLabel)
233 .addComponent(toText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
234 .addComponent(directionText))
235 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
236 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
237 .addComponent(ccLabel)
238 .addComponent(ccText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
239 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
240 .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
241 .addComponent(subjectLabel)
242 .addComponent(subjectText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
246 headersScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
247 headersScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
249 headersTextArea.setEditable(
false);
250 headersTextArea.setColumns(20);
251 headersTextArea.setLineWrap(
true);
252 headersTextArea.setRows(5);
253 headersTextArea.setWrapStyleWord(
true);
254 headersScrollPane.setViewportView(headersTextArea);
256 msgbodyTabbedPane.addTab(
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.headersScrollPane.TabConstraints.tabTitle"), headersScrollPane);
258 textbodyScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
259 textbodyScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
261 textbodyTextArea.setEditable(
false);
262 textbodyTextArea.setLineWrap(
true);
263 textbodyTextArea.setRows(5);
264 textbodyTextArea.setWrapStyleWord(
true);
265 textbodyScrollPane.setViewportView(textbodyTextArea);
267 msgbodyTabbedPane.addTab(
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.textbodyScrollPane.TabConstraints.tabTitle"), textbodyScrollPane);
269 javax.swing.GroupLayout htmlPaneLayout =
new javax.swing.GroupLayout(htmlPane);
270 htmlPane.setLayout(htmlPaneLayout);
271 htmlPaneLayout.setHorizontalGroup(
272 htmlPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
273 .addComponent(htmlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
275 htmlPaneLayout.setVerticalGroup(
276 htmlPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
277 .addComponent(htmlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
280 msgbodyTabbedPane.addTab(
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.htmlPane.TabConstraints.tabTitle"), htmlPane);
282 rtfbodyScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
284 rtfbodyTextPane.setEditable(
false);
285 rtfbodyScrollPane.setViewportView(rtfbodyTextPane);
287 msgbodyTabbedPane.addTab(
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.rtfbodyScrollPane.TabConstraints.tabTitle"), rtfbodyScrollPane);
289 org.openide.awt.Mnemonics.setLocalizedText(viewInNewWindowButton,
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.viewInNewWindowButton.text"));
290 viewInNewWindowButton.addActionListener(
new java.awt.event.ActionListener() {
291 public void actionPerformed(java.awt.event.ActionEvent evt) {
292 viewInNewWindowButtonActionPerformed(evt);
296 javax.swing.GroupLayout attachmentsPanelLayout =
new javax.swing.GroupLayout(attachmentsPanel);
297 attachmentsPanel.setLayout(attachmentsPanelLayout);
298 attachmentsPanelLayout.setHorizontalGroup(
299 attachmentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
300 .addGroup(attachmentsPanelLayout.createSequentialGroup()
302 .addGroup(attachmentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
303 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, attachmentsPanelLayout.createSequentialGroup()
304 .addComponent(viewInNewWindowButton)
306 .addComponent(attachmentsScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)))
308 attachmentsPanelLayout.setVerticalGroup(
309 attachmentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
310 .addGroup(attachmentsPanelLayout.createSequentialGroup()
312 .addComponent(viewInNewWindowButton)
313 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
314 .addComponent(attachmentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)
318 msgbodyTabbedPane.addTab(
org.openide.util.NbBundle.getMessage(
MessageContentViewer.class,
"MessageContentViewer.attachmentsPanel.TabConstraints.tabTitle"), attachmentsPanel);
320 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
321 this.setLayout(layout);
322 layout.setHorizontalGroup(
323 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
324 .addGroup(layout.createSequentialGroup()
326 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
327 .addComponent(msgbodyTabbedPane)
328 .addComponent(envelopePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
331 layout.setVerticalGroup(
332 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
333 .addGroup(layout.createSequentialGroup()
335 .addComponent(envelopePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
336 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
337 .addComponent(msgbodyTabbedPane)
343 new NewWindowViewAction(
"View in new window", drpExplorerManager.getSelectedNodes()[0]).actionPerformed(evt);
380 artifact = node.getLookup().lookup(BlackboardArtifact.class);
381 if (artifact == null) {
390 if (artifact.getArtifactTypeID() == TSK_KEYWORD_HIT.getTypeID()) {
392 getAssociatedArtifact(artifact).ifPresent(associatedArtifact -> {
393 artifact = associatedArtifact;
395 }
catch (TskCoreException ex) {
396 LOGGER.log(Level.SEVERE,
"error getting associated artifact", ex);
400 if (artifact.getArtifactTypeID() == TSK_MESSAGE.getTypeID()) {
402 }
else if (artifact.getArtifactTypeID() == TSK_EMAIL_MSG.getTypeID()) {
419 private static Optional<BlackboardArtifact>
getAssociatedArtifact(
final BlackboardArtifact artifact)
throws TskCoreException {
420 BlackboardAttribute attribute = artifact.getAttribute(TSK_ASSOCIATED_TYPE);
421 if (attribute != null) {
422 return Optional.of(artifact.getSleuthkitCase().getArtifactByArtifactId(attribute.getValueLong()));
424 return Optional.empty();
428 @NbBundle.Messages(
"MessageContentViewer.title=Message")
430 return Bundle.MessageContentViewer_title();
434 @NbBundle.Messages(
"MessageContentViewer.toolTip=Displays messages.")
436 return Bundle.MessageContentViewer_toolTip();
452 fromText.setText(
"");
453 fromLabel.setEnabled(
false);
455 toLabel.setEnabled(
false);
457 ccLabel.setEnabled(
false);
458 subjectText.setText(
"");
459 subjectLabel.setEnabled(
false);
460 datetimeText.setText(
"");
461 datetimeText.setEnabled(
false);
462 directionText.setText(
"");
463 directionText.setEnabled(
false);
465 headersTextArea.setText(
"");
466 rtfbodyTextPane.setText(
"");
468 textbodyTextArea.setText(
"");
469 msgbodyTabbedPane.setEnabled(
false);
474 BlackboardArtifact nodeArtifact = node.getLookup().lookup(BlackboardArtifact.class);
476 if (nodeArtifact == null) {
480 if (nodeArtifact.getArtifactTypeID() == TSK_KEYWORD_HIT.getTypeID()) {
485 }
catch (TskCoreException ex) {
486 LOGGER.log(Level.SEVERE,
"error getting associated artifact", ex);
489 return isMessageArtifact(nodeArtifact);
502 final int artifactTypeID = nodeArtifact.getArtifactTypeID();
503 return artifactTypeID == TSK_EMAIL_MSG.getTypeID()
504 || artifactTypeID == TSK_MESSAGE.getTypeID();
509 if (isSupported(node)) {
524 private void configureTextArea(BlackboardAttribute.ATTRIBUTE_TYPE type,
int index)
throws TskCoreException {
525 String attributeText = getAttributeValueSafe(artifact, type);
527 if (index == HTML_TAB_INDEX && StringUtils.isNotBlank(attributeText)) {
528 htmlPanel.setHtmlText(attributeText);
530 JTextComponent textComponent = textAreas.get(index);
531 if (textComponent != null) {
532 textComponent.setText(attributeText);
533 textComponent.setCaretPosition(0);
537 final boolean hasText = attributeText.length() > 0;
539 msgbodyTabbedPane.setEnabledAt(index, hasText);
541 msgbodyTabbedPane.setSelectedIndex(index);
546 msgbodyTabbedPane.setEnabled(
true);
547 fromLabel.setEnabled(
true);
548 toLabel.setEnabled(
true);
549 subjectLabel.setEnabled(
true);
550 datetimeText.setEnabled(
true);
555 final Set<AbstractFile> attachments = artifact.getChildren().stream()
556 .filter(AbstractFile.class::isInstance)
557 .map(AbstractFile.class::cast)
558 .collect(Collectors.toSet());
559 final int numberOfAttachments = attachments.size();
561 msgbodyTabbedPane.setEnabledAt(ATTM_TAB_INDEX, numberOfAttachments > 0);
562 msgbodyTabbedPane.setTitleAt(ATTM_TAB_INDEX,
"Attachments (" + numberOfAttachments +
")");
568 return "<html><body>" + htmlText +
"</body></html>";
572 enableCommonFields();
574 directionText.setEnabled(
false);
575 ccLabel.setEnabled(
true);
578 this.fromText.setText(getAttributeValueSafe(artifact, TSK_EMAIL_FROM));
579 this.fromText.setToolTipText(getAttributeValueSafe(artifact, TSK_EMAIL_FROM));
580 this.toText.setText(getAttributeValueSafe(artifact, TSK_EMAIL_TO));
581 this.toText.setToolTipText(getAttributeValueSafe(artifact, TSK_EMAIL_TO));
582 this.directionText.setText(
"");
583 this.ccText.setText(getAttributeValueSafe(artifact, TSK_EMAIL_CC));
584 this.ccText.setToolTipText(getAttributeValueSafe(artifact, TSK_EMAIL_CC));
585 this.subjectText.setText(getAttributeValueSafe(artifact, TSK_SUBJECT));
586 this.datetimeText.setText(getAttributeValueSafe(artifact, TSK_DATETIME_RCVD));
588 configureTextArea(TSK_HEADERS, HDR_TAB_INDEX);
589 configureTextArea(TSK_EMAIL_CONTENT_PLAIN, TEXT_TAB_INDEX);
590 configureTextArea(TSK_EMAIL_CONTENT_HTML, HTML_TAB_INDEX);
591 configureTextArea(TSK_EMAIL_CONTENT_RTF, RTF_TAB_INDEX);
592 configureAttachments();
593 }
catch (TskCoreException ex) {
594 LOGGER.log(Level.WARNING,
"Failed to get attributes for email message.", ex);
599 enableCommonFields();
601 directionText.setEnabled(
true);
602 ccLabel.setEnabled(
false);
605 this.fromText.setText(getAttributeValueSafe(artifact, TSK_PHONE_NUMBER_FROM));
606 this.toText.setText(getAttributeValueSafe(artifact, TSK_PHONE_NUMBER_TO));
607 this.directionText.setText(getAttributeValueSafe(artifact, TSK_DIRECTION));
608 this.ccText.setText(
"");
609 this.subjectText.setText(getAttributeValueSafe(artifact, TSK_SUBJECT));
610 this.datetimeText.setText(getAttributeValueSafe(artifact, TSK_DATETIME));
612 msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX,
false);
613 msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX,
false);
614 msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX,
false);
615 msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX,
false);
616 configureTextArea(TSK_TEXT, TEXT_TAB_INDEX);
617 configureAttachments();
618 }
catch (TskCoreException ex) {
619 LOGGER.log(Level.WARNING,
"Failed to get attributes for message.", ex);
623 private static String
getAttributeValueSafe(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException {
624 return Optional.ofNullable(artifact.getAttribute(
new BlackboardAttribute.Type(type)))
625 .map(BlackboardAttribute::getDisplayString)
638 Document doc = Jsoup.parse(htmlInString);
641 doc.select(
"img[src]").forEach(img -> img.attr(
"src",
""));
651 this.attachments = attachments;
662 setKeys(attachments);
680 Sheet sheet = super.createSheet();
681 Set<String> keepProps =
new HashSet<>(Arrays.asList(
691 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
692 for(Property<?> p : sheetSet.getProperties()) {
693 if(!keepProps.contains(p.getName())){
694 sheetSet.remove(p.getName());
javax.swing.JScrollPane textbodyScrollPane
final Set< AbstractFile > attachments
javax.swing.JPanel attachmentsPanel
static void configureTextPaneAsRtf(JTextPane pane)
final DataResultPanel drp
static String cleanseHTML(String htmlInString)
javax.swing.JScrollPane rtfbodyScrollPane
int isPreferred(Node node)
javax.swing.JLabel toLabel
javax.swing.JLabel ccText
static String getAttributeValueSafe(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type)
boolean isSupported(Node node)
static String wrapInHtmlBody(String htmlText)
javax.swing.JPanel envelopePanel
javax.swing.JLabel fromLabel
void configureTextArea(BlackboardAttribute.ATTRIBUTE_TYPE type, int index)
static boolean isMessageArtifact(BlackboardArtifact nodeArtifact)
ExplorerManager getExplorerManager()
javax.swing.JTabbedPane msgbodyTabbedPane
javax.swing.JScrollPane headersScrollPane
javax.swing.JLabel fromText
void setNode(Node rootNode)
javax.swing.JLabel datetimeText
javax.swing.JLabel ccLabel
javax.swing.JLabel toText
static DataResultPanel createInstanceUninitialized(String title, String description, Node currentRootNode, int childNodeCount, DataContent customContentView)
ExplorerManager drpExplorerManager
static Optional< BlackboardArtifact > getAssociatedArtifact(final BlackboardArtifact artifact)
javax.swing.JTextPane rtfbodyTextPane
org.sleuthkit.autopsy.contentviewers.HtmlPanel htmlPanel
javax.swing.JScrollPane attachmentsScrollPane
javax.swing.JPanel htmlPane
final List< JTextComponent > textAreas
BlackboardArtifact artifact
javax.swing.JLabel subjectLabel
javax.swing.JButton viewInNewWindowButton
Node[] createNodes(AbstractFile t)
javax.swing.JLabel directionText
void enableCommonFields()
synchronized static Logger getLogger(String name)
void viewInNewWindowButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JTextArea textbodyTextArea
void configureAttachments()
javax.swing.JLabel subjectText
DataContentViewer createInstance()
final void resetComponent()
javax.swing.JTextArea headersTextArea