def to_dict(self):    
     if self.precision == 'second':
         return serialize_value(self.value)
    
     d  = {}
     d['value'] = serialize_value(self.value)
     d['precision'] = self.precision
     return d
Exemple #2
0
    def to_dict(self):
        if self.precision == "second":
            return serialize_value(self.value)

        d = {}
        d["value"] = serialize_value(self.value)
        d["precision"] = self.precision
        return d
Exemple #3
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)

        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.handling:
            return_obj.set_Handling(self.handling.to_obj())
        if self.potential_coas:
            return_obj.set_Potential_COAs(self.potential_coas.to_obj())
        if self.related_exploit_targets:
            return_obj.set_Related_Exploit_Targets(
                self.related_exploit_targets.to_obj())
        if self.vulnerabilities:
            return_obj.set_Vulnerability(
                [x.to_obj() for x in self.vulnerabilities])
        if self.weaknesses:
            return_obj.set_Weakness([x.to_obj() for x in self.weaknesses])
        if self.configuration:
            return_obj.set_Configuration(
                [x.to_obj() for x in self.configuration])
        if self.related_packages:
            return_obj.set_Related_Packages(self.related_packages.to_obj())

        return return_obj
    def to_obj(self, return_obj=None, ns_info=None):
        super(DateTimeWithPrecision, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        obj = self._binding_class()
        obj.valueOf_ = serialize_value(self.value)
        obj.precision = self.precision
        return obj
Exemple #5
0
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.version:
            d['version'] = self.version or self._version
        if self.title:
            d['title'] = self.title
        if self.description:
            d['description'] = self.description.to_dict()
        if self.short_description:
            d['short_description'] = self.short_description.to_dict()
        if self.information_source:
            d['information_source'] = self.information_source.to_dict()
        if self.handling:
            d['handling'] = self.handling.to_dict()
        if self.potential_coas:
            d['potential_coas'] = self.potential_coas.to_dict()
        if self.related_exploit_targets:
            d['related_exploit_targets'] = self.related_exploit_targets.to_dict(
            )
        if self.vulnerabilities:
            d['vulnerabilities'] = [x.to_dict() for x in self.vulnerabilities]
        if self.weaknesses:
            d['weaknesses'] = [x.to_dict() for x in self.weaknesses]
        if self.configuration:
            d['configuration'] = [x.to_dict() for x in self.configuration]
        if self.related_packages:
            d['related_packages'] = self.related_packages.to_dict()

        return d
    def to_obj(self, return_obj=None, ns_info=None):
        super(ExploitTarget, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title

        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
        if self.potential_coas:
            return_obj.Potential_COAs = self.potential_coas.to_obj(ns_info=ns_info)
        if self.related_exploit_targets:
            return_obj.Related_Exploit_Targets = self.related_exploit_targets.to_obj(ns_info=ns_info)
        if self.vulnerabilities:
            return_obj.Vulnerability = [x.to_obj(ns_info=ns_info) for x in self.vulnerabilities]
        if self.weaknesses:
            return_obj.Weakness = [x.to_obj(ns_info=ns_info) for x in self.weaknesses]
        if self.configuration:
            return_obj.Configuration = [x.to_obj(ns_info=ns_info) for x in self.configuration]
        if self.related_packages:
            return_obj.Related_Packages = self.related_packages.to_obj(ns_info=ns_info)
            
        return return_obj
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.version:
            d['version'] = self.version
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.stix_header:
            d['stix_header'] = self.stix_header.to_dict()
        if self.campaigns:
            d['campaigns'] = [x.to_dict() for x in self.campaigns]
        if self.courses_of_action:
            d['courses_of_action'] = [x.to_dict() for x in self.courses_of_action]
        if self.exploit_targets:
            d['exploit_targets'] = [x.to_dict() for x in self.exploit_targets]
        if self.indicators:
            d['indicators'] = [x.to_dict() for x in self.indicators]
        if self.observables:
            d['observables'] = self.observables.to_dict()
        if self.incidents:
            d['incidents'] = [x.to_dict() for x in self.incidents]
        if self.threat_actors:
            d['threat_actors'] = [x.to_dict() for x in self.threat_actors]
        if self.ttps:
            d['ttps'] = self.ttps.to_dict()
        if self.related_packages:
            d['related_packages'] = self.related_packages.to_dict()

        return d
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.version:
            d['version'] = self.version or self._version
        if self.title:
            d['title'] = self.title
        if self.description:
            d['description'] = self.description.to_dict()
        if self.short_description:
            d['short_description'] = self.short_description.to_dict()
        if self.behavior:
            d['behavior'] = self.behavior.to_dict()
        if self.related_ttps:
            d['related_ttps'] = self.related_ttps.to_dict()
        if self.information_source:
            d['information_source'] = self.information_source.to_dict()
        if self.intended_effects:
            d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
        if self.resources:
            d['resources'] = self.resources.to_dict()
        if self.victim_targeting:
            d['victim_targeting'] = self.victim_targeting.to_dict()

        return d
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)

        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.handling:
            return_obj.set_Handling(self.handling.to_obj())
        if self.potential_coas:
            return_obj.set_Potential_COAs(self.potential_coas.to_obj())
        if self.related_exploit_targets:
            return_obj.set_Related_Exploit_Targets(self.related_exploit_targets.to_obj())
        if self.vulnerabilities:
            return_obj.set_Vulnerability([x.to_obj() for x in self.vulnerabilities])
        if self.weaknesses:
            return_obj.set_Weakness([x.to_obj() for x in self.weaknesses])
        if self.configuration:
            return_obj.set_Configuration([x.to_obj() for x in self.configuration])
        if self.related_packages:
            return_obj.set_Related_Packages(self.related_packages.to_obj())
            
        return return_obj
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.version:
            d['version'] = self.version
        if self.title:
            d['title'] = self.title
        if self.description:
            d['description'] = self.description.to_dict()
        if self.short_description:
            d['short_description'] = self.short_description.to_dict()
        if self.information_source:
            d['information_source'] = self.information_source.to_dict()
        if self.handling:
            d['handling'] = self.handling.to_dict()
        if self.potential_coas:
            d['potential_coas'] = self.potential_coas.to_dict()
        if self.related_exploit_targets:
            d['related_exploit_targets'] = self.related_exploit_targets.to_dict()
        if self.vulnerabilities:
            d['vulnerabilities'] = [x.to_dict() for x in self.vulnerabilities]
        if self.weaknesses:
            d['weaknesses'] = [x.to_dict() for x in self.weaknesses]
        if self.configuration:
            d['configuration'] = [x.to_dict() for x in self.configuration]
        if self.related_packages:
            d['related_packages'] = self.related_packages.to_dict()

        return d
Exemple #11
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)
        
        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.time:
            return_obj.set_Time(self.time.to_obj())
        if self.victims:
            return_obj.set_Victim([x.to_obj() for x in self.victims])
        if self.attributed_threat_actors:
            return_obj.set_Attributed_Threat_Actors(self.attributed_threat_actors.to_obj())
        if self.related_indicators:
            return_obj.set_Related_Indicators(self.related_indicators.to_obj())
        if self.related_observables:
            return_obj.set_Related_Observables(self.related_observables.to_obj())
        if self.categories:
            return_obj.set_Categories(self._binding.CategoriesType(Category=[x.to_obj() for x in self.categories]))
        if self.intended_effects:
            return_obj.set_Intended_Effect([x.to_obj() for x in self.intended_effects])
        if self.leveraged_ttps:
            return_obj.set_Leveraged_TTPs(self.leveraged_ttps.to_obj())
        if self.affected_assets:
            a = self._binding.AffectedAssetsType(Affected_Asset=[x.to_obj() for x in self.affected_assets])
            return_obj.set_Affected_Assets(a)

        return return_obj
