mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Merge pull request #3739 from dgrove727/3803_EncryptionSuspectedTskComment
TSK_COMMENT added.
This commit is contained in:
commit
cb4745854b
@ -37,6 +37,7 @@ import org.apache.tika.metadata.Metadata;
|
|||||||
import org.apache.tika.parser.AutoDetectParser;
|
import org.apache.tika.parser.AutoDetectParser;
|
||||||
import org.apache.tika.parser.ParseContext;
|
import org.apache.tika.parser.ParseContext;
|
||||||
import org.apache.tika.sax.BodyContentHandler;
|
import org.apache.tika.sax.BodyContentHandler;
|
||||||
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
import org.sleuthkit.autopsy.casemodule.services.Blackboard;
|
import org.sleuthkit.autopsy.casemodule.services.Blackboard;
|
||||||
@ -50,14 +51,13 @@ import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
|||||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||||
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.ReadContentInputStream.ReadContentInputStreamException;
|
import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
import org.xml.sax.ContentHandler;
|
import org.xml.sax.ContentHandler;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File ingest module to detect encryption and password protection.
|
* File ingest module to detect encryption and password protection.
|
||||||
*/
|
*/
|
||||||
@ -110,6 +110,10 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Messages({
|
||||||
|
"EncryptionDetectionFileIngestModule.artifactComment.password=Password protection detected.",
|
||||||
|
"EncryptionDetectionFileIngestModule.artifactComment.suspected=Suspected encryption due to high entropy (%f)."
|
||||||
|
})
|
||||||
@Override
|
@Override
|
||||||
public IngestModule.ProcessResult process(AbstractFile file) {
|
public IngestModule.ProcessResult process(AbstractFile file) {
|
||||||
|
|
||||||
@ -132,11 +136,13 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter
|
|||||||
String mimeType = fileTypeDetector.getMIMEType(file);
|
String mimeType = fileTypeDetector.getMIMEType(file);
|
||||||
if (mimeType.equals("application/octet-stream")) {
|
if (mimeType.equals("application/octet-stream")) {
|
||||||
if (isFileEncryptionSuspected(file)) {
|
if (isFileEncryptionSuspected(file)) {
|
||||||
return flagFile(file, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED);
|
return flagFile(file, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED,
|
||||||
|
String.format(Bundle.EncryptionDetectionFileIngestModule_artifactComment_suspected(), calculatedEntropy));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isFilePasswordProtected(file)) {
|
if (isFilePasswordProtected(file)) {
|
||||||
return flagFile(file, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED);
|
return flagFile(file, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED,
|
||||||
|
Bundle.EncryptionDetectionFileIngestModule_artifactComment_password());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,14 +174,18 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter
|
|||||||
*
|
*
|
||||||
* @param file The file to be processed.
|
* @param file The file to be processed.
|
||||||
* @param artifactType The type of artifact to create.
|
* @param artifactType The type of artifact to create.
|
||||||
|
* @param comment A comment to be attached to the artifact.
|
||||||
*
|
*
|
||||||
* @return 'OK' if the file was processed successfully, or 'ERROR' if there
|
* @return 'OK' if the file was processed successfully, or 'ERROR' if there
|
||||||
* was a problem.
|
* was a problem.
|
||||||
*/
|
*/
|
||||||
private IngestModule.ProcessResult flagFile(AbstractFile file, BlackboardArtifact.ARTIFACT_TYPE artifactType) {
|
private IngestModule.ProcessResult flagFile(AbstractFile file, BlackboardArtifact.ARTIFACT_TYPE artifactType, String comment) {
|
||||||
try {
|
try {
|
||||||
BlackboardArtifact artifact = file.newArtifact(artifactType);
|
BlackboardArtifact artifact = file.newArtifact(artifactType);
|
||||||
|
|
||||||
|
artifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT,
|
||||||
|
EncryptionDetectionModuleFactory.getModuleName(), comment));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/*
|
/*
|
||||||
* Index the artifact for keyword search.
|
* Index the artifact for keyword search.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user