mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #6979 from gdicristofaro/7589-isPreferredForArtifactCategories
7589 is preferred for artifact categories
This commit is contained in:
commit
b0b059349f
@ -33,7 +33,6 @@ import org.openide.util.lookup.ServiceProvider;
|
|||||||
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.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
|
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
@ -64,6 +63,11 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
private final static String WAIT_TEXT = NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.waitText");
|
private final static String WAIT_TEXT = NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.waitText");
|
||||||
private final static String ERROR_TEXT = NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.errorText");
|
private final static String ERROR_TEXT = NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.errorText");
|
||||||
|
|
||||||
|
// Value to return in isPreferred if this viewer is less preferred.
|
||||||
|
private static final int LESS_PREFERRED = 3;
|
||||||
|
// Value to return in isPreferred if this viewer is more preferred.
|
||||||
|
private static final int MORE_PREFERRED = 6;
|
||||||
|
|
||||||
private Node currentNode; // @@@ Remove this when the redundant setNode() calls problem is fixed.
|
private Node currentNode; // @@@ Remove this when the redundant setNode() calls problem is fixed.
|
||||||
private int currentPage = 1;
|
private int currentPage = 1;
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
@ -347,22 +351,38 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int isPreferred(Node node) {
|
public int isPreferred(Node node) {
|
||||||
|
// get the artifact from the lookup
|
||||||
BlackboardArtifact artifact = node.getLookup().lookup(BlackboardArtifact.class);
|
BlackboardArtifact artifact = node.getLookup().lookup(BlackboardArtifact.class);
|
||||||
// low priority if node doesn't have an artifact (meaning it was found from normal directory
|
if (artifact == null) {
|
||||||
// browsing, or if the artifact is something that means the user really wants to see the original
|
return LESS_PREFERRED;
|
||||||
// file and not more details about the artifact
|
}
|
||||||
if ((artifact == null)
|
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID())
|
// get the type of the artifact
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID())
|
BlackboardArtifact.Type artifactType;
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID())
|
try {
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_OBJECT_DETECTED.getTypeID())
|
artifactType = artifact.getType();
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID())
|
} catch (TskCoreException ex) {
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID())
|
logger.log(Level.SEVERE,
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID())
|
String.format("There was an error getting the artifact type for artifact with id: %d", artifact.getId()),
|
||||||
|| (artifact.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID())) {
|
ex);
|
||||||
return 3;
|
return LESS_PREFERRED;
|
||||||
} else {
|
}
|
||||||
return 6;
|
|
||||||
|
// if web download or web cache, less preferred since the content is important and not the artifact itself.
|
||||||
|
if (artifactType.getTypeID() == BlackboardArtifact.Type.TSK_WEB_DOWNLOAD.getTypeID()
|
||||||
|
|| artifactType.getTypeID() == BlackboardArtifact.Type.TSK_WEB_CACHE.getTypeID()) {
|
||||||
|
|
||||||
|
return LESS_PREFERRED;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (artifactType.getCategory()) {
|
||||||
|
// data artifacts should be more preferred
|
||||||
|
case DATA_ARTIFACT:
|
||||||
|
return MORE_PREFERRED;
|
||||||
|
// everything else is less preferred
|
||||||
|
case ANALYSIS_RESULT:
|
||||||
|
default:
|
||||||
|
return LESS_PREFERRED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user