Exemple #12
0
 def to_dict(self):
     d = {}
     if self.id_:
         d['id'] = self.id_
     if self.idref:
         d['idref'] = self.idref
     if self.timestamp:
         d['timestamp'] = dates.serialize_value(self.timestamp)
     if self.version:
         d['version'] = self.version or self._version
     if self.title:
         d['title'] = self.title
     if self.description:
         d['description'] = self.description.to_dict()
     if self.short_description:
         d['short_description'] = self.short_description.to_dict()
     if self.time:
         d['time'] = self.time.to_dict()
     if self.victims:
         d['victims'] = [x.to_dict() for x in self.victims]
     if self.categories:
         d['categories'] = [x.to_dict() for x in self.categories]
     if self.attributed_threat_actors:
         d['attributed_threat_actors'] = self.attributed_threat_actors.to_dict()
     if self.related_indicators:
         d['related_indicators'] = self.related_indicators.to_dict()
     if self.related_observables:
         d['related_observables'] = self.related_observables.to_dict()
     if self.intended_effects:
         d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
     if self.leveraged_ttps:
         d['leveraged_ttps'] = self.leveraged_ttps.to_dict()
     if self.affected_assets:
         d['affected_assets'] = [x.to_dict() for x in self.affected_assets]
     return d
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.version:
            d['version'] = self.version or self._version
        if self.title:
            d['title'] = self.title
        if self.description:
            d['description'] = self.description.to_dict()
        if self.short_description:
            d['short_description'] = self.short_description.to_dict()
        if self.behavior:
            d['behavior'] = self.behavior.to_dict()
        if self.related_ttps:
            d['related_ttps'] = self.related_ttps.to_dict()
        if self.exploit_targets:
            d['exploit_targets'] = self.exploit_targets.to_dict()
        if self.information_source:
            d['information_source'] = self.information_source.to_dict()
        if self.intended_effects:
            d['intended_effects'] = [
                x.to_dict() for x in self.intended_effects
            ]
        if self.resources:
            d['resources'] = self.resources.to_dict()
        if self.victim_targeting:
            d['victim_targeting'] = self.victim_targeting.to_dict()

        return d
    def to_obj(self, return_obj=None, ns_info=None):
        super(TTP, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title

        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(ns_info=ns_info)
        if self.behavior:
            return_obj.Behavior = self.behavior.to_obj(ns_info=ns_info)
        if self.related_ttps:
            return_obj.Related_TTPs = self.related_ttps.to_obj(ns_info=ns_info)
        if self.exploit_targets:
            return_obj.Exploit_Targets = self.exploit_targets.to_obj(ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(ns_info=ns_info)
        if self.intended_effects:
            return_obj.Intended_Effect = [x.to_obj(ns_info=ns_info) for x in self.intended_effects]
        if self.resources:
            return_obj.Resources = self.resources.to_obj(ns_info=ns_info)
        if self.victim_targeting:
            return_obj.Victim_Targeting = self.victim_targeting.to_obj(ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)

        return return_obj
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)

        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.behavior:
            return_obj.set_Behavior(self.behavior.to_obj())
        if self.related_ttps:
            return_obj.set_Related_TTPs(self.related_ttps.to_obj())
        if self.exploit_targets:
            return_obj.set_Exploit_Targets(self.exploit_targets.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.intended_effects:
            return_obj.set_Intended_Effect(
                [x.to_obj() for x in self.intended_effects])
        if self.resources:
            return_obj.set_Resources(self.resources.to_obj())
        if self.victim_targeting:
            return_obj.set_Victim_Targeting(self.victim_targeting.to_obj())

        return return_obj
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.version:
            d['version'] = self.version
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.stix_header:
            d['stix_header'] = self.stix_header.to_dict()
        if self.campaigns:
            d['campaigns'] = [x.to_dict() for x in self.campaigns]
        if self.courses_of_action:
            d['courses_of_action'] = [x.to_dict() for x in self.courses_of_action]
        if self.exploit_targets:
            d['exploit_targets'] = [x.to_dict() for x in self.exploit_targets]
        if self.indicators:
            d['indicators'] = [x.to_dict() for x in self.indicators]
        if self.observables:
            d['observables'] = self.observables.to_dict()
        if self.incidents:
            d['incidents'] = [x.to_dict() for x in self.incidents]
        if self.threat_actors:
            d['threat_actors'] = [x.to_dict() for x in self.threat_actors]
        if self.ttps:
            d['ttps'] = self.ttps.to_dict()
        if self.related_packages:
            d['related_packages'] = self.related_packages.to_dict()

        return d
Exemple #17
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)

        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.behavior:
            return_obj.set_Behavior(self.behavior.to_obj())
        if self.related_ttps:
            return_obj.set_Related_TTPs(self.related_ttps.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.intended_effects:
            return_obj.set_Intended_Effect([x.to_obj() for x in self.intended_effects])
        if self.resources:
            return_obj.set_Resources(self.resources.to_obj())
        if self.victim_targeting:
            return_obj.set_Victim_Targeting(self.victim_targeting.to_obj())

        return return_obj
Exemple #18
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(ThreatActor, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        if self.timestamp:
            return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title
        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(
                ns_info=ns_info)
        if self.identity:
            return_obj.Identity = self.identity.to_obj(ns_info=ns_info)
        if self.types:
            return_obj.Type = [x.to_obj(ns_info=ns_info) for x in self.types]
        if self.motivations:
            return_obj.Motivation = [
                x.to_obj(ns_info=ns_info) for x in self.motivations
            ]
        if self.sophistications:
            return_obj.Sophistication = [
                x.to_obj(ns_info=ns_info) for x in self.sophistications
            ]
        if self.intended_effects:
            return_obj.Intended_Effect = [
                x.to_obj(ns_info=ns_info) for x in self.intended_effects
            ]
        if self.planning_and_operational_supports:
            return_obj.Planning_And_Operational_Support = [
                x.to_obj(ns_info=ns_info)
                for x in self.planning_and_operational_supports
            ]
        if self.observed_ttps:
            return_obj.Observed_TTPs = self.observed_ttps.to_obj(
                ns_info=ns_info)
        if self.associated_campaigns:
            return_obj.Associated_Campaigns = self.associated_campaigns.to_obj(
                ns_info=ns_info)
        if self.associated_actors:
            return_obj.Associated_Actors = self.associated_actors.to_obj(
                ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
        if self.confidence:
            return_obj.Confidence = self.confidence.to_obj(ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(
                ns_info=ns_info)
        if self.related_packages:
            return_obj.Related_Packages = self.related_packages.to_obj(
                ns_info=ns_info)

        return return_obj
Exemple #19
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)
        
        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.time:
            return_obj.set_Time(self.time.to_obj())
        if self.victims:
            return_obj.set_Victim([x.to_obj() for x in self.victims])
        if self.attributed_threat_actors:
            return_obj.set_Attributed_Threat_Actors(self.attributed_threat_actors.to_obj())
        if self.related_indicators:
            return_obj.set_Related_Indicators(self.related_indicators.to_obj())
        if self.related_observables:
            return_obj.set_Related_Observables(self.related_observables.to_obj())
        if self.related_incidents:
            return_obj.set_Related_Incidents(self.related_incidents.to_obj())
        if self.categories:
            return_obj.set_Categories(self._binding.CategoriesType(Category=[x.to_obj() for x in self.categories]))
        if self.intended_effects:
            return_obj.set_Intended_Effect([x.to_obj() for x in self.intended_effects])
        if self.leveraged_ttps:
            return_obj.set_Leveraged_TTPs(self.leveraged_ttps.to_obj())
        if self.affected_assets:
            a = self._binding.AffectedAssetsType(Affected_Asset=[x.to_obj() for x in self.affected_assets])
            return_obj.set_Affected_Assets(a)
        if self.discovery_methods:
            return_obj.set_Discovery_Method([x.to_obj() for x in self.discovery_methods])
        if self.reporter:
            return_obj.set_Reporter(self.reporter.to_obj())
        if self.responders:
            return_obj.set_Responder([x.to_obj() for x in self.responders])
        if self.coordinators:
            return_obj.set_Coordinator([x.to_obj() for x in self.coordinators])
        if self.external_ids:
            return_obj.set_External_ID([x.to_obj() for x in self.external_ids])
        if self.impact_assessment:
            return_obj.set_Impact_Assessment(self.impact_assessment.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.security_compromise:
            return_obj.set_Security_Compromise(self.security_compromise.to_obj())
        if self.confidence:
            return_obj.set_Confidence(self.confidence.to_obj())
        if self.coa_taken:
            return_obj.set_COA_Taken([x.to_obj() for x in self.coa_taken])

        return return_obj
Exemple #20
0
 def to_dict(self):
     d = {}
     if self.id_:
         d['id'] = self.id_
     if self.idref:
         d['idref'] = self.idref
     if self.timestamp:
         d['timestamp'] = dates.serialize_value(self.timestamp)
     if self.version:
         d['version'] = self.version or self._version
     if self.title:
         d['title'] = self.title
     if self.description:
         d['description'] = self.description.to_dict()
     if self.short_description:
         d['short_description'] = self.short_description.to_dict()
     if self.time:
         d['time'] = self.time.to_dict()
     if self.victims:
         d['victims'] = [x.to_dict() for x in self.victims]
     if self.categories:
         d['categories'] = [x.to_dict() for x in self.categories]
     if self.attributed_threat_actors:
         d['attributed_threat_actors'] = self.attributed_threat_actors.to_dict()
     if self.related_indicators:
         d['related_indicators'] = self.related_indicators.to_dict()
     if self.related_observables:
         d['related_observables'] = self.related_observables.to_dict()
     if self.related_incidents:
         d['related_incidents'] = self.related_incidents.to_dict()
     if self.intended_effects:
         d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
     if self.leveraged_ttps:
         d['leveraged_ttps'] = self.leveraged_ttps.to_dict()
     if self.affected_assets:
         d['affected_assets'] = [x.to_dict() for x in self.affected_assets]
     if self.discovery_methods:
         d['discovery_methods'] = [x.to_dict() for x in self.discovery_methods]
     if self.reporter:
         d['reporter'] = self.reporter.to_dict()
     if self.responders:
         d['responders'] = [x.to_dict() for x in self.responders]
     if self.coordinators:
         d['coordinators'] = [x.to_dict() for x in self.coordinators]
     if self.external_ids:
         d['external_ids'] = [x.to_dict() for x in self.external_ids]
     if self.impact_assessment:
         d['impact_assessment'] = self.impact_assessment.to_dict()
     if self.information_source:
         d['information_source'] = self.information_source.to_dict()
     if self.security_compromise:
         d['security_compromise'] = self.security_compromise.to_dict()
     if self.confidence:
         d['confidence'] = self.confidence.to_dict()
     if self.coa_taken:
         d['coa_taken'] = [x.to_dict() for x in self.coa_taken]
     return d
Exemple #21
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_valueOf_(self.value)
        return_obj.set_author(self.author)
        return_obj.set_time(serialize_value(self.time))
        return_obj.set_time_precision(self.time_precision)

        return return_obj
Exemple #22
0
 def to_obj(self, return_obj=None):
     if not return_obj:
         return_obj = self._binding_class()
     
     return_obj.set_valueOf_(self.value)
     return_obj.set_author(self.author)
     return_obj.set_time(serialize_value(self.time))
     return_obj.set_time_precision(self.time_precision)
     
     return return_obj
Exemple #23
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_Title(self.title)
        
        if self.version:
            return_obj.set_version(self._version)
        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.confidence:
            return_obj.set_Confidence(self.confidence.to_obj())
        if self.indicator_types:
            for indicator_type in self.indicator_types:
                tmp_indicator_type = indicator_type.to_obj()
                return_obj.add_Type(tmp_indicator_type)
        if self.indicated_ttps:
            return_obj.set_Indicated_TTP([x.to_obj() for x in self.indicated_ttps])
        if self.observables:
            if len(self.observables) > 1:
                root_observable = self._merge_observables(self.observables)
            else:
                root_observable = self.observables[0]
            return_obj.set_Observable(root_observable.to_obj())
        if self.producer:
            return_obj.set_Producer(self.producer.to_obj())
        if self.test_mechanisms:
            tms_obj = self._binding.TestMechanismsType()
            tms_obj.set_Test_Mechanism([x.to_obj() for x in self.test_mechanisms])
            return_obj.set_Test_Mechanisms(tms_obj)
        if self.likely_impact:
            return_obj.set_Likely_Impact(self.likely_impact.to_obj())
        if self.alternative_id:
            return_obj.set_Alternative_ID(self.alternative_id)
        if self.valid_time_positions:
            return_obj.set_Valid_Time_Position([x.to_obj() for x in self.valid_time_positions])
        if self.suggested_coas:
            return_obj.set_Suggested_COAs(self.suggested_coas.to_obj())
        if self.sightings:
            return_obj.set_Sightings(self.sightings.to_obj())
        if self.composite_indicator_expression:
            return_obj.set_Composite_Indicator_Expression(self.composite_indicator_expression.to_obj())
        if self.handling:
            return_obj.set_Handling(self.handling.to_obj())
        if self.kill_chain_phases:
            return_obj.set_Kill_Chain_Phases(self.kill_chain_phases.to_obj())
        if self.related_indicators:
            return_obj.set_Related_Indicators(self.related_indicators.to_obj())

        return return_obj
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_version(self.version)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))

        if self.stix_header:
            return_obj.set_STIX_Header(self.stix_header.to_obj())

        if self.campaigns:
            coas_obj = self._binding.CampaignsType()
            coas_obj.set_Campaign([x.to_obj() for x in self.campaigns])
            return_obj.set_Campaigns(coas_obj)

        if self.courses_of_action:
            coas_obj = self._binding.CoursesOfActionType()
            coas_obj.set_Course_Of_Action(
                [x.to_obj() for x in self.courses_of_action])
            return_obj.set_Courses_Of_Action(coas_obj)

        if self.exploit_targets:
            et_obj = stix_common_binding.ExploitTargetsType()
            et_obj.set_Exploit_Target(
                [x.to_obj() for x in self.exploit_targets])
            return_obj.set_Exploit_Targets(et_obj)

        if self.indicators:
            indicators_obj = self._binding.IndicatorsType()
            indicators_obj.set_Indicator([x.to_obj() for x in self.indicators])
            return_obj.set_Indicators(indicators_obj)

        if self.observables:
            return_obj.set_Observables(self.observables.to_obj())

        if self.incidents:
            incidents_obj = self._binding.IncidentsType()
            incidents_obj.set_Incident([x.to_obj() for x in self.incidents])
            return_obj.set_Incidents(incidents_obj)
        if self.threat_actors:
            threat_actors_obj = self._binding.ThreatActorsType()
            threat_actors_obj.set_Threat_Actor(
                [x.to_obj() for x in self.threat_actors])
            return_obj.set_Threat_Actors(threat_actors_obj)

        if self.ttps:
            return_obj.set_TTPs(self.ttps.to_obj())

        if self.related_packages:
            return_obj.set_Related_Packages(self.related_packages.to_obj())

        return return_obj
Exemple #25
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(STIXPackage, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.version = self.version
        return_obj.timestamp = dates.serialize_value(self.timestamp)

        if self.stix_header:
            return_obj.STIX_Header = self.stix_header.to_obj(ns_info=ns_info)
        
        if self.campaigns:
            coas_obj = self._binding.CampaignsType()
            coas_obj.Campaign = [x.to_obj(ns_info=ns_info) for x in self.campaigns]
            return_obj.Campaigns = coas_obj
            
        if self.courses_of_action:
            coas_obj = self._binding.CoursesOfActionType()
            coas_obj.Course_Of_Action = [x.to_obj(ns_info=ns_info) for x in self.courses_of_action]
            return_obj.Courses_Of_Action = coas_obj
        
        if self.exploit_targets:
            et_obj = stix_common_binding.ExploitTargetsType()
            et_obj.Exploit_Target = [x.to_obj(ns_info=ns_info) for x in self.exploit_targets]
            return_obj.Exploit_Targets = et_obj
            
        if self.indicators:
            indicators_obj = self._binding.IndicatorsType()
            indicators_obj.Indicator = [x.to_obj(ns_info=ns_info) for x in self.indicators]
            return_obj.Indicators = indicators_obj

        if self.observables:
            return_obj.Observables = self.observables.to_obj(ns_info=ns_info)

        if self.incidents:
            incidents_obj = self._binding.IncidentsType()
            incidents_obj.Incident = [x.to_obj(ns_info=ns_info) for x in self.incidents]
            return_obj.Incidents = incidents_obj
        if self.threat_actors:
            threat_actors_obj = self._binding.ThreatActorsType()
            threat_actors_obj.Threat_Actor = [x.to_obj(ns_info=ns_info) for x in self.threat_actors]
            return_obj.Threat_Actors = threat_actors_obj
        
        if self.ttps:
            return_obj.TTPs = self.ttps.to_obj(ns_info=ns_info)
           
        if self.related_packages:
            return_obj.Related_Packages = self.related_packages.to_obj(ns_info=ns_info)
             
        return return_obj
Exemple #26
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(JournalEntry, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()
        
        return_obj.valueOf_ = self.value
        return_obj.author = self.author
        return_obj.time = serialize_value(self.time)
        return_obj.time_precision = self.time_precision
        
        return return_obj
Exemple #27
0
 def to_dict(self):
     d = {}
     if self.id_:
         d['id'] = self.id_
     if self.idref:
         d['idref'] = self.idref
     if self.timestamp:
         d['timestamp'] = dates.serialize_value(self.timestamp)
     if self.version:
         d['version'] = self.version
     if self.observables:
         if len(self.observables) == 1:
             d['observable'] = self.observables[0].to_dict()
         else:
             composite_observable = self._merge_observables(self.observables)
             d['observable'] = composite_observable.to_dict()
     if self.producer:
         d['producer'] = self.producer.to_dict()
     if self.title:
         d['title'] = self.title
     if self.description:
         d['description'] = self.description.to_dict()
     if self.short_description:
         d['short_description'] = self.short_description.to_dict()
     if self.indicator_types:
         d['indicator_types'] = [x.to_dict() for x in self.indicator_types]
     if self.confidence:
         d['confidence'] = self.confidence.to_dict()
     if self.indicated_ttps:
         d['indicated_ttps'] = [x.to_dict() for x in self.indicated_ttps]
     if self.test_mechanisms:
         d['test_mechanisms'] = [x.to_dict() for x in self.test_mechanisms]
     if self.likely_impact:
         d['likely_impact'] = self.likely_impact.to_dict()
     if self.alternative_id:
         d['alternative_id'] = self.alternative_id
     if self.valid_time_positions:
         d['valid_time_positions'] = [x.to_dict() for x in self.valid_time_positions]
     if self.suggested_coas:
         d['suggested_coas'] = self.suggested_coas.to_dict()
     if self.sightings:
         d['sightings'] = self.sightings.to_dict()
     if self.composite_indicator_expression:
         d['composite_indicator_expression'] = self.composite_indicator_expression.to_dict()
     if self.handling:
         d['handling'] = self.handling.to_dict()
     if self.kill_chain_phases:
         d['kill_chain_phases'] = self.kill_chain_phases.to_dict()
     if self.related_indicators:
         d['related_indicators'] = self.related_indicators.to_dict()
     
     return d
Exemple #28
0
 def to_dict(self):
     d = {}
     
     if self.value:
         d['value'] = self.value
     if self.author:
         d['author'] = self.author
     if self.time:
         d['time'] = serialize_value(self.time)
     if self.time_precision:
         d['time_precision'] = self.time_precision
         
     return d
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_version(self.version)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))

        if self.stix_header:
            return_obj.set_STIX_Header(self.stix_header.to_obj())
        
        if self.campaigns:
            coas_obj = self._binding.CampaignsType()
            coas_obj.set_Campaign([x.to_obj() for x in self.campaigns])
            return_obj.set_Campaigns(coas_obj)
            
        if self.courses_of_action:
            coas_obj = self._binding.CoursesOfActionType()
            coas_obj.set_Course_Of_Action([x.to_obj() for x in self.courses_of_action])
            return_obj.set_Courses_Of_Action(coas_obj)
        
        if self.exploit_targets:
            et_obj = stix_common_binding.ExploitTargetsType()
            et_obj.set_Exploit_Target([x.to_obj() for x in self.exploit_targets])
            return_obj.set_Exploit_Targets(et_obj)
            
        if self.indicators:
            indicators_obj = self._binding.IndicatorsType()
            indicators_obj.set_Indicator([x.to_obj() for x in self.indicators])
            return_obj.set_Indicators(indicators_obj)

        if self.observables:
            return_obj.set_Observables(self.observables.to_obj())

        if self.incidents:
            incidents_obj = self._binding.IncidentsType()
            incidents_obj.set_Incident([x.to_obj() for x in self.incidents])
            return_obj.set_Incidents(incidents_obj)
        if self.threat_actors:
            threat_actors_obj = self._binding.ThreatActorsType()
            threat_actors_obj.set_Threat_Actor([x.to_obj() for x in self.threat_actors])
            return_obj.set_Threat_Actors(threat_actors_obj)
        
        if self.ttps:
            return_obj.set_TTPs(self.ttps.to_obj())
           
        if self.related_packages:
            return_obj.set_Related_Packages(self.related_packages.to_obj())
             
        return return_obj
Exemple #30
0
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.version:
            d['version'] = self.version
        if self.title:
            d['title'] = self.title
        if self.description:
            d['description'] = self.description.to_dict()
        if self.short_description:
            d['short_description'] = self.short_description.to_dict()
        if self.identity:
            d['identity'] = self.identity.to_dict()
        if self.types:
            d['types'] = [x.to_dict() for x in self.types]
        if self.motivations:
            d['motivations'] = [x.to_dict() for x in self.motivations]
        if self.sophistications:
            d['sophistications'] = [x.to_dict() for x in self.sophistications]
        if self.intended_effects:
            d['intended_effects'] = [
                x.to_dict() for x in self.intended_effects
            ]
        if self.planning_and_operational_supports:
            d['planning_and_operational_supports'] = [
                x.to_dict() for x in self.planning_and_operational_supports
            ]
        if self.observed_ttps:
            d['observed_ttps'] = self.observed_ttps.to_dict()
        if self.associated_campaigns:
            d['associated_campaigns'] = self.associated_campaigns.to_dict()
        if self.associated_actors:
            d['associated_actors'] = self.associated_actors.to_dict()
        if self.handling:
            d['handling'] = self.handling.to_dict()
        if self.confidence:
            d['confidence'] = self.confidence.to_dict()
        if self.information_source:
            d['information_source'] = self.information_source.to_dict()
        if self.related_packages:
            d['related_packages'] = self.related_packages.to_dict()

        return d
Exemple #31
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(ExploitTarget, self).to_obj(return_obj=return_obj,
                                          ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title

        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(
                ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(
                ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
        if self.potential_coas:
            return_obj.Potential_COAs = self.potential_coas.to_obj(
                ns_info=ns_info)
        if self.related_exploit_targets:
            return_obj.Related_Exploit_Targets = self.related_exploit_targets.to_obj(
                ns_info=ns_info)
        if self.vulnerabilities:
            return_obj.Vulnerability = [
                x.to_obj(ns_info=ns_info) for x in self.vulnerabilities
            ]
        if self.weaknesses:
            return_obj.Weakness = [
                x.to_obj(ns_info=ns_info) for x in self.weaknesses
            ]
        if self.configuration:
            return_obj.Configuration = [
                x.to_obj(ns_info=ns_info) for x in self.configuration
            ]
        if self.related_packages:
            return_obj.Related_Packages = self.related_packages.to_obj(
                ns_info=ns_info)

        return return_obj
Exemple #32
0
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        if self.timestamp:
            return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)
        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.identity:
            return_obj.set_Identity(self.identity.to_obj())
        if self.types:
            return_obj.set_Type([x.to_obj() for x in self.types])
        if self.motivations:
            return_obj.set_Motivation([x.to_obj() for x in self.motivations])
        if self.sophistications:
            return_obj.set_Sophistication(
                [x.to_obj() for x in self.sophistications])
        if self.intended_effects:
            return_obj.set_Intended_Effect(
                [x.to_obj() for x in self.intended_effects])
        if self.planning_and_operational_supports:
            return_obj.set_Planning_And_Operational_Support(
                [x.to_obj() for x in self.planning_and_operational_supports])
        if self.observed_ttps:
            return_obj.set_Observed_TTPs(self.observed_ttps.to_obj())
        if self.associated_campaigns:
            return_obj.set_Associated_Campaigns(
                self.associated_campaigns.to_obj())
        if self.associated_actors:
            return_obj.set_Associated_Actors(self.associated_actors.to_obj())
        if self.handling:
            return_obj.set_Handling(self.handling.to_obj())
        if self.confidence:
            return_obj.set_Confidence(self.confidence.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.related_packages:
            return_obj.set_Related_Packages(self.related_packages.to_obj())

        return return_obj
    def to_dict(self):
        d = {}
        if self.id_:
            d['id'] = self.id_
        if self.idref:
            d['idref'] = self.idref
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.version:
            d['version'] = self.version
        if self.title:
            d['title'] = self.title
        if self.description:
            d['description'] = self.description.to_dict()
        if self.short_description:
            d['short_description'] = self.short_description.to_dict()
        if self.identity:
            d['identity'] = self.identity.to_dict()
        if self.types:
            d['types'] = [x.to_dict() for x in self.types]
        if self.motivations:
            d['motivations'] = [x.to_dict() for x in self.motivations]
        if self.sophistications:
            d['sophistications'] = [x.to_dict() for x in self.sophistications]
        if self.intended_effects:
            d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
        if self.planning_and_operational_supports:
            d['planning_and_operational_supports'] = [x.to_dict()
                    for x in self.planning_and_operational_supports]
        if self.observed_ttps:
            d['observed_ttps'] = self.observed_ttps.to_dict()
        if self.associated_campaigns:
            d['associated_campaigns'] = self.associated_campaigns.to_dict()
        if self.associated_actors:
            d['associated_actors'] = self.associated_actors.to_dict()
        if self.handling:
            d['handling'] = self.handling.to_dict()
        if self.confidence:
            d['confidence'] = self.confidence.to_dict()
        if self.information_source:
            d['information_source'] = self.information_source.to_dict()
        if self.related_packages:
            d['related_packages'] = self.related_packages.to_dict()

        return d
 def to_dict(self):
     d = {}
     if self.timestamp:
         d['timestamp'] = dates.serialize_value(self.timestamp)
     if self.timestamp_precision:
         d['timestamp_precision'] = str(self.timestamp_precision)
     if self.source:
         d['source'] = self.source.to_dict()
     if self.reference:
         d['reference'] = str(self.reference)
     if self.confidece:
         d['confidence'] = self.confidece.to_dict()
     if self.description:
         d['description'] = self.description.to_dict()
     if self.related_observables:
         d['related_observables'] = self.related_observables.to_dict()
      
     return d
Exemple #35
0
    def to_dict(self):
        d = {}
        if self.timestamp:
            d['timestamp'] = dates.serialize_value(self.timestamp)
        if self.timestamp_precision:
            d['timestamp_precision'] = str(self.timestamp_precision)
        if self.source:
            d['source'] = self.source.to_dict()
        if self.reference:
            d['reference'] = str(self.reference)
        if self.confidence:
            d['confidence'] = self.confidence.to_dict()
        if self.description:
            d['description'] = self.description.to_dict()
        if self.related_observables:
            d['related_observables'] = self.related_observables.to_dict()

        return d
Exemple #36
0
 def to_obj(self, return_obj=None):
     if not return_obj:
         return_obj = self._binding_class()
     
     return_obj.set_timestamp(dates.serialize_value(self.timestamp))
     return_obj.set_timestamp_precision(self.timestamp_precision)
     return_obj.set_Reference(self.reference)
     
     if self.source:
         return_obj.set_Source(self.source.to_obj())
     if self.confidence:
         return_obj.set_Confidence(self.confidece.to_obj())
     if self.description:
         return_obj.set_Description(self.description.to_obj())
     if self.related_observables:
         return_obj.set_Related_Observables(self.related_observables.to_obj())
     
     return return_obj
    def to_obj(self, return_obj=None, ns_info=None):
        super(ThreatActor, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        if self.timestamp:
            return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title
        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(ns_info=ns_info)
        if self.identity:
            return_obj.Identity = self.identity.to_obj(ns_info=ns_info)
        if self.types:
            return_obj.Type = [x.to_obj(ns_info=ns_info) for x in self.types]
        if self.motivations:
            return_obj.Motivation = [x.to_obj(ns_info=ns_info) for x in self.motivations]
        if self.sophistications:
            return_obj.Sophistication = [x.to_obj(ns_info=ns_info) for x in self.sophistications]
        if self.intended_effects:
            return_obj.Intended_Effect = [x.to_obj(ns_info=ns_info) for x in self.intended_effects]
        if self.planning_and_operational_supports:
            return_obj.Planning_And_Operational_Support = [x.to_obj(ns_info=ns_info) for x in self.planning_and_operational_supports]
        if self.observed_ttps:
            return_obj.Observed_TTPs = self.observed_ttps.to_obj(ns_info=ns_info)
        if self.associated_campaigns:
            return_obj.Associated_Campaigns = self.associated_campaigns.to_obj(ns_info=ns_info)
        if self.associated_actors:
            return_obj.Associated_Actors = self.associated_actors.to_obj(ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
        if self.confidence:
            return_obj.Confidence = self.confidence.to_obj(ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(ns_info=ns_info)
        if self.related_packages:
            return_obj.Related_Packages = self.related_packages.to_obj(ns_info=ns_info)

        return return_obj
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        if self.timestamp:
            return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)
        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.identity:
            return_obj.set_Identity(self.identity.to_obj())
        if self.types:
            return_obj.set_Type([x.to_obj() for x in self.types])
        if self.motivations:
            return_obj.set_Motivation([x.to_obj() for x in self.motivations])
        if self.sophistications:
            return_obj.set_Sophistication([x.to_obj() for x in self.sophistications])
        if self.intended_effects:
            return_obj.set_Intended_Effect([x.to_obj() for x in self.intended_effects])
        if self.planning_and_operational_supports:
            return_obj.set_Planning_And_Operational_Support([x.to_obj()
                    for x in self.planning_and_operational_supports])
        if self.observed_ttps:
            return_obj.set_Observed_TTPs(self.observed_ttps.to_obj())
        if self.associated_campaigns:
            return_obj.set_Associated_Campaigns(self.associated_campaigns.to_obj())
        if self.associated_actors:
            return_obj.set_Associated_Actors(self.associated_actors.to_obj())
        if self.handling:
            return_obj.set_Handling(self.handling.to_obj())
        if self.confidence:
            return_obj.set_Confidence(self.confidence.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.related_packages:
            return_obj.set_Related_Packages(self.related_packages.to_obj())

        return return_obj
Exemple #39
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(Sighting, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()
        
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.timestamp_precision = self.timestamp_precision
        return_obj.Reference = self.reference
        
        if self.source:
            return_obj.Source = self.source.to_obj(ns_info=ns_info)
        if self.confidence:
            return_obj.Confidence = self.confidence.to_obj(ns_info=ns_info)
        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.related_observables:
            return_obj.Related_Observables = self.related_observables.to_obj(ns_info=ns_info)
        
        return return_obj
Exemple #40
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(TTP, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title

        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(
                ns_info=ns_info)
        if self.behavior:
            return_obj.Behavior = self.behavior.to_obj(ns_info=ns_info)
        if self.related_ttps:
            return_obj.Related_TTPs = self.related_ttps.to_obj(ns_info=ns_info)
        if self.exploit_targets:
            return_obj.Exploit_Targets = self.exploit_targets.to_obj(
                ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(
                ns_info=ns_info)
        if self.intended_effects:
            return_obj.Intended_Effect = [
                x.to_obj(ns_info=ns_info) for x in self.intended_effects
            ]
        if self.resources:
            return_obj.Resources = self.resources.to_obj(ns_info=ns_info)
        if self.victim_targeting:
            return_obj.Victim_Targeting = self.victim_targeting.to_obj(
                ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)

        return return_obj
Exemple #41
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(Incident, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title
        
        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(ns_info=ns_info)
        if self.time:
            return_obj.Time = self.time.to_obj(ns_info=ns_info)
        if self.victims:
            return_obj.Victim = [x.to_obj(ns_info=ns_info) for x in self.victims]
        if self.attributed_threat_actors:
            return_obj.Attributed_Threat_Actors = self.attributed_threat_actors.to_obj(ns_info=ns_info)
        if self.related_indicators:
            return_obj.Related_Indicators = self.related_indicators.to_obj(ns_info=ns_info)
        if self.related_observables:
            return_obj.Related_Observables = self.related_observables.to_obj(ns_info=ns_info)
        if self.related_incidents:
            return_obj.Related_Incidents = self.related_incidents.to_obj(ns_info=ns_info)
        if self.categories:
            return_obj.Categories = self._binding.CategoriesType(Category=[x.to_obj(ns_info=ns_info) for x in self.categories])
        if self.intended_effects:
            return_obj.Intended_Effect = [x.to_obj(ns_info=ns_info) for x in self.intended_effects]
        if self.leveraged_ttps:
            return_obj.Leveraged_TTPs = self.leveraged_ttps.to_obj(ns_info=ns_info)
        if self.affected_assets:
            a = self._binding.AffectedAssetsType(Affected_Asset=[x.to_obj(ns_info=ns_info) for x in self.affected_assets])
            return_obj.Affected_Assets = a
        if self.discovery_methods:
            return_obj.Discovery_Method = [x.to_obj(ns_info=ns_info) for x in self.discovery_methods]
        if self.reporter:
            return_obj.Reporter = self.reporter.to_obj(ns_info=ns_info)
        if self.responders:
            return_obj.Responder = [x.to_obj(ns_info=ns_info) for x in self.responders]
        if self.coordinators:
            return_obj.Coordinator = [x.to_obj(ns_info=ns_info) for x in self.coordinators]
        if self.external_ids:
            return_obj.External_ID = [x.to_obj(ns_info=ns_info) for x in self.external_ids]
        if self.impact_assessment:
            return_obj.Impact_Assessment = self.impact_assessment.to_obj(ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(ns_info=ns_info)
        if self.security_compromise:
            return_obj.Security_Compromise = self.security_compromise.to_obj(ns_info=ns_info)
        if self.confidence:
            return_obj.Confidence = self.confidence.to_obj(ns_info=ns_info)
        if self.coa_taken:
            return_obj.COA_Taken = [x.to_obj(ns_info=ns_info) for x in self.coa_taken]
        if self.status:
            return_obj.Status = self.status.to_obj(ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
        if self.history:
            return_obj.History = self.history.to_obj(ns_info=ns_info)

        return return_obj
Exemple #42
0
    def to_obj(self, return_obj=None, ns_info=None):
        super(Incident, self).to_obj(return_obj=return_obj, ns_info=ns_info)

        if not return_obj:
            return_obj = self._binding_class()

        return_obj.id = self.id_
        return_obj.idref = self.idref
        return_obj.timestamp = dates.serialize_value(self.timestamp)
        return_obj.version = self.version
        return_obj.Title = self.title

        if self.description:
            return_obj.Description = self.description.to_obj(ns_info=ns_info)
        if self.short_description:
            return_obj.Short_Description = self.short_description.to_obj(
                ns_info=ns_info)
        if self.time:
            return_obj.Time = self.time.to_obj(ns_info=ns_info)
        if self.victims:
            return_obj.Victim = [
                x.to_obj(ns_info=ns_info) for x in self.victims
            ]
        if self.attributed_threat_actors:
            return_obj.Attributed_Threat_Actors = self.attributed_threat_actors.to_obj(
                ns_info=ns_info)
        if self.related_indicators:
            return_obj.Related_Indicators = self.related_indicators.to_obj(
                ns_info=ns_info)
        if self.related_observables:
            return_obj.Related_Observables = self.related_observables.to_obj(
                ns_info=ns_info)
        if self.related_incidents:
            return_obj.Related_Incidents = self.related_incidents.to_obj(
                ns_info=ns_info)
        if self.categories:
            return_obj.Categories = self._binding.CategoriesType(
                Category=[x.to_obj(ns_info=ns_info) for x in self.categories])
        if self.intended_effects:
            return_obj.Intended_Effect = [
                x.to_obj(ns_info=ns_info) for x in self.intended_effects
            ]
        if self.leveraged_ttps:
            return_obj.Leveraged_TTPs = self.leveraged_ttps.to_obj(
                ns_info=ns_info)
        if self.affected_assets:
            a = self._binding.AffectedAssetsType(Affected_Asset=[
                x.to_obj(ns_info=ns_info) for x in self.affected_assets
            ])
            return_obj.Affected_Assets = a
        if self.discovery_methods:
            return_obj.Discovery_Method = [
                x.to_obj(ns_info=ns_info) for x in self.discovery_methods
            ]
        if self.reporter:
            return_obj.Reporter = self.reporter.to_obj(ns_info=ns_info)
        if self.responders:
            return_obj.Responder = [
                x.to_obj(ns_info=ns_info) for x in self.responders
            ]
        if self.coordinators:
            return_obj.Coordinator = [
                x.to_obj(ns_info=ns_info) for x in self.coordinators
            ]
        if self.external_ids:
            return_obj.External_ID = [
                x.to_obj(ns_info=ns_info) for x in self.external_ids
            ]
        if self.impact_assessment:
            return_obj.Impact_Assessment = self.impact_assessment.to_obj(
                ns_info=ns_info)
        if self.information_source:
            return_obj.Information_Source = self.information_source.to_obj(
                ns_info=ns_info)
        if self.security_compromise:
            return_obj.Security_Compromise = self.security_compromise.to_obj(
                ns_info=ns_info)
        if self.confidence:
            return_obj.Confidence = self.confidence.to_obj(ns_info=ns_info)
        if self.coa_taken:
            return_obj.COA_Taken = [
                x.to_obj(ns_info=ns_info) for x in self.coa_taken
            ]
        if self.status:
            return_obj.Status = self.status.to_obj(ns_info=ns_info)
        if self.handling:
            return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
        if self.history:
            return_obj.History = self.history.to_obj(ns_info=ns_info)

        return return_obj
 def to_dict(self):
     d = {}
     if self.id_:
         d['id'] = self.id_
     if self.idref:
         d['idref'] = self.idref
     if self.timestamp:
         d['timestamp'] = dates.serialize_value(self.timestamp)
     if self.version:
         d['version'] = self.version or self._version
     if self.title:
         d['title'] = self.title
     if self.description:
         d['description'] = self.description.to_dict()
     if self.short_description:
         d['short_description'] = self.short_description.to_dict()
     if self.time:
         d['time'] = self.time.to_dict()
     if self.victims:
         d['victims'] = [x.to_dict() for x in self.victims]
     if self.categories:
         d['categories'] = [x.to_dict() for x in self.categories]
     if self.attributed_threat_actors:
         d['attributed_threat_actors'] = self.attributed_threat_actors.to_dict(
         )
     if self.related_indicators:
         d['related_indicators'] = self.related_indicators.to_dict()
     if self.related_observables:
         d['related_observables'] = self.related_observables.to_dict()
     if self.related_incidents:
         d['related_incidents'] = self.related_incidents.to_dict()
     if self.intended_effects:
         d['intended_effects'] = [
             x.to_dict() for x in self.intended_effects
         ]
     if self.leveraged_ttps:
         d['leveraged_ttps'] = self.leveraged_ttps.to_dict()
     if self.affected_assets:
         d['affected_assets'] = [x.to_dict() for x in self.affected_assets]
     if self.discovery_methods:
         d['discovery_methods'] = [
             x.to_dict() for x in self.discovery_methods
         ]
     if self.reporter:
         d['reporter'] = self.reporter.to_dict()
     if self.responders:
         d['responders'] = [x.to_dict() for x in self.responders]
     if self.coordinators:
         d['coordinators'] = [x.to_dict() for x in self.coordinators]
     if self.external_ids:
         d['external_ids'] = [x.to_dict() for x in self.external_ids]
     if self.impact_assessment:
         d['impact_assessment'] = self.impact_assessment.to_dict()
     if self.information_source:
         d['information_source'] = self.information_source.to_dict()
     if self.security_compromise:
         d['security_compromise'] = self.security_compromise.to_dict()
     if self.confidence:
         d['confidence'] = self.confidence.to_dict()
     if self.coa_taken:
         d['coa_taken'] = [x.to_dict() for x in self.coa_taken]
     return d
 def to_obj(self):
     obj = self._binding_class()
     obj.set_valueOf_(serialize_value(self.value))
     obj.set_precision(self.precision)
     return obj
    def to_obj(self, return_obj=None):
        if not return_obj:
            return_obj = self._binding_class()

        return_obj.set_id(self.id_)
        return_obj.set_idref(self.idref)
        return_obj.set_timestamp(dates.serialize_value(self.timestamp))
        return_obj.set_version(self.version)
        return_obj.set_Title(self.title)

        if self.description:
            return_obj.set_Description(self.description.to_obj())
        if self.short_description:
            return_obj.set_Short_Description(self.short_description.to_obj())
        if self.time:
            return_obj.set_Time(self.time.to_obj())
        if self.victims:
            return_obj.set_Victim([x.to_obj() for x in self.victims])
        if self.attributed_threat_actors:
            return_obj.set_Attributed_Threat_Actors(
                self.attributed_threat_actors.to_obj())
        if self.related_indicators:
            return_obj.set_Related_Indicators(self.related_indicators.to_obj())
        if self.related_observables:
            return_obj.set_Related_Observables(
                self.related_observables.to_obj())
        if self.related_incidents:
            return_obj.set_Related_Incidents(self.related_incidents.to_obj())
        if self.categories:
            return_obj.set_Categories(
                self._binding.CategoriesType(
                    Category=[x.to_obj() for x in self.categories]))
        if self.intended_effects:
            return_obj.set_Intended_Effect(
                [x.to_obj() for x in self.intended_effects])
        if self.leveraged_ttps:
            return_obj.set_Leveraged_TTPs(self.leveraged_ttps.to_obj())
        if self.affected_assets:
            a = self._binding.AffectedAssetsType(
                Affected_Asset=[x.to_obj() for x in self.affected_assets])
            return_obj.set_Affected_Assets(a)
        if self.discovery_methods:
            return_obj.set_Discovery_Method(
                [x.to_obj() for x in self.discovery_methods])
        if self.reporter:
            return_obj.set_Reporter(self.reporter.to_obj())
        if self.responders:
            return_obj.set_Responder([x.to_obj() for x in self.responders])
        if self.coordinators:
            return_obj.set_Coordinator([x.to_obj() for x in self.coordinators])
        if self.external_ids:
            return_obj.set_External_ID([x.to_obj() for x in self.external_ids])
        if self.impact_assessment:
            return_obj.set_Impact_Assessment(self.impact_assessment.to_obj())
        if self.information_source:
            return_obj.set_Information_Source(self.information_source.to_obj())
        if self.security_compromise:
            return_obj.set_Security_Compromise(
                self.security_compromise.to_obj())
        if self.confidence:
            return_obj.set_Confidence(self.confidence.to_obj())
        if self.coa_taken:
            return_obj.set_COA_Taken([x.to_obj() for x in self.coa_taken])

        return return_obj