restrict indexed text viewer to credit card accounts

This commit is contained in:
millmanorama 2017-12-08 13:34:20 +01:00
parent 66ab9b79f3
commit 2f7d8614a2

View File

@ -34,6 +34,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Account;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT;
@ -53,6 +54,7 @@ public class ExtractedContentViewer implements DataContentViewer {
private static final long INVALID_DOCUMENT_ID = 0L; private static final long INVALID_DOCUMENT_ID = 0L;
private static final BlackboardAttribute.Type TSK_ASSOCIATED_ARTIFACT_TYPE = new BlackboardAttribute.Type(TSK_ASSOCIATED_ARTIFACT); private static final BlackboardAttribute.Type TSK_ASSOCIATED_ARTIFACT_TYPE = new BlackboardAttribute.Type(TSK_ASSOCIATED_ARTIFACT);
public static final BlackboardAttribute.Type TSK_ACCOUNT_TYPE = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE);
private ExtractedContentPanel panel; private ExtractedContentPanel panel;
private volatile Node currentNode = null; private volatile Node currentNode = null;
@ -173,14 +175,13 @@ public class ExtractedContentViewer implements DataContentViewer {
} }
} }
panel.updateControls(currentSource); panel.updateControls(currentSource);
String contentName = ""; String contentName = "";
if (content != null) { if (content != null) {
contentName = content.getName(); contentName = content.getName();
} }
setPanel(contentName, sources); setPanel(contentName, sources);
} }
static private IndexedText getRawArtifactText(Lookup nodeLookup) throws TskCoreException { static private IndexedText getRawArtifactText(Lookup nodeLookup) throws TskCoreException {
@ -261,7 +262,7 @@ public class ExtractedContentViewer implements DataContentViewer {
@Override @Override
public void resetComponent() { public void resetComponent() {
panel.resetDisplay(); panel.resetDisplay();
currentNode = null; currentNode = null;
currentSource = null; currentSource = null;
@ -274,14 +275,22 @@ public class ExtractedContentViewer implements DataContentViewer {
} }
/* /*
* Is there a credit card artifact in the lookup * Is there a credit card or keyword hit artifact in the lookup
*/ */
Collection<? extends BlackboardArtifact> artifacts = node.getLookup().lookupAll(BlackboardArtifact.class); Collection<? extends BlackboardArtifact> artifacts = node.getLookup().lookupAll(BlackboardArtifact.class);
if (artifacts != null) { if (artifacts != null) {
for (BlackboardArtifact art : artifacts) { for (BlackboardArtifact art : artifacts) {
final int artifactTypeID = art.getArtifactTypeID(); final int artifactTypeID = art.getArtifactTypeID();
if (artifactTypeID == TSK_ACCOUNT.getTypeID() if (artifactTypeID == TSK_ACCOUNT.getTypeID()) {
|| artifactTypeID == TSK_KEYWORD_HIT.getTypeID()) { try {
BlackboardAttribute attribute = art.getAttribute(TSK_ACCOUNT_TYPE);
if (attribute != null && Account.Type.CREDIT_CARD.getTypeName().equals(attribute.getValueString())) {
return true;
}
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting TSK_ACCOUNT_TYPE attribute from artifact " + art.getArtifactID(), ex);
}
} else if (artifactTypeID == TSK_KEYWORD_HIT.getTypeID()) {
return true; return true;
} }
} }