當前位置: 首頁>>代碼示例>>Python>>正文


Python MeasureSource.name方法代碼示例

本文整理匯總了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
開發者ID:mjglanzer,項目名稱:subsonar,代碼行數:36,代碼來源:generateObservable.py

示例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)
開發者ID:ChrisNolan1992,項目名稱:python-cybox,代碼行數:6,代碼來源:encoding_test.py


注:本文中的cybox.common.MeasureSource.name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。