コード例 #1
0
 def get_object(self, uid, analysis_filter=None):
     fo = FileObject(binary=b'abc',
                     file_name='any_file',
                     file_path='/tmp/any_file',
                     scheduled_analysis=[])
     fo.processed_analysis = {
         'unpacker': {
             'entropy': 0.2
         },
         'file_hashes': {
             'ssdeep': '42'
         }
     }
     return fo
コード例 #2
0
 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
コード例 #3
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
コード例 #4
0
 def get_object(self, uid, analysis_filter=None):
     test_object = FileObject()
     test_object.processed_analysis = {'unpacker': {'entropy': 0.9}}
     return test_object
コード例 #5
0
 def test_is_supported_arch(self):
     fo = FileObject()
     test_data = 'ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=8e756708f62592be105b5e8b423080d38ddc8391, stripped'
     fo.processed_analysis = {'file_type': {'full': test_data}}
     assert self.analysis_plugin._is_supported_arch(fo)