mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-04 00:09:53 +00:00
resolved merge conflicts
This commit is contained in:
@@ -40,6 +40,7 @@ from org.sleuthkit.datamodel import AbstractFile
|
||||
from org.sleuthkit.datamodel import ReadContentInputStream
|
||||
from org.sleuthkit.datamodel import BlackboardArtifact
|
||||
from org.sleuthkit.datamodel import BlackboardAttribute
|
||||
from org.sleuthkit.datamodel import TskData
|
||||
from org.sleuthkit.autopsy.ingest import IngestModule
|
||||
from org.sleuthkit.autopsy.ingest.IngestModule import IngestModuleException
|
||||
from org.sleuthkit.autopsy.ingest import DataSourceIngestModule
|
||||
@@ -90,6 +91,8 @@ class SampleJythonFileIngestModule(FileIngestModule):
|
||||
self._logger.logp(level, self.__class__.__name__, inspect.stack()[1][3], msg)
|
||||
|
||||
# Where any setup and configuration is done
|
||||
# 'context' is an instance of org.sleuthkit.autopsy.ingest.IngestJobContext.
|
||||
# See: http://sleuthkit.org/autopsy/docs/api-docs/3.1/classorg_1_1sleuthkit_1_1autopsy_1_1ingest_1_1_ingest_job_context.html
|
||||
# TODO: Add any setup code that you need here.
|
||||
def startUp(self, context):
|
||||
self.filesFound = 0
|
||||
@@ -99,8 +102,13 @@ class SampleJythonFileIngestModule(FileIngestModule):
|
||||
pass
|
||||
|
||||
# Where the analysis is done. Each file will be passed into here.
|
||||
# The 'file' object being passed in is of type org.sleuthkit.datamodel.AbstractFile.
|
||||
# See: http://www.sleuthkit.org/sleuthkit/docs/jni-docs/classorg_1_1sleuthkit_1_1datamodel_1_1_abstract_file.html
|
||||
# TODO: Add your analysis code in here.
|
||||
def process(self, file):
|
||||
# Skip non-files
|
||||
if ((file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) or (file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS) or (file.isFile() == False)):
|
||||
return IngestModule.ProcessResult.OK
|
||||
|
||||
# For an example, we will flag files with .txt in the name and make a blackboard artifact.
|
||||
if file.getName().find(".txt") != -1:
|
||||
@@ -114,6 +122,14 @@ class SampleJythonFileIngestModule(FileIngestModule):
|
||||
att = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), SampleJythonFileIngestModuleFactory.moduleName, "Text Files")
|
||||
art.addAttribute(att)
|
||||
|
||||
# For the example (this wouldn't be needed normally), we'll query the blackboard for data that was added
|
||||
# by other modules. We then iterate over its attributes. We'll just print them, but you would probably
|
||||
# want to do something with them.
|
||||
artifactList = file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT)
|
||||
for artifact in artifactList:
|
||||
attributeList = artifact.getAttributes();
|
||||
for attrib in attributeList:
|
||||
self.logger.logp(Level.INFO, SampleJythonFileIngestModule.__name__, "process", attrib.toString())
|
||||
|
||||
# For the current file, we get all the artifacts. The artifactList should not be empty since we have added
|
||||
# a new artifact - TSK_INTERESTING_FILE_HIT - (Line 110).
|
||||
|
||||
Reference in New Issue
Block a user