Merge pull request #1820 from BasisOlivers/custom_artifact_addition-1857

Custom artifact addition fixed DirectoryTreeTopComponent.viewArtifact
This commit is contained in:
Richard Cordovano 2016-01-14 13:53:22 -05:00
commit f591eab75a
2 changed files with 21 additions and 9 deletions

View File

@ -845,13 +845,14 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
@Override @Override
public void viewArtifact(final BlackboardArtifact art) { public void viewArtifact(final BlackboardArtifact art) {
BlackboardArtifact.ARTIFACT_TYPE type = BlackboardArtifact.ARTIFACT_TYPE.fromID(art.getArtifactTypeID()); int typeID = art.getArtifactTypeID();
String typeName = art.getArtifactTypeName();
Children rootChilds = em.getRootContext().getChildren(); Children rootChilds = em.getRootContext().getChildren();
Node treeNode = null; Node treeNode = null;
Node resultsNode = rootChilds.findChild(ResultsNode.NAME); Node resultsNode = rootChilds.findChild(ResultsNode.NAME);
Children resultsChilds = resultsNode.getChildren(); Children resultsChilds = resultsNode.getChildren();
if (type.equals(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT)) { if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
Node hashsetRootNode = resultsChilds.findChild(type.getLabel()); Node hashsetRootNode = resultsChilds.findChild(typeName);
Children hashsetRootChilds = hashsetRootNode.getChildren(); Children hashsetRootChilds = hashsetRootNode.getChildren();
try { try {
String setName = null; String setName = null;
@ -866,8 +867,8 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
} catch (TskException ex) { } catch (TskException ex) {
logger.log(Level.WARNING, "Error retrieving attributes", ex); //NON-NLS logger.log(Level.WARNING, "Error retrieving attributes", ex); //NON-NLS
} }
} else if (type.equals(BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT)) { } else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
Node keywordRootNode = resultsChilds.findChild(type.getLabel()); Node keywordRootNode = resultsChilds.findChild(typeName);
Children keywordRootChilds = keywordRootNode.getChildren(); Children keywordRootChilds = keywordRootNode.getChildren();
try { try {
String listName = null; String listName = null;
@ -893,9 +894,9 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
} catch (TskException ex) { } catch (TskException ex) {
logger.log(Level.WARNING, "Error retrieving attributes", ex); //NON-NLS logger.log(Level.WARNING, "Error retrieving attributes", ex); //NON-NLS
} }
} else if (type.equals(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT) } else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
|| type.equals(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT)) { || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
Node interestingItemsRootNode = resultsChilds.findChild(type.getLabel()); Node interestingItemsRootNode = resultsChilds.findChild(typeName);
Children interestingItemsRootChildren = interestingItemsRootNode.getChildren(); Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
try { try {
String setName = null; String setName = null;
@ -916,7 +917,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
if (extractedChilds == null) { if (extractedChilds == null) {
return; return;
} }
treeNode = extractedChilds.findChild(type.getLabel()); treeNode = extractedChilds.findChild(typeName);
} }
if (treeNode == null) { if (treeNode == null) {

View File

@ -7,11 +7,16 @@ package org.sleuthkit.autopsy.modules.UserArtifacts;
import com.sun.media.jfxmedia.logging.Logger; import com.sun.media.jfxmedia.logging.Logger;
import java.util.List; import java.util.List;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.FileManager; import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule; import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule;
import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupModuleFactory;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
@ -55,6 +60,12 @@ public class UserArtifactIngestModule implements DataSourceIngestModule {
art2.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_MIN_COUNT, art2.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_MIN_COUNT,
UserArtifactIngestModuleFactory.getModuleName(), 4)); UserArtifactIngestModuleFactory.getModuleName(), 4));
progressBar.progress(1); progressBar.progress(1);
IngestServices.getInstance().postMessage(IngestMessage.createDataMessage(
"name",
UserArtifactIngestModuleFactory.getModuleName(),
"Test Results",
"Test",
art1));
return ProcessResult.OK; return ProcessResult.OK;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
return ProcessResult.ERROR; return ProcessResult.ERROR;