def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(Incident, cls).from_obj(obj, return_obj=return_obj) if isinstance(obj, cls._binding_class): return_obj.time = Time.from_obj(obj.Time) return_obj.victims = _Victims.from_obj(obj.Victim) return_obj.categories = IncidentCategories.from_obj(obj.Categories) return_obj.intended_effects = _IntendedEffects.from_obj(obj.Intended_Effect) return_obj.affected_assets = AffectedAssets.from_obj(obj.Affected_Assets) return_obj.discovery_methods = DiscoveryMethods.from_obj(obj.Discovery_Method) return_obj.coa_taken = _COAsTaken.from_obj(obj.COA_Taken) return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.attributed_threat_actors = AttributedThreatActors.from_obj(obj.Attributed_Threat_Actors) return_obj.related_indicators = RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.related_observables = RelatedObservables.from_obj(obj.Related_Observables) return_obj.leveraged_ttps = LeveragedTTPs.from_obj(obj.Leveraged_TTPs) return_obj.related_incidents = RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.status = VocabString.from_obj(obj.Status) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.history = History.from_obj(obj.History) return_obj.responders = _InformationSources.from_obj(obj.Responder) return_obj.coordinators = _InformationSources.from_obj(obj.Coordinator) return_obj.external_ids = _ExternalIDs.from_obj(obj.External_ID) return_obj.reporter = InformationSource.from_obj(obj.Reporter) return_obj.impact_assessment = ImpactAssessment.from_obj(obj.Impact_Assessment) return_obj.security_compromise = VocabString.from_obj(obj.Security_Compromise) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(CourseOfAction, cls).from_obj(obj, return_obj=return_obj) if isinstance(obj, cls._binding_class): # CourseOfActionType properties return_obj.title = obj.Title return_obj.stage = VocabString.from_obj(obj.Stage) return_obj.type_ = VocabString.from_obj(obj.Type) return_obj.objective = Objective.from_obj(obj.Objective) return_obj.parameter_observables = \ Observables.from_obj(obj.Parameter_Observables) return_obj.impact = Statement.from_obj(obj.Impact) return_obj.cost = Statement.from_obj(obj.Cost) return_obj.efficacy = Statement.from_obj(obj.Efficacy) return_obj.related_coas = \ RelatedCOAs.from_obj(obj.Related_COAs) return_obj.related_packages = \ related.RelatedPackageRefs.from_obj(obj.Related_Packages) return_obj.structured_coa = \ _BaseStructuredCOA.from_obj(obj.Structured_COA) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.idref = obj.idref return_obj.timestamp = obj.timestamp if isinstance(obj, cls._binding_class): # CourseOfActionType properties return_obj.version = obj.version return_obj.title = obj.Title return_obj.stage = VocabString.from_obj(obj.Stage) return_obj.type_ = VocabString.from_obj(obj.Type) return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.objective = Objective.from_obj(obj.Objective) return_obj.parameter_observables = \ Observables.from_obj(obj.Parameter_Observables) return_obj.impact = Statement.from_obj(obj.Impact) return_obj.cost = Statement.from_obj(obj.Cost) return_obj.efficacy = Statement.from_obj(obj.Efficacy) return_obj.information_source = InformationSource.from_obj(obj.Information_Source) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.related_coas = \ RelatedCOAs.from_obj(obj.Related_COAs) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(CourseOfAction, cls).from_obj(obj, return_obj=return_obj) if isinstance(obj, cls._binding_class): # CourseOfActionType properties return_obj.title = obj.Title return_obj.stage = VocabString.from_obj(obj.Stage) return_obj.type_ = VocabString.from_obj(obj.Type) return_obj.objective = Objective.from_obj(obj.Objective) return_obj.parameter_observables = \ Observables.from_obj(obj.Parameter_Observables) return_obj.impact = Statement.from_obj(obj.Impact) return_obj.cost = Statement.from_obj(obj.Cost) return_obj.efficacy = Statement.from_obj(obj.Efficacy) return_obj.related_coas = \ RelatedCOAs.from_obj(obj.Related_COAs) return_obj.related_packages = \ related.RelatedPackageRefs.from_obj(obj.Related_Packages) return_obj.structured_coa = \ _BaseStructuredCOA.from_obj(obj.Structured_COA) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.idref = obj.get_idref() return_obj.timestamp = obj.get_timestamp() if isinstance(obj, cls._binding_class): # CourseOfActionType properties return_obj.version = obj.get_version() or cls._version return_obj.title = obj.get_Title() return_obj.stage = VocabString.from_obj(obj.get_Stage()) return_obj.type_ = VocabString.from_obj(obj.get_Type()) return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description()) return_obj.objective = Objective.from_obj(obj.get_Objective()) return_obj.parameter_observables = \ Observables.from_obj(obj.get_Parameter_Observables()) return_obj.impact = Statement.from_obj(obj.get_Impact()) return_obj.cost = Statement.from_obj(obj.get_Cost()) return_obj.efficacy = Statement.from_obj(obj.get_Efficacy()) return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.related_coas = \ RelatedCOAs.from_obj(obj.get_Related_COAs()) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.get_Related_Packages()) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.type_ = AssetType.from_obj(obj.get_Type()) return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.business_function_or_role = StructuredText.from_obj( obj.get_Business_Function_Or_Role()) return_obj.owernship_class = VocabString.from_obj( obj.get_Ownership_Class()) return_obj.management_class = VocabString.from_obj( obj.get_Management_Class()) return_obj.location_class = VocabString.from_obj( obj.get_Location_Class()) #return_obj.location = None if obj.get_Nature_Of_Security_Effect(): n = obj.get_Nature_Of_Security_Effect() return_obj.nature_of_security_effect = [ PropertyAffected.from_obj(x) for x in n.get_Property_Affected() ] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(Incident, cls).from_obj(obj, return_obj=return_obj) if isinstance(obj, cls._binding_class): return_obj.time = Time.from_obj(obj.Time) return_obj.victims = _Victims.from_obj(obj.Victim) return_obj.categories = IncidentCategories.from_obj(obj.Categories) return_obj.intended_effects = _IntendedEffects.from_obj(obj.Intended_Effect) return_obj.affected_assets = AffectedAssets.from_obj(obj.Affected_Assets) return_obj.discovery_methods = DiscoveryMethods.from_obj(obj.Discovery_Method) return_obj.coa_taken = _COAsTaken.from_obj(obj.COA_Taken) return_obj.coa_requested = _COAsRequested.from_obj(obj.COA_Requested) return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.attributed_threat_actors = AttributedThreatActors.from_obj(obj.Attributed_Threat_Actors) return_obj.related_indicators = RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.related_observables = RelatedObservables.from_obj(obj.Related_Observables) return_obj.leveraged_ttps = LeveragedTTPs.from_obj(obj.Leveraged_TTPs) return_obj.related_incidents = RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.status = VocabString.from_obj(obj.Status) return_obj.history = History.from_obj(obj.History) return_obj.responders = _InformationSources.from_obj(obj.Responder) return_obj.coordinators = _InformationSources.from_obj(obj.Coordinator) return_obj.external_ids = _ExternalIDs.from_obj(obj.External_ID) return_obj.reporter = InformationSource.from_obj(obj.Reporter) return_obj.impact_assessment = ImpactAssessment.from_obj(obj.Impact_Assessment) return_obj.security_compromise = VocabString.from_obj(obj.Security_Compromise) return_obj.related_packages = RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.idref = obj.idref return_obj.timestamp = obj.timestamp if isinstance(obj, cls._binding_class): # CourseOfActionType properties return_obj.version = obj.version return_obj.title = obj.Title return_obj.stage = VocabString.from_obj(obj.Stage) return_obj.type_ = VocabString.from_obj(obj.Type) return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.objective = Objective.from_obj(obj.Objective) return_obj.parameter_observables = \ Observables.from_obj(obj.Parameter_Observables) return_obj.impact = Statement.from_obj(obj.Impact) return_obj.cost = Statement.from_obj(obj.Cost) return_obj.efficacy = Statement.from_obj(obj.Efficacy) return_obj.information_source = InformationSource.from_obj(obj.Information_Source) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.related_coas = \ RelatedCOAs.from_obj(obj.Related_COAs) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.idref = obj.get_idref() return_obj.timestamp = obj.get_timestamp() if isinstance(obj, cls._binding_class): # CourseOfActionType properties return_obj.version = obj.get_version() or cls._version return_obj.title = obj.get_Title() return_obj.stage = VocabString.from_obj(obj.get_Stage()) return_obj.type_ = VocabString.from_obj(obj.get_Type()) return_obj.description = StructuredText.from_obj( obj.get_Description()) return_obj.short_description = StructuredText.from_obj( obj.get_Short_Description()) return_obj.objective = Objective.from_obj(obj.get_Objective()) return_obj.parameter_observables = \ Observables.from_obj(obj.get_Parameter_Observables()) return_obj.impact = Statement.from_obj(obj.get_Impact()) return_obj.cost = Statement.from_obj(obj.get_Cost()) return_obj.efficacy = Statement.from_obj(obj.get_Efficacy()) return_obj.information_source = InformationSource.from_obj( obj.get_Information_Source()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.related_coas = \ RelatedCOAs.from_obj(obj.get_Related_COAs()) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.get_Related_Packages()) return return_obj
def from_obj(cls, obj, return_obj=None): from stix.extensions.malware import maec_4_1_malware # register the extension if not obj: return None if not return_obj: try: klass = MalwareInstance.lookup_class(obj.xml_type) return_obj = klass.from_obj(obj) except AttributeError: return_obj = MalwareInstance.from_obj(obj, cls()) else: return_obj.id_ = obj.get_id() return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj( obj.get_Description()) return_obj.short_description = StructuredText.from_obj( obj.get_Short_Description()) return_obj.names = [ VocabString.from_obj(x) for x in obj.get_Name() ] return_obj.types = [ VocabString.from_obj(x) for x in obj.get_Type() ] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.asset_losses = VocabString.from_obj(obj.Asset_Losses) return_obj.business_mission_disruption = VocabString.from_obj(obj.Business_Mission_Disruption) return_obj.response_and_recovery_costs = VocabString.from_obj(obj.Response_And_Recovery_Costs) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.asset_losses = VocabString.from_obj(obj.Asset_Losses) return_obj.business_mission_disruption = VocabString.from_obj(obj.Business_Mission_Disruption) return_obj.response_and_recovery_costs = VocabString.from_obj(obj.Response_And_Recovery_Costs) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.loss_of_competitive_advantage = VocabString.from_obj(obj.get_Loss_Of_Competitive_Advantage()) return_obj.brand_and_market_damage = VocabString.from_obj(obj.get_Brand_And_Market_Damage()) return_obj.increased_operating_costs = VocabString.from_obj(obj.get_Increased_Operating_Costs()) return_obj.legal_and_regulatory_costs = VocabString.from_obj(obj.get_Legal_And_Regulatory_Costs()) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.property_ = VocabString.from_obj(obj.Property) return_obj.description_of_effect = StructuredText.from_obj(obj.Description_Of_Effect) return_obj.type_of_availability_loss = VocabString.from_obj(obj.Type_Of_Availability_Loss) return_obj.duration_of_availability_loss = VocabString.from_obj(obj.Duration_Of_Availability_Loss) return_obj.non_public_data_compromised = NonPublicDataCompromised.from_obj(obj.Non_Public_Data_Compromised) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.loss_of_competitive_advantage = VocabString.from_obj(obj.Loss_Of_Competitive_Advantage) return_obj.brand_and_market_damage = VocabString.from_obj(obj.Brand_And_Market_Damage) return_obj.increased_operating_costs = VocabString.from_obj(obj.Increased_Operating_Costs) return_obj.legal_and_regulatory_costs = VocabString.from_obj(obj.Legal_And_Regulatory_Costs) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.property_ = VocabString.from_obj(obj.Property) return_obj.description_of_effect = StructuredText.from_obj(obj.Description_Of_Effect) return_obj.type_of_availability_loss = VocabString.from_obj(obj.Type_Of_Availability_Loss) return_obj.duration_of_availability_loss = VocabString.from_obj(obj.Duration_Of_Availability_Loss) return_obj.non_public_data_compromised = NonPublicDataCompromised.from_obj(obj.Non_Public_Data_Compromised) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.identity = Identity.from_obj(obj.get_Identity()) return_obj.targeted_technical_details = Observables.from_obj(obj.get_Targeted_Technical_Details()) if obj.get_Targeted_Systems(): return_obj.targeted_systems = [VocabString.from_obj(x) for x in obj.get_Targeted_Systems()] if obj.get_Targeted_Information(): return_obj.targeted_information = [VocabString.from_obj(x) for x in obj.get_Targeted_Information()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.identity = Identity.from_obj(obj.Identity) return_obj.targeted_technical_details = Observables.from_obj(obj.Targeted_Technical_Details) if obj.Targeted_Systems: return_obj.targeted_systems = [VocabString.from_obj(x) for x in obj.Targeted_Systems] if obj.Targeted_Information: return_obj.targeted_information = [VocabString.from_obj(x) for x in obj.Targeted_Information] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(Campaign, cls).from_obj(obj, return_obj=return_obj) if isinstance(obj, cls._binding_class): return_obj.names = Names.from_obj(obj.Names) return_obj.intended_effects = \ _IntendedEffects.from_obj(obj.Intended_Effect) return_obj.status = VocabString.from_obj(obj.Status) return_obj.related_ttps = RelatedTTPs.from_obj(obj.Related_TTPs) return_obj.related_incidents = \ RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.related_indicators = \ RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.attribution = _AttributionList.from_obj(obj.Attribution) return_obj.associated_campaigns = \ AssociatedCampaigns.from_obj(obj.Associated_Campaigns) return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.activity = _Activities.from_obj(obj.Activity) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(Campaign, cls).from_obj(obj, return_obj=return_obj) if isinstance(obj, cls._binding_class): return_obj.names = Names.from_obj(obj.Names) return_obj.intended_effects = \ _IntendedEffects.from_obj(obj.Intended_Effect) return_obj.status = VocabString.from_obj(obj.Status) return_obj.related_ttps = RelatedTTPs.from_obj(obj.Related_TTPs) return_obj.related_incidents = \ RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.related_indicators = \ RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.attribution = _AttributionList.from_obj(obj.Attribution) return_obj.associated_campaigns = \ AssociatedCampaigns.from_obj(obj.Associated_Campaigns) return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.activity = _Activities.from_obj(obj.Activity) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.type_ = AssetType.from_obj(obj.get_Type()) return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.business_function_or_role = StructuredText.from_obj(obj.get_Business_Function_Or_Role()) return_obj.owernship_class = VocabString.from_obj(obj.get_Ownership_Class()) return_obj.management_class = VocabString.from_obj(obj.get_Management_Class()) return_obj.location_class = VocabString.from_obj(obj.get_Location_Class()) #return_obj.location = None if obj.get_Nature_Of_Security_Effect(): n = obj.get_Nature_Of_Security_Effect() return_obj.nature_of_security_effect = [PropertyAffected.from_obj(x) for x in n.get_Property_Affected()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.type_ = AssetType.from_obj(obj.Type) return_obj.description = StructuredText.from_obj(obj.Description) return_obj.business_function_or_role = StructuredText.from_obj(obj.Business_Function_Or_Role) return_obj.ownership_class = VocabString.from_obj(obj.Ownership_Class) return_obj.management_class = VocabString.from_obj(obj.Management_Class) return_obj.location_class = VocabString.from_obj(obj.Location_Class) #return_obj.location = None if obj.Nature_Of_Security_Effect: n = obj.Nature_Of_Security_Effect return_obj.nature_of_security_effect = [PropertyAffected.from_obj(x) for x in n.Property_Affected] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: try: klass = MalwareInstance.lookup_class(obj.xml_type) return_obj = klass.from_obj(obj) except AttributeError: return_obj = MalwareInstance.from_obj(obj, cls()) else: return_obj.id_ = obj.get_id() return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description()) return_obj.names = [VocabString.from_obj(x) for x in obj.get_Name()] return_obj.types = [VocabString.from_obj(x) for x in obj.get_Type()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.type_ = AssetType.from_obj(obj.Type) return_obj.descriptions = StructuredTextList.from_obj(obj.Description) return_obj.business_functions_or_roles = StructuredTextList.from_obj(obj.Business_Function_Or_Role) return_obj.ownership_class = VocabString.from_obj(obj.Ownership_Class) return_obj.management_class = VocabString.from_obj(obj.Management_Class) return_obj.location_class = VocabString.from_obj(obj.Location_Class) # return_obj.location = None if obj.Nature_Of_Security_Effect: n = obj.Nature_Of_Security_Effect return_obj.nature_of_security_effect = [PropertyAffected.from_obj(x) for x in n.Property_Affected] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.idref = obj.idref return_obj.timestamp = obj.timestamp if isinstance(obj, cls._binding_class): return_obj.version = obj.version return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.time = Time.from_obj(obj.Time) if obj.Victim: return_obj.victims = [Identity.from_obj(x) for x in obj.Victim] if obj.Categories: return_obj.categories = [IncidentCategory.from_obj(x) for x in obj.Categories.Category] if obj.Intended_Effect: return_obj.intended_effects = [Statement.from_obj(x) for x in obj.Intended_Effect] if obj.Affected_Assets: return_obj.affected_assets = [AffectedAsset.from_obj(x) for x in obj.Affected_Assets.Affected_Asset] if obj.Discovery_Method: return_obj.discovery_methods = [DiscoveryMethod.from_obj(x) for x in obj.Discovery_Method] if obj.Reporter: return_obj.reporter = InformationSource.from_obj(obj.Reporter) if obj.Responder: return_obj.responders = [InformationSource.from_obj(x) for x in obj.Responder] if obj.Coordinator: return_obj.coordinators = [InformationSource.from_obj(x) for x in obj.Coordinator] if obj.External_ID: return_obj.external_ids = [ExternalID.from_obj(x) for x in obj.External_ID] if obj.Impact_Assessment: return_obj.impact_assessment = ImpactAssessment.from_obj(obj.Impact_Assessment) if obj.Information_Source: return_obj.information_source = InformationSource.from_obj(obj.Information_Source) if obj.Security_Compromise: return_obj.security_compromise = SecurityCompromise.from_obj(obj.Security_Compromise) return_obj.coa_taken = [COATaken.from_obj(x) for x in obj.COA_Taken] return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.attributed_threat_actors = AttributedThreatActors.from_obj(obj.Attributed_Threat_Actors) return_obj.related_indicators = RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.related_observables = RelatedObservables.from_obj(obj.Related_Observables) return_obj.leveraged_ttps = LeveragedTTPs.from_obj(obj.Leveraged_TTPs) return_obj.related_incidents = RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.status = VocabString.from_obj(obj.Status) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.history = History.from_obj(obj.History) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.idref = obj.idref return_obj.timestamp = obj.timestamp if isinstance(obj, cls._binding_class): return_obj.version = obj.version return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.time = Time.from_obj(obj.Time) if obj.Victim: return_obj.victims = [Identity.from_obj(x) for x in obj.Victim] if obj.Categories: return_obj.categories = [IncidentCategory.from_obj(x) for x in obj.Categories.Category] if obj.Intended_Effect: return_obj.intended_effects = [Statement.from_obj(x) for x in obj.Intended_Effect] if obj.Affected_Assets: return_obj.affected_assets = [AffectedAsset.from_obj(x) for x in obj.Affected_Assets.Affected_Asset] if obj.Discovery_Method: return_obj.discovery_methods = [DiscoveryMethod.from_obj(x) for x in obj.Discovery_Method] if obj.Reporter: return_obj.reporter = InformationSource.from_obj(obj.Reporter) if obj.Responder: return_obj.responders = [InformationSource.from_obj(x) for x in obj.Responder] if obj.Coordinator: return_obj.coordinators = [InformationSource.from_obj(x) for x in obj.Coordinator] if obj.External_ID: return_obj.external_ids = [ExternalID.from_obj(x) for x in obj.External_ID] if obj.Impact_Assessment: return_obj.impact_assessment = ImpactAssessment.from_obj(obj.Impact_Assessment) if obj.Information_Source: return_obj.information_source = InformationSource.from_obj(obj.Information_Source) if obj.Security_Compromise: return_obj.security_compromise = SecurityCompromise.from_obj(obj.Security_Compromise) return_obj.coa_taken = [COATaken.from_obj(x) for x in obj.COA_Taken] return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.attributed_threat_actors = AttributedThreatActors.from_obj(obj.Attributed_Threat_Actors) return_obj.related_indicators = RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.related_observables = RelatedObservables.from_obj(obj.Related_Observables) return_obj.leveraged_ttps = LeveragedTTPs.from_obj(obj.Leveraged_TTPs) return_obj.related_incidents = RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.status = VocabString.from_obj(obj.Status) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.history = History.from_obj(obj.History) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.idref = obj.get_idref() return_obj.timestamp = obj.get_timestamp() if isinstance(obj, cls._binding_class): return_obj.version = obj.get_version() or cls._version return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description()) return_obj.time = Time.from_obj(obj.get_Time()) if obj.get_Victim(): return_obj.victims = [Identity.from_obj(x) for x in obj.get_Victim()] if obj.get_Categories(): return_obj.categories = [IncidentCategory.from_obj(x) for x in obj.get_Categories().get_Category()] if obj.get_Intended_Effect(): return_obj.intended_effects = [Statement.from_obj(x) for x in obj.get_Intended_Effect()] if obj.get_Affected_Assets(): return_obj.affected_assets = [AffectedAsset.from_obj(x) for x in obj.get_Affected_Assets().get_Affected_Asset()] if obj.get_Discovery_Method(): return_obj.discovery_methods = [DiscoveryMethod.from_obj(x) for x in obj.get_Discovery_Method()] if obj.get_Reporter(): return_obj.reporter = InformationSource.from_obj(obj.get_Reporter()) if obj.get_Responder(): return_obj.responders = [InformationSource.from_obj(x) for x in obj.get_Responder()] if obj.get_Coordinator(): return_obj.coordinators = [InformationSource.from_obj(x) for x in obj.get_Coordinator()] if obj.get_External_ID(): return_obj.external_ids = [ExternalID.from_obj(x) for x in obj.get_External_ID()] if obj.get_Impact_Assessment(): return_obj.impact_assessment = ImpactAssessment.from_obj(obj.get_Impact_Assessment()) if obj.get_Information_Source(): return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source()) if obj.get_Security_Compromise(): return_obj.security_compromise = SecurityCompromise.from_obj(obj.get_Security_Compromise()) return_obj.coa_taken = [COATaken.from_obj(x) for x in obj.get_COA_Taken()] return_obj.confidence = Confidence.from_obj(obj.get_Confidence()) return_obj.attributed_threat_actors = AttributedThreatActors.from_obj(obj.get_Attributed_Threat_Actors()) return_obj.related_indicators = RelatedIndicators.from_obj(obj.get_Related_Indicators()) return_obj.related_observables = RelatedObservables.from_obj(obj.get_Related_Observables()) return_obj.leveraged_ttps = LeveragedTTPs.from_obj(obj.get_Leveraged_TTPs()) return_obj.related_incidents = RelatedIncidents.from_obj(obj.get_Related_Incidents()) return_obj.status = VocabString.from_obj(obj.get_Status()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.history = History.from_obj(obj.get_History()) return return_obj
def from_obj(cls, obj, return_obj=None): from stix.extensions.malware import maec_4_1_malware # register the extension if not obj: return None if not return_obj: try: klass = MalwareInstance.lookup_class(obj.xml_type) return_obj = klass.from_obj(obj) except AttributeError: return_obj = MalwareInstance.from_obj(obj, cls()) else: return_obj.id_ = obj.id return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.names = [VocabString.from_obj(x) for x in obj.Name] return_obj.types = [VocabString.from_obj(x) for x in obj.Type] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.direct_impact_summary = DirectImpactSummary.from_obj(obj.Direct_Impact_Summary) return_obj.indirect_impact_summary = IndirectImpactSummary.from_obj(obj.Indirect_Impact_Summary) return_obj.total_loss_estimation = TotalLossEstimation.from_obj(obj.Total_Loss_Estimation) return_obj.impact_qualification = VocabString.from_obj(obj.Impact_Qualification) return_obj.effects = Effects.from_obj(obj.Effects) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() super(GenericTestMechanism, cls).from_obj(obj, return_obj) return_obj.reference_location = obj.reference_location return_obj.description = StructuredText.from_obj(obj.Description) return_obj.type_ = VocabString.from_obj(obj.Type) return_obj.specification = EncodedCDATA.from_obj(obj.Specification) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.direct_impact_summary = DirectImpactSummary.from_obj(obj.get_Direct_Impact_Summary()) return_obj.indirect_impact_summary = IndirectImpactSummary.from_obj(obj.get_Indirect_Impact_Summary()) return_obj.total_loss_estimation = TotalLossEstimation.from_obj(obj.get_Total_Loss_Estimation()) return_obj.impact_qualification = ImpactQualification.from_obj(obj.get_Impact_Qualification()) if obj.get_Effects(): return_obj.effects = [VocabString.from_obj(x) for x in obj.get_Effects().get_Effect()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.observable_characterization = Observables.from_obj(obj.Observable_Characterization) if obj.Type: return_obj.types = [VocabString.from_obj(x) for x in obj.Type] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.observable_characterization = Observables.from_obj(obj.Observable_Characterization) if obj.Type: return_obj.types = [VocabString.from_obj(x) for x in obj.Type] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description()) return_obj.observable_characterization = Observables.from_obj(obj.get_Observable_Characterization()) if obj.get_Type(): return_obj.types = [VocabString.from_obj(x) for x in obj.get_Type()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.direct_impact_summary = DirectImpactSummary.from_obj( obj.Direct_Impact_Summary) return_obj.indirect_impact_summary = IndirectImpactSummary.from_obj( obj.Indirect_Impact_Summary) return_obj.total_loss_estimation = TotalLossEstimation.from_obj( obj.Total_Loss_Estimation) return_obj.impact_qualification = VocabString.from_obj( obj.Impact_Qualification) return_obj.effects = Effects.from_obj(obj.Effects) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.information_source = InformationSource.from_obj(obj.Information_Source) if obj.Package_Intent: return_obj.package_intents = [VocabString.from_obj(x) for x in obj.Package_Intent] if obj.Profiles: return_obj.profiles = obj.Profiles.Profile return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source()) if obj.get_Package_Intent(): return_obj.package_intents = [VocabString.from_obj(x) for x in obj.get_Package_Intent()] if obj.get_Profiles(): return_obj.profiles = obj.get_Profiles().get_Profile() return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.idref = obj.get_idref() return_obj.timestamp = obj.get_timestamp() if isinstance(obj, cls._binding_class): return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description()) return_obj.producer = InformationSource.from_obj(obj.get_Producer()) return_obj.confidence = Confidence.from_obj(obj.get_Confidence()) return_obj.sightings = Sightings.from_obj(obj.get_Sightings()) return_obj.composite_indicator_expression = CompositeIndicatorExpression.from_obj(obj.get_Composite_Indicator_Expression()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.kill_chain_phases = KillChainPhasesReference.from_obj(obj.get_Kill_Chain_Phases()) return_obj.related_indicators = RelatedIndicators.from_obj(obj.get_Related_Indicators()) return_obj.likely_impact = Statement.from_obj(obj.get_Likely_Impact()) if obj.get_version(): return_obj.version = obj.get_version() if obj.get_Type(): for indicator_type in obj.get_Type(): return_obj.add_indicator_type(VocabString.from_obj(indicator_type)) if obj.get_Observable(): observable_obj = obj.get_Observable() observable = Observable.from_obj(observable_obj) return_obj.observables.append(observable) if obj.get_Indicated_TTP(): return_obj.indicated_ttps = [RelatedTTP.from_obj(x) for x in obj.get_Indicated_TTP()] if obj.get_Test_Mechanisms(): return_obj.test_mechanisms = [_BaseTestMechanism.from_obj(x) for x in obj.get_Test_Mechanisms().get_Test_Mechanism()] if obj.get_Suggested_COAs(): return_obj.suggested_coas = SuggestedCOAs.from_obj(obj.get_Suggested_COAs()) if obj.get_Alternative_ID(): return_obj.alternative_id = obj.get_Alternative_ID() if obj.get_Valid_Time_Position(): return_obj.valid_time_positions = [ValidTime.from_obj(x) for x in obj.get_Valid_Time_Position()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj(obj.Short_Description) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.information_source = InformationSource.from_obj(obj.Information_Source) if obj.Package_Intent: return_obj.package_intents = [VocabString.from_obj(x) for x in obj.Package_Intent] if obj.Profiles: return_obj.profiles = obj.Profiles.Profile return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = StructuredText.from_obj( obj.get_Short_Description()) return_obj.observable_characterization = Observables.from_obj( obj.get_Observable_Characterization()) if obj.get_Type(): return_obj.types = [ VocabString.from_obj(x) for x in obj.get_Type() ] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.identity = Identity.from_obj(obj.get_Identity()) return_obj.contributing_sources = ContributingSources.from_obj(obj.get_Contributing_Sources()) if obj.get_References(): return_obj.references = obj.get_References().get_Reference() if obj.get_Time(): return_obj.time = cybox.common.Time.from_obj(obj.get_Time()) if obj.get_Tools(): return_obj.tools = cybox.common.ToolInformationList.from_obj(obj.get_Tools()) if obj.get_Role(): return_obj.roles = [VocabString.from_obj(x) for x in obj.get_Role()] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.description = StructuredText.from_obj(obj.Description) return_obj.identity = Identity.from_obj(obj.Identity) return_obj.contributing_sources = ContributingSources.from_obj(obj.Contributing_Sources) if obj.References: return_obj.references = obj.References.Reference if obj.Time: return_obj.time = cybox.common.Time.from_obj(obj.Time) if obj.Tools: return_obj.tools = cybox.common.ToolInformationList.from_obj(obj.Tools) if obj.Role: return_obj.roles = [VocabString.from_obj(x) for x in obj.Role] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.description = StructuredText.from_obj(obj.Description) return_obj.identity = Identity.from_obj(obj.Identity) return_obj.contributing_sources = ContributingSources.from_obj(obj.Contributing_Sources) if obj.References: return_obj.references = obj.References.Reference if obj.Time: return_obj.time = cybox.common.Time.from_obj(obj.Time) if obj.Tools: return_obj.tools = cybox.common.ToolInformationList.from_obj(obj.Tools) if obj.Role: return_obj.roles = [VocabString.from_obj(x) for x in obj.Role] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.idref = obj.get_idref() return_obj.timestamp = obj.get_timestamp() if isinstance(obj, cls._binding_class): return_obj.version = obj.get_version() or cls._version return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj( obj.get_Description()) return_obj.short_description = \ StructuredText.from_obj(obj.get_Short_Description()) return_obj.names = Names.from_obj(obj.get_Names()) return_obj.intended_effects = \ [Statement.from_obj(x) for x in obj.get_Intended_Effect()] return_obj.status = VocabString.from_obj(obj.get_Status()) return_obj.related_ttps = RelatedTTPs.from_obj( obj.get_Related_TTPs()) return_obj.related_incidents = \ RelatedIncidents.from_obj(obj.get_Related_Incidents()) return_obj.related_indicators = \ RelatedIndicators.from_obj(obj.get_Related_Indicators()) return_obj.attribution = \ [Attribution.from_obj(x) for x in obj.get_Attribution()] return_obj.associated_campaigns = \ AssociatedCampaigns.from_obj(obj.get_Associated_Campaigns()) return_obj.confidence = Confidence.from_obj(obj.get_Confidence()) return_obj.activity = \ [Activity.from_obj(x) for x in obj.get_Activity()] return_obj.information_source = \ InformationSource.from_obj(obj.get_Information_Source()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.get_Related_Packages()) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.information_source = InformationSource.from_obj( obj.get_Information_Source()) if obj.get_Package_Intent(): return_obj.package_intents = [ VocabString.from_obj(x) for x in obj.get_Package_Intent() ] if obj.get_Profiles(): return_obj.profiles = obj.get_Profiles().get_Profile() return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.direct_impact_summary = DirectImpactSummary.from_obj( obj.get_Direct_Impact_Summary()) return_obj.indirect_impact_summary = IndirectImpactSummary.from_obj( obj.get_Indirect_Impact_Summary()) return_obj.total_loss_estimation = TotalLossEstimation.from_obj( obj.get_Total_Loss_Estimation()) return_obj.impact_qualification = ImpactQualification.from_obj( obj.get_Impact_Qualification()) if obj.get_Effects(): return_obj.effects = [ VocabString.from_obj(x) for x in obj.get_Effects().get_Effect() ] return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.get_id() return_obj.idref = obj.get_idref() return_obj.timestamp = obj.get_timestamp() if isinstance(obj, cls._binding_class): return_obj.version = obj.get_version() or cls._version return_obj.title = obj.get_Title() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.short_description = \ StructuredText.from_obj(obj.get_Short_Description()) return_obj.names = Names.from_obj(obj.get_Names()) return_obj.intended_effect = \ [Statement.from_obj(x) for x in obj.get_Intended_Effect()] return_obj.status = VocabString.from_obj(obj.get_Status()) return_obj.related_ttps = RelatedTTPs.from_obj(obj.get_Related_TTPs()) return_obj.related_incidents = \ RelatedIncidents.from_obj(obj.get_Related_Incidents()) return_obj.related_indicators = \ RelatedIndicators.from_obj(obj.get_Related_Indicators()) return_obj.attribution = \ [Attribution.from_obj(x) for x in obj.get_Attribution()] return_obj.associated_campaigns = \ AssociatedCampaigns.from_obj(obj.get_Associated_Campaigns()) return_obj.confidence = Confidence.from_obj(obj.get_Confidence()) return_obj.activity = \ [Activity.from_obj(x) for x in obj.get_Activity()] return_obj.information_source = \ InformationSource.from_obj(obj.get_Information_Source()) return_obj.handling = Marking.from_obj(obj.get_Handling()) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.get_Related_Packages()) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.idref = obj.idref return_obj.timestamp = obj.timestamp if isinstance(obj, cls._binding_class): return_obj.version = obj.version return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = \ StructuredText.from_obj(obj.Short_Description) return_obj.names = Names.from_obj(obj.Names) return_obj.intended_effects = \ [Statement.from_obj(x) for x in obj.Intended_Effect] return_obj.status = VocabString.from_obj(obj.Status) return_obj.related_ttps = RelatedTTPs.from_obj(obj.Related_TTPs) return_obj.related_incidents = \ RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.related_indicators = \ RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.attribution = \ [Attribution.from_obj(x) for x in obj.Attribution] return_obj.associated_campaigns = \ AssociatedCampaigns.from_obj(obj.Associated_Campaigns) return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.activity = \ [Activity.from_obj(x) for x in obj.Activity] return_obj.information_source = \ InformationSource.from_obj(obj.Information_Source) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.id_ = obj.id return_obj.idref = obj.idref return_obj.timestamp = obj.timestamp if isinstance(obj, cls._binding_class): return_obj.version = obj.version return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = \ StructuredText.from_obj(obj.Short_Description) return_obj.names = Names.from_obj(obj.Names) return_obj.intended_effects = \ [Statement.from_obj(x) for x in obj.Intended_Effect] return_obj.status = VocabString.from_obj(obj.Status) return_obj.related_ttps = RelatedTTPs.from_obj(obj.Related_TTPs) return_obj.related_incidents = \ RelatedIncidents.from_obj(obj.Related_Incidents) return_obj.related_indicators = \ RelatedIndicators.from_obj(obj.Related_Indicators) return_obj.attribution = \ [Attribution.from_obj(x) for x in obj.Attribution] return_obj.associated_campaigns = \ AssociatedCampaigns.from_obj(obj.Associated_Campaigns) return_obj.confidence = Confidence.from_obj(obj.Confidence) return_obj.activity = \ [Activity.from_obj(x) for x in obj.Activity] return_obj.information_source = \ InformationSource.from_obj(obj.Information_Source) return_obj.handling = Marking.from_obj(obj.Handling) return_obj.related_packages = \ RelatedPackageRefs.from_obj(obj.Related_Packages) return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.description = StructuredText.from_obj(obj.get_Description()) return_obj.identity = Identity.from_obj(obj.get_Identity()) return_obj.contributing_sources = ContributingSources.from_obj( obj.get_Contributing_Sources()) if obj.get_References(): return_obj.references = obj.get_References().get_Reference() if obj.get_Time(): return_obj.time = cybox.common.Time.from_obj(obj.get_Time()) if obj.get_Tools(): return_obj.tools = cybox.common.ToolInformationList.from_obj( obj.get_Tools()) if obj.get_Role(): return_obj.roles = [ VocabString.from_obj(x) for x in obj.get_Role() ] return return_obj