def createcompatibleplatform(self,description=None,identifiers=None): platform = PlatformSpecification() if description is not None: platform.description= StructuredText(value=description) if not identifiers is None: for identifier in identifiers: platform.identifiers.append(identifier) return platform
def from_obj(hypervisor_host_system_obj): if not hypervisor_host_system_obj: return None hypervisor_host_system_ = System.from_obj(hypervisor_host_system_obj, HypervisorHostSystem()) hypervisor_host_system_.vm_hypervisor = PlatformSpecification.from_obj( hypervisor_host_system_obj.get_VM_Hypervisor() ) return hypervisor_host_system_
def from_dict(hypervisor_host_system_dict): if not hypervisor_host_system_dict: return None hypervisor_host_system_ = System.from_dict(hypervisor_host_system_dict, HypervisorHostSystem()) hypervisor_host_system_.vm_hypervisor = PlatformSpecification.from_dict( hypervisor_host_system_dict.get("vm_hypervisor") ) return hypervisor_host_system_
def from_obj(malware_subject_obj): if not malware_subject_obj: return None malware_subject_ = MalwareSubject(None) malware_subject_.id = malware_subject_obj.get_id() malware_subject_.malware_instance_object_attributes = Object.from_obj(malware_subject_obj.get_Malware_Instance_Object_Attributes()) malware_subject_.minor_variants = MinorVariants.from_obj(malware_subject_obj.get_Minor_Variants()) malware_subject_.configuration_details = MalwareConfigurationDetails.from_obj(malware_subject_obj.get_Configuration_Details()) malware_subject_.development_environment = MalwareDevelopmentEnvironment.from_obj(malware_subject_obj.get_Development_Environment()) malware_subject_.field_data = None #TODO: add support malware_subject_.analyses = Analyses.from_obj(malware_subject_obj.get_Analyses()) malware_subject_.findings_bundles = FindingsBundleList.from_obj(malware_subject_obj.get_Findings_Bundles()) malware_subject_.relationships = MalwareSubjectRelationshipList.from_obj(malware_subject_obj.get_Relationships()) if malware_subject_obj.get_Label(): malware_subject_.label = [VocabString.from_obj(x) for x in malware_subject_obj.get_Label()] if malware_subject_obj.get_Compatible_Platform(): malware_subject_.compatible_platform = [PlatformSpecification.from_obj(x) for x in malware_subject_obj.get_Compatible_Platform()] return malware_subject_
def from_dict(malware_subject_dict): if not malware_subject_dict: return None malware_subject_ = MalwareSubject(None) malware_subject_.id = malware_subject_dict.get('id') malware_subject_.malware_instance_object_attributes = Object.from_dict(malware_subject_dict.get('malware_instance_object_attributes')) malware_subject_.minor_variants = MinorVariants.from_list(malware_subject_dict.get('minor_variants')) malware_subject_.configuration_details = MalwareConfigurationDetails.from_dict(malware_subject_dict.get('configuration_details')) malware_subject_.development_environment = MalwareDevelopmentEnvironment.from_dict(malware_subject_dict.get('development_environment')) malware_subject_.field_data = None #TODO: add support malware_subject_.analyses = Analyses.from_list(malware_subject_dict.get('analyses')) malware_subject_.findings_bundles = FindingsBundleList.from_dict(malware_subject_dict.get('findings_bundles')) malware_subject_.relationships = MalwareSubjectRelationshipList.from_list(malware_subject_dict.get('id')) if malware_subject_dict.get('label'): malware_subject_.label = [VocabString.from_dict(x) for x in malware_subject_dict.get('label')] if malware_subject_dict.get('compatible_platform'): malware_subject_.compatible_platform = [PlatformSpecification.from_dict(x) for x in malware_subject_dict.get('compatible_platform')] return malware_subject_