本文整理汇总了Python中cybox.common.HashList.append方法的典型用法代码示例。如果您正苦于以下问题:Python HashList.append方法的具体用法?Python HashList.append怎么用?Python HashList.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cybox.common.HashList
的用法示例。
在下文中一共展示了HashList.append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_namespace_count
# 需要导入模块: from cybox.common import HashList [as 别名]
# 或者: from cybox.common.HashList import append [as 别名]
def test_namespace_count(self):
h = HashList()
h.append(EMPTY_MD5)
h.append(EMPTY_SHA1)
h.append(EMPTY_SHA224)
h.append(EMPTY_SHA256)
h.append(EMPTY_SHA384)
h.append(EMPTY_SHA512)
logger.info(h.to_xml())
ns_list = cybox.test.round_trip(h, list_=True)._get_namespaces()
logger.info(ns_list)
# Only "common" and "vocabs" should be here. "xsi" is only added later
self.assertEqual(2, len(ns_list))
示例2: File
# 需要导入模块: from cybox.common import HashList [as 别名]
# 或者: from cybox.common.HashList import append [as 别名]
class File(ObjectProperties):
_binding = file_binding
_binding_class = file_binding.FileObjectType
_namespace = 'http://cybox.mitre.org/objects#FileObject-2'
_XSI_NS = "FileObj"
_XSI_TYPE = "FileObjectType"
is_packed = cybox.TypedField("is_packed")
file_name = cybox.TypedField("File_Name", String)
file_path = cybox.TypedField("File_Path", FilePath)
device_path = cybox.TypedField("Device_Path", String)
full_path = cybox.TypedField("Full_Path", String)
file_extension = cybox.TypedField("File_Extension", String)
size_in_bytes = cybox.TypedField("Size_In_Bytes", UnsignedLong)
magic_number = cybox.TypedField("Magic_Number", HexBinary)
file_format = cybox.TypedField("File_Format", String)
modified_time = cybox.TypedField("Modified_Time", String)
accessed_time = cybox.TypedField("Accessed_Time", String)
created_time = cybox.TypedField("Created_Time", DateTime)
hashes = cybox.TypedField("Hashes", HashList)
extracted_features = cybox.TypedField("Extracted_Features",
ExtractedFeatures)
# Not supported yet:
# - Digital_Signatures
# - File_Attributes_List
# - Permissions
# - User_Owner
# - Packer_List
# - Peak_Entropy
# - Sym_Links
# - Extracted_Features
# - Byte Runs
def __init__(self):
super(File, self).__init__()
self.is_packed = None
@property
def md5(self):
if self.hashes is None:
return None
return self.hashes.md5
@md5.setter
def md5(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.md5 = value
@property
def sha1(self):
if self.hashes is None:
return None
return self.hashes.sha1
@sha1.setter
def sha1(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha1 = value
@property
def sha256(self):
if self.hashes is None:
return None
return self.hashes.sha256
@sha256.setter
def sha256(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha256 = value
@property
def size(self):
"""`size` is an alias for `size_in_bytes`"""
return self.size_in_bytes
@size.setter
def size(self, value):
"""`size` is an alias for `size_in_bytes`"""
self.size_in_bytes = value
def add_hash(self, hash_):
if hash_ is not None:
if self.hashes is None:
self.hashes = HashList()
self.hashes.append(hash_)
示例3: File
# 需要导入模块: from cybox.common import HashList [as 别名]
# 或者: from cybox.common.HashList import append [as 别名]
#.........这里部分代码省略.........
byte_runs = fields.TypedField("Byte_Runs", ByteRuns)
extracted_features = fields.TypedField("Extracted_Features",
ExtractedFeatures)
encryption_algorithm = fields.TypedField("Encryption_Algorithm", String)
decryption_key = fields.TypedField("Decryption_Key", String)
compression_method = fields.TypedField("Compression_Method", String)
compression_version = fields.TypedField("Compression_Version", String)
compression_comment = fields.TypedField("Compression_Comment", String)
def __init__(self):
super(File, self).__init__()
self.is_packed = None
@property
def md5(self):
if self.hashes is None:
return None
return self.hashes.md5
@md5.setter
def md5(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.md5 = value
@property
def sha1(self):
if self.hashes is None:
return None
return self.hashes.sha1
@sha1.setter
def sha1(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha1 = value
@property
def sha224(self):
if self.hashes is None:
return None
return self.hashes.sha224
@sha224.setter
def sha224(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha224 = value
@property
def sha256(self):
if self.hashes is None:
return None
return self.hashes.sha256
@sha256.setter
def sha256(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha256 = value
@property
def sha384(self):
if self.hashes is None:
return None
return self.hashes.sha384
@sha384.setter
def sha384(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha384 = value
@property
def sha512(self):
if self.hashes is None:
return None
return self.hashes.sha512
@sha512.setter
def sha512(self, value):
if self.hashes is None:
self.hashes = HashList()
self.hashes.sha512 = value
@property
def size(self):
"""`size` is an alias for `size_in_bytes`"""
return self.size_in_bytes
@size.setter
def size(self, value):
"""`size` is an alias for `size_in_bytes`"""
self.size_in_bytes = value
def add_hash(self, hash_):
if hash_ is not None:
if self.hashes is None:
self.hashes = HashList()
self.hashes.append(hash_)