mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Including FilesIdentifierIngestModule.
This commit is contained in:
parent
479f7184ed
commit
75dda5f70b
@ -106,12 +106,15 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
|
|||||||
@Override
|
@Override
|
||||||
@Messages({"FilesIdentifierIngestModule.indexError.message=Failed to index interesting file hit artifact for keyword search."})
|
@Messages({"FilesIdentifierIngestModule.indexError.message=Failed to index interesting file hit artifact for keyword search."})
|
||||||
public ProcessResult process(AbstractFile file) {
|
public ProcessResult process(AbstractFile file) {
|
||||||
|
Case currentCase;
|
||||||
try {
|
try {
|
||||||
blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard();
|
currentCase = Case.getCurrentCaseThrows();
|
||||||
} catch (NoCurrentCaseException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
|
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
|
||||||
return ProcessResult.ERROR;
|
return ProcessResult.ERROR;
|
||||||
}
|
}
|
||||||
|
blackboard = currentCase.getServices().getBlackboard();
|
||||||
|
|
||||||
// Skip slack space files.
|
// Skip slack space files.
|
||||||
if (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
if (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
||||||
return ProcessResult.OK;
|
return ProcessResult.OK;
|
||||||
@ -126,7 +129,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
|
|||||||
// Post an interesting files set hit artifact to the
|
// Post an interesting files set hit artifact to the
|
||||||
// blackboard.
|
// blackboard.
|
||||||
String moduleName = InterestingItemsIngestModuleFactory.getModuleName();
|
String moduleName = InterestingItemsIngestModuleFactory.getModuleName();
|
||||||
BlackboardArtifact artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
|
|
||||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||||
|
|
||||||
// Add a set name attribute to the artifact. This adds a
|
// Add a set name attribute to the artifact. This adds a
|
||||||
@ -142,28 +145,33 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
|
|||||||
BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, moduleName, ruleSatisfied);
|
BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, moduleName, ruleSatisfied);
|
||||||
attributes.add(ruleNameAttribute);
|
attributes.add(ruleNameAttribute);
|
||||||
|
|
||||||
artifact.addAttributes(attributes);
|
org.sleuthkit.datamodel.Blackboard tskBlackboard = currentCase.getSleuthkitCase().getBlackboard();
|
||||||
try {
|
// Create artifact if it doesn't already exist.
|
||||||
// index the artifact for keyword search
|
if (!tskBlackboard.artifactExists(file, BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, attributes)) {
|
||||||
blackboard.indexArtifact(artifact);
|
BlackboardArtifact artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
|
||||||
} catch (Blackboard.BlackboardException ex) {
|
artifact.addAttributes(attributes);
|
||||||
logger.log(Level.SEVERE, "Unable to index blackboard artifact " + artifact.getArtifactID(), ex); //NON-NLS
|
|
||||||
MessageNotifyUtil.Notify.error(Bundle.FilesIdentifierIngestModule_indexError_message(), artifact.getDisplayName());
|
try {
|
||||||
|
// index the artifact for keyword search
|
||||||
|
blackboard.indexArtifact(artifact);
|
||||||
|
} catch (Blackboard.BlackboardException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Unable to index blackboard artifact " + artifact.getArtifactID(), ex); //NON-NLS
|
||||||
|
MessageNotifyUtil.Notify.error(Bundle.FilesIdentifierIngestModule_indexError_message(), artifact.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
services.fireModuleDataEvent(new ModuleDataEvent(moduleName, BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, Collections.singletonList(artifact)));
|
||||||
|
|
||||||
|
// make an ingest inbox message
|
||||||
|
StringBuilder detailsSb = new StringBuilder();
|
||||||
|
detailsSb.append("File: " + file.getParentPath() + file.getName() + "<br/>\n");
|
||||||
|
detailsSb.append("Rule Set: " + filesSet.getName());
|
||||||
|
|
||||||
|
services.postMessage(IngestMessage.createDataMessage(InterestingItemsIngestModuleFactory.getModuleName(),
|
||||||
|
"Interesting File Match: " + filesSet.getName() + "(" + file.getName() +")",
|
||||||
|
detailsSb.toString(),
|
||||||
|
file.getName(),
|
||||||
|
artifact));
|
||||||
}
|
}
|
||||||
|
|
||||||
services.fireModuleDataEvent(new ModuleDataEvent(moduleName, BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, Collections.singletonList(artifact)));
|
|
||||||
|
|
||||||
// make an ingest inbox message
|
|
||||||
StringBuilder detailsSb = new StringBuilder();
|
|
||||||
detailsSb.append("File: " + file.getParentPath() + file.getName() + "<br/>\n");
|
|
||||||
detailsSb.append("Rule Set: " + filesSet.getName());
|
|
||||||
|
|
||||||
services.postMessage(IngestMessage.createDataMessage(InterestingItemsIngestModuleFactory.getModuleName(),
|
|
||||||
"Interesting File Match: " + filesSet.getName() + "(" + file.getName() +")",
|
|
||||||
detailsSb.toString(),
|
|
||||||
file.getName(),
|
|
||||||
artifact));
|
|
||||||
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
FilesIdentifierIngestModule.logger.log(Level.SEVERE, "Error posting to the blackboard", ex); //NOI18N NON-NLS
|
FilesIdentifierIngestModule.logger.log(Level.SEVERE, "Error posting to the blackboard", ex); //NOI18N NON-NLS
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user