def _convert_to_file_object(self, entry, analysis_filter=None):
     file_object = FileObject()
     file_object.uid = entry['_id']
     file_object.size = entry['size']
     file_object.set_name(entry['file_name'])
     file_object.virtual_file_path = entry['virtual_file_path']
     file_object.parents = entry['parents']
     file_object.processed_analysis = self.retrieve_analysis(entry['processed_analysis'], analysis_filter=analysis_filter)
     file_object.files_included = set(entry['files_included'])
     file_object.parent_firmware_uids = set(entry["parent_firmware_uids"])
     for attribute in ["comments"]:  # for backwards compatibility
         if attribute in entry:
             setattr(file_object, attribute, entry[attribute])
     return file_object
Exemplo n.º 2
0
    def _convert_to_file_object(self, entry: dict, analysis_filter: List[str] = None) -> FileObject:
        file_object = FileObject()
        file_object.uid = entry['_id']
        file_object.size = entry['size']
        file_object.file_name = entry['file_name']
        file_object.virtual_file_path = entry['virtual_file_path']
        file_object.parents = entry['parents']
        file_object.processed_analysis = self.retrieve_analysis(entry['processed_analysis'], analysis_filter=analysis_filter)
        file_object.files_included = set(entry['files_included'])
        file_object.parent_firmware_uids = set(entry['parent_firmware_uids'])
        file_object.analysis_tags = entry['analysis_tags'] if 'analysis_tags' in entry else dict()

        for attribute in ['comments']:  # for backwards compatibility
            if attribute in entry:
                setattr(file_object, attribute, entry[attribute])
        return file_object