(self)
return meta
Run information gathering.
        @return: information dict.
Run information gathering.
Run information gathering .
def run(self):
        """Run information gathering.
        @return: information dict.
        """
        self.key = "metadata"

        def reformat(x):
            # kinda ugly absolute -> relative
            relpath = x[len(self.analysis_path):].lstrip("/")

            dirname = os.path.dirname(relpath)
            basename = os.path.basename(relpath)
            return dict(dirname=dirname or "",
                        basename=basename,
                        sha256=File(x).get_sha256())

        meta = {
            "output": {},
        }

        if os.path.exists(self.pcap_path):
            meta["output"]["pcap"] = reformat(self.pcap_path)

        infos = [
            (self.pmemory_path, "memdumps"),
            (self.buffer_path, "buffers"),
            (self.dropped_path, "dropped"),
        ]

        for path, key in infos:
            if os.path.exists(path):
                contents = os.listdir(path)
                if contents:
                    meta["output"][key] = [reformat(os.path.join(path, i)) for i in contents]

        return meta
def run ( self ) : self . key = "metadata" def reformat ( x ) : # kinda ugly absolute -> relative relpath = x [ len ( self . analysis_path ) : ] . lstrip ( "/" ) dirname = os . path . dirname ( relpath ) basename = os . path . basename ( relpath ) return dict ( dirname = dirname or "" , basename = basename , sha256 = File ( x ) . get_sha256 ( ) ) meta = { "output" : { } , } if os . path . exists ( self . pcap_path ) : meta [ "output" ] [ "pcap" ] = reformat ( self . pcap_path ) infos = [ ( self . pmemory_path , "memdumps" ) , ( self . buffer_path , "buffers" ) , ( self . dropped_path , "dropped" ) , ] for path , key in infos : if os . path . exists ( path ) : contents = os . listdir ( path ) if contents : meta [ "output" ] [ key ] = [ reformat ( os . path . join ( path , i ) ) for i in contents ] return meta