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