Import pictures back from Module Output folder

I have created a python plugin that identifies files by mimetype such as sqlite and data streams and carves them for jpgs, bmps, pngs, and gifs. The images are outputted into separate folders named by the fileid of the file they were carved from. For example


Im able to automatically import the carved folder back into autopsy as a new logical device, but I am looking for a way similar to the extract archive module that displays the files under the parent file they were carved from.

1 Like

You will need to add the file as a Derived File. Here is what you need to do.

'# Add derived file
'# Parameters Are:
'# File Name, Local Path, size, ctime, crtime, atime, mtime, isFile,
'# Parent File - Abstract File,
'# rederive Details - maybe blank,
'# Tool Name, Tool Version,
'# Other Details - maybe blank,
'# Encoding Type
derivedFile = skCase.addDerivedFile(fileName, localPath, os.path.getsize(file), +
0, 0, 0, 0, True, parentAbstractFile, “”, plugName, pluginVersion, “”, +


The single quotes are used for editing so you can remove them otherwise it makes the text very large.

Thanks Mark but unfortunately Im just not getting the results back in
My results are stored in ModuleOutput\Carved-Foremost which has the variable name resultsdir and the derived images are stored in folders named as the fileid of the parent file where is was carved from. My code is as follows:

    for i in os.listdir(resultsdir):
        eachresults = os.path.join(resultsdir,i)
        extractedfiles = next(os.walk(eachresults))[2]
        for extractfile in extractedfiles:
            self.log(Level.INFO, " File Name is ==> " + extractfile)
            local_file = os.path.join(eachresults, extractfile)
            self.log(Level.INFO, " Local File Name is ==> " + local_file)
            for abstract in allabstractfiles:
                if abstract.getId() == i:
                    derived_file=skCase.addDerivedFile(extractfile, local_file, os.path.getsize(local_file), + 0, 0, 0, 0, True, abstract_file_info, "", "foremost", "0.53", "", TskData.EncodingType.NONE)
    #Post a message to the ingest messages in box.

message = IngestMessage.createMessage(IngestMessage.MessageType.DATA,
“File Carver Module”, “Found %d files” % fileCount)
return IngestModule.ProcessResult.OK

Any help is appreciated