当前位置: 首页>>代码示例>>Python>>正文


Python common.MeasureSource类代码示例

本文整理汇总了Python中cybox.common.MeasureSource的典型用法代码示例。如果您正苦于以下问题:Python MeasureSource类的具体用法?Python MeasureSource怎么用?Python MeasureSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MeasureSource类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: buildObservable

def buildObservable(input_dict):
    # add incident and confidence
    observable = Observable()
    observable.description = input_dict['description']
    observable.title = input_dict['title']

    source = MeasureSource()
    source.name = input_dict['source']
    observable.observable_source = [source] # figure out why this is necessary

    if input_dict['keyword']:
        observable.add_keyword(input_dict['keyword'])
    """
    event = Event()
    event.description = input_dict['event']
    observable.event = event

    """
    if input_dict['objectType'] and input_dict['object']:
        cybObj = Object()

        if input_dict['objectType'] == 'Address':
            cybObj.properties = Address(input_dict['object'])
        elif input_dict['objectType'] == 'File':
            cybObj.properties = File()
            cybObj.properties.file_path = FilePath(input_dict['object'])
        elif input_dict['objectType'] == 'URI':
            cybObj.properties = URI(input_dict['object'])

        if cybObj:
            observable.object_ = cybObj

    print observable.to_xml()
    return observable
开发者ID:mjglanzer,项目名称:subsonar,代码行数:34,代码来源:generateObservable.py

示例2: test_round_trip

    def test_round_trip(self):
        a = Address("[email protected]", Address.CAT_EMAIL)
        a2 = Address("[email protected]", Address.CAT_EMAIL)

        ms = MeasureSource()
        ms.class_ = "System"
        ms.source_type = "Analysis"
        ms.description = StructuredText("A Description")

        o = Observables([a, a2])
        o.observable_package_source = ms

        o2 = round_trip(o, output=True)
        self.assertEqual(o.to_dict(), o2.to_dict())
开发者ID:luisgf,项目名称:watsondt,代码行数:14,代码来源:observable_test.py

示例3: _create_observables

    def _create_observables(self, msg):
        o = Observables(self.__parse_email_message(msg))

        t = ToolInformation()
        t.name = os.path.basename(__file__)
        t.description = StructuredText("Email to CybOX conversion script")
        t.vendor = "The MITRE Corporation"
        t.version = __version__

        t_list = ToolInformationList()
        t_list.append(t)

        m = MeasureSource()
        m.tools = t_list
        o.observable_package_source = m

        return o
开发者ID:AAG-SATIEDN,项目名称:Tools,代码行数:17,代码来源:email_to_cybox.py

示例4: from_dict

    def from_dict(observables_dict):
        if observables_dict is None:
            return None

        #TODO: look at major_version and minor_version
        obs = Observables()

        for o in observables_dict.get("observables", []):
            obs.add(Observable.from_dict(o))
        obs.observable_package_source = MeasureSource.from_dict(observables_dict.get('observable_package_source'))

        return obs
开发者ID:luisgf,项目名称:watsondt,代码行数:12,代码来源:observable.py

示例5: from_obj

    def from_obj(observables_obj):
        if not observables_obj:
            return None

        #TODO: look at major_version and minor_version
        obs = Observables()

        # get_Observable() actually returns a list
        for o in observables_obj.Observable:
            obs.add(Observable.from_obj(o))

        obs.observable_package_source = MeasureSource.from_obj(observables_obj.Observable_Package_Source)

        return obs
开发者ID:luisgf,项目名称:watsondt,代码行数:14,代码来源:observable.py

示例6: from_obj

    def from_obj(observable_obj):
        if not observable_obj:
            return None

        obs = Observable()

        obs.id_ = observable_obj.get_id()
        obs.title = observable_obj.get_Title()
        obs.description = StructuredText.from_obj(observable_obj.get_Description())
        obs.object_ = Object.from_obj(observable_obj.get_Object())
        obs.event = Event.from_obj(observable_obj.get_Event())
        obs.observable_composition = ObservableComposition.from_obj(observable_obj.get_Observable_Composition())
        obs.idref = observable_obj.get_idref()
        obs.sighting_count = observable_obj.get_sighting_count()
        if observable_obj.get_Observable_Source():
            obs.observable_source = [MeasureSource.from_obj(x) for x in observable_obj.get_Observable_Source()]
        return obs
