本文整理汇总了Python中cybox.common.MeasureSource.name方法的典型用法代码示例。如果您正苦于以下问题:Python MeasureSource.name方法的具体用法?Python MeasureSource.name怎么用?Python MeasureSource.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cybox.common.MeasureSource
的用法示例。
在下文中一共展示了MeasureSource.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildObservable
# 需要导入模块: from cybox.common import MeasureSource [as 别名]
# 或者: from cybox.common.MeasureSource import name [as 别名]
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
示例2: test_measure_source
# 需要导入模块: from cybox.common import MeasureSource [as 别名]
# 或者: from cybox.common.MeasureSource import name [as 别名]
def test_measure_source(self):
o = MeasureSource()
o.name = UNICODE_STR
o2 = round_trip(o)