Пример #1
0
    def from_obj(cls, obj, return_obj=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()
        return_obj.stix_header = STIXHeader.from_obj(obj.get_STIX_Header())
        return_obj.related_packages = RelatedPackages.from_obj(obj.get_Related_Packages())

        if obj.get_version():
            return_obj.version = obj.get_version()
        if obj.get_Campaigns():
            return_obj.campaigns = [Campaign.from_obj(x) for x in obj.get_Campaigns().get_Campaign()]
        if obj.get_Courses_Of_Action():
            return_obj.courses_of_action = [CourseOfAction.from_obj(x) for x in obj.get_Courses_Of_Action().get_Course_Of_Action()]
        if obj.get_Exploit_Targets():
            return_obj.exploit_targets = [ExploitTarget.from_obj(x) for x in obj.get_Exploit_Targets().get_Exploit_Target()]
        if obj.get_Indicators():
            return_obj.indicators = [Indicator.from_obj(x) for x in obj.get_Indicators().get_Indicator()]
        if obj.get_Observables():
            return_obj.observables = Observables.from_obj(obj.get_Observables())
        if obj.get_Incidents():
            return_obj.incidents = [Incident.from_obj(x) for x in obj.get_Incidents().get_Incident()]
        if obj.get_Threat_Actors():
            return_obj.threat_actors = [ThreatActor.from_obj(x) for x in obj.get_Threat_Actors().get_Threat_Actor()]
        if obj.get_TTPs():
            return_obj.ttps = TTPs.from_obj(obj.get_TTPs())
            
        return return_obj
Пример #2
0
    def from_obj(cls, obj, return_obj=None):
        if not return_obj:
            return_obj = cls()

        return_obj.id_ = obj.id
        return_obj.idref = obj.idref
        return_obj.timestamp = obj.timestamp
        return_obj.stix_header = STIXHeader.from_obj(obj.STIX_Header)
        return_obj.related_packages = RelatedPackages.from_obj(obj.Related_Packages)

        if obj.version:
            return_obj.version = obj.version
        if obj.Campaigns:
            return_obj.campaigns = [Campaign.from_obj(x) for x in obj.Campaigns.Campaign]
        if obj.Courses_Of_Action:
            return_obj.courses_of_action = [CourseOfAction.from_obj(x) for x in obj.Courses_Of_Action.Course_Of_Action]
        if obj.Exploit_Targets:
            return_obj.exploit_targets = [ExploitTarget.from_obj(x) for x in obj.Exploit_Targets.Exploit_Target]
        if obj.Indicators:
            return_obj.indicators = [Indicator.from_obj(x) for x in obj.Indicators.Indicator]
        if obj.Observables:
            return_obj.observables = Observables.from_obj(obj.Observables)
        if obj.Incidents:
            return_obj.incidents = [Incident.from_obj(x) for x in obj.Incidents.Incident]
        if obj.Threat_Actors:
            return_obj.threat_actors = [ThreatActor.from_obj(x) for x in obj.Threat_Actors.Threat_Actor]
        if obj.TTPs:
            return_obj.ttps = TTPs.from_obj(obj.TTPs)
            
        return return_obj
Пример #3
0
    def from_obj(cls, obj, return_obj=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()
        return_obj.stix_header = STIXHeader.from_obj(obj.get_STIX_Header())
        return_obj.related_packages = RelatedPackages.from_obj(
            obj.get_Related_Packages())

        if obj.get_version():
            return_obj.version = obj.get_version()
        if obj.get_Campaigns():
            return_obj.campaigns = [
                Campaign.from_obj(x)
                for x in obj.get_Campaigns().get_Campaign()
            ]
        if obj.get_Courses_Of_Action():
            return_obj.courses_of_action = [
                CourseOfAction.from_obj(x)
                for x in obj.get_Courses_Of_Action().get_Course_Of_Action()
            ]
        if obj.get_Exploit_Targets():
            return_obj.exploit_targets = [
                ExploitTarget.from_obj(x)
                for x in obj.get_Exploit_Targets().get_Exploit_Target()
            ]
        if obj.get_Indicators():
            return_obj.indicators = [
                Indicator.from_obj(x)
                for x in obj.get_Indicators().get_Indicator()
            ]
        if obj.get_Observables():
            return_obj.observables = Observables.from_obj(
                obj.get_Observables())
        if obj.get_Incidents():
            return_obj.incidents = [
                Incident.from_obj(x)
                for x in obj.get_Incidents().get_Incident()
            ]
        if obj.get_Threat_Actors():
            return_obj.threat_actors = [
                ThreatActor.from_obj(x)
                for x in obj.get_Threat_Actors().get_Threat_Actor()
            ]
        if obj.get_TTPs():
            return_obj.ttps = TTPs.from_obj(obj.get_TTPs())

        return return_obj
Пример #4
0
 def from_obj(cls, obj, return_obj=None):
     if not return_obj:
         return_obj = cls()
         
     return_obj.id_ = obj.get_id()
     return_obj.idref_ = obj.get_idref()
     return_obj.version = obj.get_version()
     return_obj.stix_header = STIXHeader.from_obj(obj.get_STIX_Header())
     
     if obj.get_Indicators():
         indicators_obj = obj.get_Indicators()
         if indicators_obj.get_Indicator():
             for indicator_obj in indicators_obj.get_Indicator():
                 return_obj.add_indicator(Indicator.from_obj(indicator_obj))
     
     return return_obj
Пример #5
0
    def from_obj(cls, obj, return_obj=None):
        if not return_obj:
            return_obj = cls()

        return_obj.id_ = obj.get_id()
        return_obj.idref_ = obj.get_idref()
        return_obj.version = obj.get_version()
        return_obj.stix_header = STIXHeader.from_obj(obj.get_STIX_Header())

        if obj.get_Indicators():
            indicators_obj = obj.get_Indicators()
            if indicators_obj.get_Indicator():
                for indicator_obj in indicators_obj.get_Indicator():
                    return_obj.add_indicator(Indicator.from_obj(indicator_obj))

        if obj.get_Observables():
            observables_obj = obj.get_Observables()
            return_obj.observables = Observables.from_obj(observables_obj)

        return return_obj