开发者ID:ajnelson,项目名称:python-cybox,代码行数:17,代码来源:observable.py

示例7: from_dict

    def from_dict(observable_dict):
        if not observable_dict:
            return None

        obs = Observable()

        obs.id_ = observable_dict.get('id')
        obs.title = observable_dict.get('title')
        obs.description = StructuredText.from_dict(observable_dict.get('description'))
        obs.object_ = Object.from_dict(observable_dict.get('object'))
        obs.event = Object.from_dict(observable_dict.get('event'))
        obs.observable_composition = ObservableComposition.from_dict(observable_dict.get('observable_composition'))
        obs.idref = observable_dict.get('idref')
        obs.sighting_count = observable_dict.get('sighting_count')
        if observable_dict.get('observable_source'):
            obs.observable_source = [MeasureSource.from_dict(x) for x in observable_dict.get('observable_source')]

        return obs
开发者ID:ajnelson,项目名称:python-cybox,代码行数:18,代码来源:observable.py

示例8: from_dict

 def from_dict(action_dict, action_cls = None):
     if not action_dict:
         return None
     if action_cls == None:
         action_cls = Action()
     action_ = action_cls
     action_.id = action_dict.get('id')
     action_.idref = action_dict.get('idref')
     action_.ordinal_position = action_dict.get('ordinal_position')
     action_.action_status = action_dict.get('action_status')
     action_.context = action_dict.get('context')
     action_.timestamp = action_dict.get('timestamp')
     action_.type = VocabString.from_dict(action_dict.get('type'))
     action_.name = VocabString.from_dict(action_dict.get('name'))
     action_.description = StructuredText.from_dict(action_dict.get('description'))
     action_.action_aliases = action_dict.get('action_aliases', [])
     action_.action_arguments = ActionArguments.from_list(action_dict.get('action_arguments', []))
     action_.discovery_method = MeasureSource.from_dict(action_dict.get('discovery_method'))
     action_.associated_objects = AssociatedObjects.from_list(action_dict.get('associated_objects', []))
     action_.relationships = ActionRelationships.from_list(action_dict.get('relationships', []))
     #action_.frequency = Frequency.from_dict(action_dict.get('frequency')) #TODO: add support
     return action_
开发者ID:maurakilleen,项目名称:crits_dependencies,代码行数:22,代码来源:action.py

示例9: from_obj

 def from_obj(action_obj, action_cls = None):
     if not action_obj:
         return None
     if action_cls == None:
         action_cls = Action()
     action_ = action_cls
     action_.id = action_obj.get_id()
     action_.idref = action_obj.get_idref()
     action_.ordinal_position = action_obj.get_ordinal_position()
     action_.action_status = action_obj.get_action_status()
     action_.context = action_obj.get_context()
     action_.timestamp = action_obj.get_timestamp()
     action_.type = VocabString.from_obj(action_obj.get_Type())
     action_.name = VocabString.from_obj(action_obj.get_Name())
     action_.description = StructuredText.from_obj(action_obj.get_Description())
     if action_obj.get_Action_Arguments() is not None: action_.action_arguments = ActionArguments.from_obj(action_obj.get_Action_Arguments())
     action_.discovery_method = MeasureSource.from_obj(action_obj.get_Discovery_Method())
     if action_obj.get_Associated_Objects() is not None : action_.associated_objects = AssociatedObjects.from_obj(action_obj.get_Associated_Objects())
     if action_obj.get_Relationships() is not None : action_.relationships = ActionRelationships.from_obj(action_obj.get_Relationships())
     #action_.frequency = Frequency.from_dict(action_dict.get('frequency')) #TODO: add support
     if action_obj.get_Action_Aliases() is not None :
         action_.action_aliases = action_obj.get_Action_Aliases().get_Action_Alias()
     return action_
开发者ID:maurakilleen,项目名称:crits_dependencies,代码行数:23,代码来源:action.py

示例10: test_measure_source

 def test_measure_source(self):
     o = MeasureSource()
     o.name = UNICODE_STR
     o2 = round_trip(o)
开发者ID:ChrisNolan1992,项目名称:python-cybox,代码行数:4,代码来源:encoding_test.py


注:本文中的cybox.common.MeasureSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。