mirror of
https://github.com/elisspace/autopsy.git
synced 2026-08-31 08:32:01 +00:00
Removed duplicate BB Query code snippet
This commit is contained in:
@@ -126,26 +126,11 @@ class SampleJythonFileIngestModule(FileIngestModule):
|
||||
# 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).
|
||||
# We iterate through the artifactList(other modules might have added artifacts for the same file) and get
|
||||
# attributes for that artifact. Again, the attributeList should not be empty since we have added a new
|
||||
# attribute - "Text Files" - (Line 111, 112).
|
||||
# We iterate through the attributeList and log every attribute.
|
||||
# NOTE: Empty list (which may be returned by getArtifacts()/getAttributes()) is not coerced into non-iterable
|
||||
# NoneType. Hence null check is not necessary.
|
||||
artifactList = file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT)
|
||||
for artifact in artifactList:
|
||||
attributeList = artifact.getAttributes();
|
||||
for attrib in attributeList:
|
||||
self.log(Level.INFO, attrib.toString())
|
||||
|
||||
|
||||
# To further the example, this code will read the contents of the file and count the number of bytes
|
||||
inputStream = ReadContentInputStream(file)
|
||||
buffer = jarray.zeros(1024, "b")
|
||||
@@ -162,4 +147,4 @@ class SampleJythonFileIngestModule(FileIngestModule):
|
||||
def shutDown(self):
|
||||
# As a final part of this example, we'll send a message to the ingest inbox with the number of files found (in this thread)
|
||||
message = IngestMessage.createMessage(IngestMessage.MessageType.DATA, SampleJythonFileIngestModuleFactory.moduleName, str(self.filesFound) + " files found")
|
||||
ingestServices = IngestServices.getInstance().postMessage(message)
|
||||
ingestServices = IngestServices.getInstance().postMessage(message)
|
||||
|
||||
Reference in New Issue
Block a user