mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
cleanup MessageContentViewer, reset when an unsupported node is selected.
This commit is contained in:
parent
79b08e8afa
commit
7a48fe6605
@ -17,24 +17,17 @@ Metadata.toolTip=Displays metadata about the file.
|
|||||||
Metadata.nodeText.nonFilePassedIn=Non-file passed in
|
Metadata.nodeText.nonFilePassedIn=Non-file passed in
|
||||||
Metadata.nodeText.text=From The Sleuth Kit istat Tool\:
|
Metadata.nodeText.text=From The Sleuth Kit istat Tool\:
|
||||||
Metadata.nodeText.exceptionNotice.text=Error getting file metadata\:
|
Metadata.nodeText.exceptionNotice.text=Error getting file metadata\:
|
||||||
MessageContentViewer.title=Message
|
|
||||||
MessageContentViewer.toolTip=Displays messages.
|
|
||||||
MessageContentViewer.jPanel2.TabConstraints.tabTitle=tab1
|
|
||||||
MessageContentViewer.jPanel3.TabConstraints.tabTitle=tab2
|
|
||||||
MessageContentViewer.jPanel4.TabConstraints.tabTitle=tab3
|
|
||||||
MessageContentViewer.rtfbodyScrollPane.TabConstraints.tabTitle=RTF
|
MessageContentViewer.rtfbodyScrollPane.TabConstraints.tabTitle=RTF
|
||||||
MessageContentViewer.headersScrollPane.TabConstraints.tabTitle=Headers
|
MessageContentViewer.headersScrollPane.TabConstraints.tabTitle=Headers
|
||||||
MessageContentViewer.textbodyScrollPane.TabConstraints.tabTitle=Text
|
MessageContentViewer.textbodyScrollPane.TabConstraints.tabTitle=Text
|
||||||
|
MessageContentViewer.htmlPane.TabConstraints.tabTitle=HTML
|
||||||
MessageContentViewer.fromText.text=from address goes here
|
MessageContentViewer.fromText.text=from address goes here
|
||||||
MessageContentViewer.fromLabel.text=From:
|
MessageContentViewer.fromLabel.text=From:
|
||||||
MessageContentViewer.datetimeText.text=Right Anchored
|
MessageContentViewer.datetimeText.text=date goes here
|
||||||
MessageContentViewer.toText.text=to list goes here
|
MessageContentViewer.toText.text=to list goes here
|
||||||
MessageContentViewer.toLabel.text=To:
|
MessageContentViewer.toLabel.text=To:
|
||||||
MessageContentViewer.ccText.text=cc list goes here
|
MessageContentViewer.ccText.text=cc list goes here
|
||||||
MessageContentViewer.subjectLabel.text=Subject:
|
MessageContentViewer.subjectLabel.text=Subject:
|
||||||
MessageContentViewer.subjectText.text=jLabel6
|
MessageContentViewer.subjectText.text=subject goes here
|
||||||
MessageContentViewer.directionText.text=direction
|
MessageContentViewer.directionText.text=direction
|
||||||
MessageContentViewer.ccLabel.text=CC:
|
MessageContentViewer.ccLabel.text=CC:
|
||||||
MessageContentViewer.showImagesToggleButton.text=Show Images
|
|
||||||
MessageContentViewer.showImagesToggleButton.hide.text=Hide Images
|
|
||||||
MessageContentViewer.htmlPane.TabConstraints.tabTitle=HTML
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<Properties>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="null"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
@ -66,12 +61,12 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Component id="toText" max="32767" attributes="0"/>
|
<Component id="toText" max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="directionText" min="-2" pref="66" max="-2" attributes="0"/>
|
<Component id="directionText" min="-2" pref="66" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Component id="fromText" max="32767" attributes="0"/>
|
<Component id="fromText" max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="datetimeText" min="-2" pref="140" max="-2" attributes="0"/>
|
<Component id="datetimeText" min="-2" pref="140" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.sleuthkit.autopsy.contentviewers;
|
package org.sleuthkit.autopsy.contentviewers;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
@ -29,6 +30,20 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_RCVD;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CC;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT;
|
||||||
|
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +67,9 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
*/
|
*/
|
||||||
public MessageContentViewer() {
|
public MessageContentViewer() {
|
||||||
initComponents();
|
initComponents();
|
||||||
customizeComponents();
|
Utilities.configureTextPaneAsHtml(htmlbodyTextPane);
|
||||||
|
Utilities.configureTextPaneAsRtf(rtfbodyTextPane);
|
||||||
|
resetComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,8 +104,6 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
rtfbodyScrollPane = new javax.swing.JScrollPane();
|
rtfbodyScrollPane = new javax.swing.JScrollPane();
|
||||||
rtfbodyTextPane = new javax.swing.JTextPane();
|
rtfbodyTextPane = new javax.swing.JTextPane();
|
||||||
|
|
||||||
setMinimumSize(null);
|
|
||||||
|
|
||||||
envelopePanel.setBackground(new java.awt.Color(204, 204, 204));
|
envelopePanel.setBackground(new java.awt.Color(204, 204, 204));
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(fromLabel, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.fromLabel.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(fromLabel, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.fromLabel.text")); // NOI18N
|
||||||
@ -128,11 +143,11 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
.addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(envelopePanelLayout.createSequentialGroup()
|
.addGroup(envelopePanelLayout.createSequentialGroup()
|
||||||
.addComponent(toText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(toText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(directionText, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(directionText, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(envelopePanelLayout.createSequentialGroup()
|
.addGroup(envelopePanelLayout.createSequentialGroup()
|
||||||
.addComponent(fromText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(fromText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(datetimeText, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
.addComponent(datetimeText, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||||
.addGroup(envelopePanelLayout.createSequentialGroup()
|
.addGroup(envelopePanelLayout.createSequentialGroup()
|
||||||
.addComponent(ccLabel)
|
.addComponent(ccLabel)
|
||||||
@ -240,20 +255,18 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
@NbBundle.Messages({"MessageContentViewer.showImagesToggleButton.hide.text=Hide Images",
|
||||||
|
"MessageContentViewer.showImagesToggleButton.text=Show Images"})
|
||||||
private void showImagesToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showImagesToggleButtonActionPerformed
|
private void showImagesToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showImagesToggleButtonActionPerformed
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BlackboardAttribute attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML));
|
String htmlText = getAttributeValueSafe(artifact, TSK_EMAIL_CONTENT_HTML);
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
if (!htmlText.isEmpty()) {
|
||||||
|
|
||||||
if (showImagesToggleButton.isSelected()) {
|
if (showImagesToggleButton.isSelected()) {
|
||||||
showImagesToggleButton.setText(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.showImagesToggleButton.hide.text"));
|
showImagesToggleButton.setText(Bundle.MessageContentViewer_showImagesToggleButton_hide_text());
|
||||||
|
this.htmlbodyTextPane.setText(wrapInHtmlBody(htmlText));
|
||||||
this.htmlbodyTextPane.setText("<html><body>" + attr.getValueString() + "</body></html>");
|
|
||||||
} else {
|
} else {
|
||||||
showImagesToggleButton.setText(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.showImagesToggleButton.text"));
|
showImagesToggleButton.setText(Bundle.MessageContentViewer_showImagesToggleButton_text());
|
||||||
|
this.htmlbodyTextPane.setText(wrapInHtmlBody(cleanseHTML(htmlText)));
|
||||||
this.htmlbodyTextPane.setText("<html><body>" + cleanseHTML(attr.getValueString()) + "</body></html>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
@ -287,23 +300,17 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
private javax.swing.JLabel toText;
|
private javax.swing.JLabel toText;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
private void customizeComponents() {
|
|
||||||
// do any customizations here
|
|
||||||
Utilities.configureTextPaneAsHtml(htmlbodyTextPane);
|
|
||||||
Utilities.configureTextPaneAsRtf(rtfbodyTextPane);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node node) {
|
public void setNode(Node node) {
|
||||||
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
|
resetComponent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact = node.getLookup().lookup(BlackboardArtifact.class);
|
artifact = node.getLookup().lookup(BlackboardArtifact.class);
|
||||||
|
|
||||||
if (artifact == null) {
|
if (artifact == null) {
|
||||||
|
resetComponent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,18 +318,22 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
displayMsg();
|
displayMsg();
|
||||||
} else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
|
} else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
|
||||||
displayEmailMsg();
|
displayEmailMsg();
|
||||||
|
} else {
|
||||||
|
resetComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@NbBundle.Messages("MessageContentViewer.title=Message")
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return NbBundle.getMessage(this.getClass(), "MessageContentViewer.title");
|
return Bundle.MessageContentViewer_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@NbBundle.Messages("MessageContentViewer.toolTip=Displays messages.")
|
||||||
public String getToolTip() {
|
public String getToolTip() {
|
||||||
return NbBundle.getMessage(this.getClass(), "MessageContentViewer.toolTip");
|
return Bundle.MessageContentViewer_toolTip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -336,8 +347,15 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resetComponent() {
|
final public void resetComponent() {
|
||||||
// reset all fields
|
// reset all fields
|
||||||
|
fromText.setText("");
|
||||||
|
toText.setText("");
|
||||||
|
ccText.setText("");
|
||||||
|
subjectText.setText("");
|
||||||
|
datetimeText.setText("");
|
||||||
|
directionText.setText("");
|
||||||
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -358,163 +376,94 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void displayEmailMsg() {
|
private void displayEmailMsg() {
|
||||||
directionText.setVisible(false);
|
setEnabled(true);
|
||||||
|
directionText.setText("");
|
||||||
showImagesToggleButton.setVisible(false);
|
showImagesToggleButton.setVisible(false);
|
||||||
showImagesToggleButton.setText("Show Images");
|
showImagesToggleButton.setText("Show Images");
|
||||||
showImagesToggleButton.setSelected(false);
|
showImagesToggleButton.setSelected(false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BlackboardAttribute attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM));
|
this.fromText.setText(getAttributeValueSafe(artifact, TSK_EMAIL_FROM));
|
||||||
this.fromText.setText(attr.getValueString());
|
this.toText.setText(getAttributeValueSafe(artifact, TSK_EMAIL_TO));
|
||||||
|
this.ccText.setText(getAttributeValueSafe(artifact, TSK_EMAIL_CC));
|
||||||
|
this.subjectText.setText(getAttributeValueSafe(artifact, TSK_SUBJECT));
|
||||||
|
this.datetimeText.setText(getAttributeValueSafe(artifact, TSK_DATETIME_RCVD));
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO));
|
String headersText = getAttributeValueSafe(artifact, TSK_HEADERS);
|
||||||
if (attr != null) {
|
if (!headersText.isEmpty()) {
|
||||||
this.toText.setText(attr.getValueString());
|
this.headersTextArea.setText(headersText);
|
||||||
}
|
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, true);
|
||||||
|
msgbodyTabbedPane.setSelectedIndex(HDR_TAB_INDEX);
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CC));
|
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
|
||||||
this.ccText.setVisible(true);
|
|
||||||
this.ccText.setText(attr.getValueString());
|
|
||||||
} else {
|
} else {
|
||||||
this.ccText.setVisible(false);
|
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT));
|
String plainText = getAttributeValueSafe(artifact, TSK_EMAIL_CONTENT_PLAIN);
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
if (!plainText.isEmpty()) {
|
||||||
this.subjectText.setVisible(true);
|
this.textbodyTextArea.setText(plainText);
|
||||||
this.subjectText.setText(attr.getValueString());
|
|
||||||
} else {
|
|
||||||
this.subjectText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_RCVD));
|
|
||||||
if (attr != null && !attr.getDisplayString().isEmpty()) {
|
|
||||||
this.datetimeText.setVisible(true);
|
|
||||||
this.datetimeText.setText(attr.getDisplayString());
|
|
||||||
} else {
|
|
||||||
this.datetimeText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int selectedTabIndex = -1;
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN));
|
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
|
||||||
this.textbodyTextArea.setVisible(true);
|
|
||||||
this.textbodyTextArea.setText(attr.getValueString());
|
|
||||||
|
|
||||||
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, true);
|
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, true);
|
||||||
selectedTabIndex = TEXT_TAB_INDEX;
|
msgbodyTabbedPane.setSelectedIndex(TEXT_TAB_INDEX);
|
||||||
} else {
|
} else {
|
||||||
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, false);
|
||||||
}
|
}
|
||||||
|
String htmlText = getAttributeValueSafe(artifact, TSK_EMAIL_CONTENT_HTML);
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML));
|
if (!htmlText.isEmpty()) {
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
|
||||||
|
|
||||||
this.showImagesToggleButton.setVisible(true);
|
this.showImagesToggleButton.setVisible(true);
|
||||||
|
this.htmlbodyTextPane.setText(wrapInHtmlBody(cleanseHTML(htmlText)));
|
||||||
this.htmlbodyTextPane.setVisible(true);
|
|
||||||
this.htmlbodyTextPane.setText("<html><body>" + cleanseHTML(attr.getValueString()) + "</body></html>");
|
|
||||||
//this.htmlbodyTextPane.setText(cleanseHTML(attr.getValueString()));
|
|
||||||
|
|
||||||
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, true);
|
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, true);
|
||||||
selectedTabIndex = HTML_TAB_INDEX;
|
msgbodyTabbedPane.setSelectedIndex(HTML_TAB_INDEX);
|
||||||
} else {
|
} else {
|
||||||
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false);
|
||||||
this.htmlbodyTextPane.setVisible(false);
|
this.htmlbodyTextPane.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF));
|
String rtfText = getAttributeValueSafe(artifact, TSK_EMAIL_CONTENT_RTF);
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
if (!rtfText.isEmpty()) {
|
||||||
|
this.rtfbodyTextPane.setText(rtfText);
|
||||||
this.rtfbodyTextPane.setVisible(true);
|
|
||||||
this.rtfbodyTextPane.setText(attr.getValueString());
|
|
||||||
|
|
||||||
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, true);
|
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, true);
|
||||||
selectedTabIndex = RTF_TAB_INDEX;
|
msgbodyTabbedPane.setSelectedIndex(RTF_TAB_INDEX);
|
||||||
} else {
|
} else {
|
||||||
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS));
|
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
|
||||||
this.headersTextArea.setVisible(true);
|
|
||||||
this.headersTextArea.setText(attr.getValueString());
|
|
||||||
if (selectedTabIndex < 0) {
|
|
||||||
selectedTabIndex = HDR_TAB_INDEX;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
msgbodyTabbedPane.setSelectedIndex(selectedTabIndex);
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.WARNING, "Failed to get attributes for email message.", ex); //NON-NLS
|
LOGGER.log(Level.WARNING, "Failed to get attributes for email message.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMsg() {
|
private static String wrapInHtmlBody(String htmlText) {
|
||||||
|
return "<html><body>" + cleanseHTML(htmlText) + "</body></html>";
|
||||||
|
}
|
||||||
|
|
||||||
this.ccText.setVisible(false);
|
private void displayMsg() {
|
||||||
|
setEnabled(true);
|
||||||
|
this.ccText.setText("");
|
||||||
this.showImagesToggleButton.setVisible(false);
|
this.showImagesToggleButton.setVisible(false);
|
||||||
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false);
|
||||||
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false);
|
||||||
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.fromText.setText(getAttributeValueSafe(artifact, TSK_PHONE_NUMBER_FROM));
|
||||||
|
this.toText.setText(getAttributeValueSafe(artifact, TSK_PHONE_NUMBER_TO));
|
||||||
|
this.directionText.setText(getAttributeValueSafe(artifact, TSK_DIRECTION));
|
||||||
|
this.subjectText.setText(getAttributeValueSafe(artifact, TSK_SUBJECT));
|
||||||
|
this.datetimeText.setText(getAttributeValueSafe(artifact, TSK_DATETIME));
|
||||||
|
this.datetimeText.setText(getAttributeValueSafe(artifact, TSK_DATETIME));
|
||||||
|
|
||||||
BlackboardAttribute attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM));
|
String text = getAttributeValueSafe(artifact, TSK_TEXT);
|
||||||
if (attr != null) {
|
this.textbodyTextArea.setText(text);
|
||||||
this.fromText.setText(attr.getValueString());
|
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, text.isEmpty() == false);
|
||||||
} else {
|
|
||||||
this.fromText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO));
|
|
||||||
if (attr != null) {
|
|
||||||
this.toText.setText(attr.getValueString());
|
|
||||||
} else {
|
|
||||||
this.toText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION));
|
|
||||||
if (attr != null) {
|
|
||||||
this.directionText.setText(attr.getValueString());
|
|
||||||
} else {
|
|
||||||
this.directionText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT));
|
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
|
||||||
this.subjectText.setVisible(true);
|
|
||||||
this.subjectText.setText(attr.getValueString());
|
|
||||||
} else {
|
|
||||||
this.subjectText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME));
|
|
||||||
if (attr != null && !attr.getDisplayString().isEmpty()) {
|
|
||||||
this.datetimeText.setVisible(true);
|
|
||||||
this.datetimeText.setText(attr.getDisplayString());
|
|
||||||
} else {
|
|
||||||
this.datetimeText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT));
|
|
||||||
if (attr != null && !attr.getValueString().isEmpty()) {
|
|
||||||
this.textbodyTextArea.setVisible(true);
|
|
||||||
this.textbodyTextArea.setText(attr.getValueString());
|
|
||||||
|
|
||||||
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, true);
|
|
||||||
} else {
|
|
||||||
msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, false);
|
|
||||||
}
|
|
||||||
msgbodyTabbedPane.setSelectedIndex(TEXT_TAB_INDEX);
|
msgbodyTabbedPane.setSelectedIndex(TEXT_TAB_INDEX);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.WARNING, "Failed to get attributes for message.", ex); //NON-NLS
|
LOGGER.log(Level.WARNING, "Failed to get attributes for message.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getAttributeValueSafe(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException {
|
||||||
|
return Optional.ofNullable(artifact.getAttribute(new BlackboardAttribute.Type(type)))
|
||||||
|
.map(BlackboardAttribute::getDisplayString)
|
||||||
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -524,14 +473,12 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
|
|||||||
*
|
*
|
||||||
* @return The cleansed HTML String
|
* @return The cleansed HTML String
|
||||||
*/
|
*/
|
||||||
private String cleanseHTML(String htmlInString) {
|
static private String cleanseHTML(String htmlInString) {
|
||||||
|
|
||||||
Document doc = Jsoup.parse(htmlInString);
|
Document doc = Jsoup.parse(htmlInString);
|
||||||
|
|
||||||
// fix all img tags
|
//fix all img tags
|
||||||
doc.select("img[src]").forEach((img) -> {
|
doc.select("img[src]").forEach(img -> img.attr("src", ""));
|
||||||
img.attr("src", "");
|
|
||||||
});
|
|
||||||
|
|
||||||
return doc.html();
|
return doc.html();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user