6774 use file for content viewers when artifact type is TSK_WEB_CACHE

This commit is contained in:
William Schaefer 2020-10-26 16:40:51 -04:00
parent aabea84939
commit cda0a04878
2 changed files with 27 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Form version="1.4" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -11,6 +11,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>

View File

@ -5,10 +5,17 @@
*/
package org.sleuthkit.autopsy.discovery.ui;
import java.util.logging.Level;
import org.openide.nodes.Node;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.corecomponents.DataContentPanel;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
import org.sleuthkit.autopsy.datamodel.FileNode;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Details panel for displaying the collection of content viewers.
@ -16,6 +23,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
class ContentViewerDetailsPanel extends AbstractArtifactDetailsPanel {
private static final long serialVersionUID = 1L;
private final static Logger logger = Logger.getLogger(ContentViewerDetailsPanel.class.getName());
private final DataContentPanel contentViewer = DataContentPanel.createInstance();
/**
@ -42,8 +50,23 @@ class ContentViewerDetailsPanel extends AbstractArtifactDetailsPanel {
public void setArtifact(BlackboardArtifact artifact) {
Node node = Node.EMPTY;
if (artifact != null) {
if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID()) {
try {
for (BlackboardAttribute attr : artifact.getAttributes()) {
if (attr.getAttributeType().getTypeID() == TSK_PATH_ID.getTypeID()) {
node = new FileNode(Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(attr.getValueLong()));
break;
}
}
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Unable to retrieve attributes for artifact with ID: " + artifact.getArtifactID(), ex);
}
}
if (node.equals(Node.EMPTY)) {
node = new BlackboardArtifactNode(artifact);
}
}
contentViewer.setNode(node);
}