本文整理汇总了Python中stix.common.StructuredTextList.from_obj方法的典型用法代码示例。如果您正苦于以下问题:Python StructuredTextList.from_obj方法的具体用法?Python StructuredTextList.from_obj怎么用?Python StructuredTextList.from_obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stix.common.StructuredTextList
的用法示例。
在下文中一共展示了StructuredTextList.from_obj方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
from stix.common import StructuredTextList, InformationSource
from stix.data_marking import Marking
if not return_obj:
raise ValueError("Must provide a return_obj argument")
if not obj:
raise ValueError("Must provide an obj argument")
return_obj.id_ = obj.id
return_obj.idref = obj.idref
return_obj.timestamp = obj.timestamp
# These may not be found on the input obj if it isn't a full
# type definition (e.g., used as a reference)
return_obj.version = getattr(obj, 'version', None)
return_obj.title = getattr(obj, 'Title', None)
return_obj.descriptions = \
StructuredTextList.from_obj(getattr(obj, 'Description', None))
return_obj.short_descriptions = \
StructuredTextList.from_obj(getattr(obj, 'Short_Description', None))
return_obj.information_source = \
InformationSource.from_obj(getattr(obj, 'Information_Source', None))
return_obj.handling = \
Marking.from_obj(getattr(obj, 'Handling', None))
return return_obj
示例2: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return_obj.applicability_confidence = Confidence.from_obj(obj.Applicability_Confidence)
return return_obj
示例3: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_description = StructuredTextList.from_obj(obj.Short_Description)
return_obj.cce_id = obj.CCE_ID
return return_obj
示例4: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.id
return_obj.title = obj.Title
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return return_obj
示例5: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.title = obj.Title
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return_obj.handling = Marking.from_obj(obj.Handling)
return_obj.information_source = InformationSource.from_obj(obj.Information_Source)
return_obj.intents = _ReportIntents.from_obj(obj.Intent)
return return_obj
示例6: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.title = obj.Title
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return_obj.handling = Marking.from_obj(obj.Handling)
return_obj.information_source = InformationSource.from_obj(obj.Information_Source)
return_obj.package_intents = _PackageIntents.from_obj(obj.Package_Intent)
return_obj.profiles = obj.Profiles.Profile if obj.Profiles else []
return return_obj
示例7: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.id
return_obj.title = obj.Title
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return_obj.observable_characterization = Observables.from_obj(obj.Observable_Characterization)
if obj.Type:
return_obj.types = [VocabString.from_obj(x) for x in obj.Type]
return return_obj
示例8: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
import stix.extensions.malware.maec_4_1_malware # noqa
if not obj:
return None
if not return_obj:
klass = stix.lookup_extension(obj, default=cls)
return_obj = klass.from_obj(obj, klass())
else:
return_obj.id_ = obj.id
return_obj.title = obj.Title
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return_obj.names = MalwareNames.from_obj(obj.Name)
return_obj.types = MalwareTypes.from_obj(obj.Type)
return return_obj
示例9: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.type_ = AssetType.from_obj(obj.Type)
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.business_functions_or_roles = StructuredTextList.from_obj(obj.Business_Function_Or_Role)
return_obj.ownership_class = VocabString.from_obj(obj.Ownership_Class)
return_obj.management_class = VocabString.from_obj(obj.Management_Class)
return_obj.location_class = VocabString.from_obj(obj.Location_Class)
# return_obj.location = None
if obj.Nature_Of_Security_Effect:
n = obj.Nature_Of_Security_Effect
return_obj.nature_of_security_effect = [PropertyAffected.from_obj(x) for x in n.Property_Affected]
return return_obj
示例10: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.property_ = VocabString.from_obj(obj.Property)
return_obj.descriptions_of_effect = StructuredTextList.from_obj(obj.Description_Of_Effect)
return_obj.type_of_availability_loss = VocabString.from_obj(obj.Type_Of_Availability_Loss)
return_obj.duration_of_availability_loss = VocabString.from_obj(obj.Duration_Of_Availability_Loss)
return_obj.non_public_data_compromised = NonPublicDataCompromised.from_obj(obj.Non_Public_Data_Compromised)
return return_obj
示例11: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
super(GenericTestMechanism, cls).from_obj(obj, return_obj)
return_obj.reference_location = obj.reference_location
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.type_ = VocabString.from_obj(obj.Type)
return_obj.specification = EncodedCDATA.from_obj(obj.Specification)
return return_obj
示例12: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.is_known = utils.xml_bool(obj.is_known)
return_obj.is_publicly_acknowledged = utils.xml_bool(obj.is_publicly_acknowledged)
return_obj.title = obj.Title
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description)
return_obj.cve_id = obj.CVE_ID
return_obj.osvdb_id = obj.OSVDB_ID
return_obj.source = obj.Source
return_obj.cvss_score = CVSSVector.from_obj(obj.CVSS_Score)
return_obj.discovered_datetime = DateTimeWithPrecision.from_obj(obj.Discovered_DateTime)
return_obj.published_datetime = DateTimeWithPrecision.from_obj(obj.Published_DateTime)
return_obj.affected_software = AffectedSoftware.from_obj(obj.Affected_Software)
if obj.References:
return_obj.references = obj.References.Reference
return return_obj
示例13: from_obj
# 需要导入模块: from stix.common import StructuredTextList [as 别名]
# 或者: from stix.common.StructuredTextList import from_obj [as 别名]
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if return_obj is None:
return_obj = cls()
return_obj.timestamp = obj.timestamp
return_obj.timestamp_precision = obj.timestamp_precision
return_obj.source = InformationSource.from_obj(obj.Source)
return_obj.reference = obj.Reference
return_obj.confidence = Confidence.from_obj(obj.Confidence)
return_obj.descriptions = StructuredTextList.from_obj(obj.Description)
return_obj.related_observables = RelatedObservables.from_obj(obj.Related_Observables)
return return_obj