本文整理汇总了Python中cybox.core.Object.from_obj方法的典型用法代码示例。如果您正苦于以下问题:Python Object.from_obj方法的具体用法?Python Object.from_obj怎么用?Python Object.from_obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cybox.core.Object
的用法示例。
在下文中一共展示了Object.from_obj方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_obj
# 需要导入模块: from cybox.core import Object [as 别名]
# 或者: from cybox.core.Object 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.observable_composition = ObservableComposition.from_obj(observable_obj.get_Observable_Composition())
obs.idref = observable_obj.get_idref()
return obs
示例2: from_obj
# 需要导入模块: from cybox.core import Object [as 别名]
# 或者: from cybox.core.Object 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.core import Object [as 别名]
# 或者: from cybox.core.Object import from_obj [as 别名]
def from_obj(malware_subject_obj):
if not malware_subject_obj:
return None
malware_subject_ = MalwareSubject(None)
malware_subject_.id = malware_subject_obj.get_id()
malware_subject_.malware_instance_object_attributes = Object.from_obj(malware_subject_obj.get_Malware_Instance_Object_Attributes())
malware_subject_.minor_variants = MinorVariants.from_obj(malware_subject_obj.get_Minor_Variants())
malware_subject_.configuration_details = MalwareConfigurationDetails.from_obj(malware_subject_obj.get_Configuration_Details())
malware_subject_.development_environment = MalwareDevelopmentEnvironment.from_obj(malware_subject_obj.get_Development_Environment())
malware_subject_.field_data = None #TODO: add support
malware_subject_.analyses = Analyses.from_obj(malware_subject_obj.get_Analyses())
malware_subject_.findings_bundles = FindingsBundleList.from_obj(malware_subject_obj.get_Findings_Bundles())
malware_subject_.relationships = MalwareSubjectRelationshipList.from_obj(malware_subject_obj.get_Relationships())
if malware_subject_obj.get_Label():
malware_subject_.label = [VocabString.from_obj(x) for x in malware_subject_obj.get_Label()]
if malware_subject_obj.get_Compatible_Platform():
malware_subject_.compatible_platform = [PlatformSpecification.from_obj(x) for x in malware_subject_obj.get_Compatible_Platform()]
return malware_subject_
示例4: __get_email_cybox_object
# 需要导入模块: from cybox.core import Object [as 别名]
# 或者: from cybox.core.Object import from_obj [as 别名]
def __get_email_cybox_object(self, email_sha256, log, config=None):
if not config:
return None, None, None
mail_path = os.path.join(config['emailpath'], email_sha256[0:2], email_sha256[2:4], email_sha256)
email_path = os.path.join(mail_path, 'cybox-%s-message.xml' % (email_sha256))
email_stix_path = os.path.join(mail_path, 'stix-%s-email-message.xml' % (email_sha256))
email_stix_filename = 'stix-%s-email-message.xml' % (email_sha256)
if os.path.exists(mail_path) and os.path.exists(email_path):
try:
observables_obj = cybox_core_binding.parse(email_path)
obs = Observables.from_obj(observables_obj)
email_observables = obs.observables[1:]
email_object = Object.from_obj(obs.observables[0].to_obj().Object)
return email_object._properties, email_observables, (email_stix_path, email_stix_filename)
except StandardError as e:
log.error("failed extracting cybox email observable: %s" % (e))
return None, None, None
log.warning("no cybox report or email found for given hash: %s" % (email_path))
return None, None, None
示例5: from_obj
# 需要导入模块: from cybox.core import Object [as 别名]
# 或者: from cybox.core.Object import from_obj [as 别名]
def from_obj(observable_obj):
if not observable_obj:
return None
from cybox.core import PatternFidelity
obs = Observable()
obs.id_ = observable_obj.id
obs.title = observable_obj.Title
obs.description = StructuredText.from_obj(observable_obj.Description)
obs.object_ = Object.from_obj(observable_obj.Object)
obs.event = Event.from_obj(observable_obj.Event)
obs.observable_composition = ObservableComposition.from_obj(observable_obj.Observable_Composition)
obs.idref = observable_obj.idref
obs.sighting_count = observable_obj.sighting_count
if observable_obj.Observable_Source:
obs.observable_source = [MeasureSource.from_obj(x) for x in observable_obj.Observable_Source]
obs.keywords = Keywords.from_obj(observable_obj.Keywords)
obs.pattern_fidelity = PatternFidelity.from_obj(observable_obj.Pattern_Fidelity)
return obs
示例6: from_obj
# 需要导入模块: from cybox.core import Object [as 别名]
# 或者: from cybox.core.Object import from_obj [as 别名]
def from_obj(object_obj):
if not object_obj:
return None
obj = Object.from_obj(object_obj, AssociatedObject())
obj.association_type_ = VocabString.from_obj(object_obj.get_Association_Type())
return obj
示例7: from_obj
# 需要导入模块: from cybox.core import Object [as 别名]
# 或者: from cybox.core.Object import from_obj [as 别名]
def from_obj(object_obj):
if not object_obj:
return None
obj = Object.from_obj(object_obj, AssociatedObject())
obj.association_type = AssociationType.from_obj(object_obj.Association_Type)
return obj