本文整理汇总了Python中scapy.layers.inet.IP.name方法的典型用法代码示例。如果您正苦于以下问题:Python IP.name方法的具体用法?Python IP.name怎么用?Python IP.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scapy.layers.inet.IP
的用法示例。
在下文中一共展示了IP.name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: decrypt
# 需要导入模块: from scapy.layers.inet import IP [as 别名]
# 或者: from scapy.layers.inet.IP import name [as 别名]
def decrypt(self, pkt, verify=True):
"""
Decrypt (and decapsulate) an IP(v6) packet containing ESP or AH.
@param pkt: the packet to decrypt
@param verify: if False, do not perform the integrity check
@return: the decrypted/decapsulated packet
@raise IPSecIntegrityError: if the integrity check fails
"""
if not isinstance(pkt, self.SUPPORTED_PROTOS):
raise TypeError('cannot decrypt %s, supported protos are %s'
% (pkt.__class__, self.SUPPORTED_PROTOS))
if self.proto is ESP and pkt.haslayer(ESP):
return self._decrypt_esp(pkt, verify=verify)
elif self.proto is AH and pkt.haslayer(AH):
return self._decrypt_ah(pkt, verify=verify)
else:
raise TypeError('%s has no %s layer' % (pkt, self.proto.name))
示例2: decrypt
# 需要导入模块: from scapy.layers.inet import IP [as 别名]
# 或者: from scapy.layers.inet.IP import name [as 别名]
def decrypt(self, pkt, verify=True, esn_en=None, esn=None):
"""
Decrypt (and decapsulate) an IP(v6) packet containing ESP or AH.
:param pkt: the packet to decrypt
:param verify: if False, do not perform the integrity check
:param esn_en: extended sequence number enable which allows to use
64-bit sequence number instead of 32-bit when using an
AEAD algorithm
:param esn: extended sequence number (32 MSB)
:returns: the decrypted/decapsulated packet
:raise scapy.layers.ipsec.IPSecIntegrityError: if the integrity check
fails
"""
if not isinstance(pkt, self.SUPPORTED_PROTOS):
raise TypeError('cannot decrypt %s, supported protos are %s'
% (pkt.__class__, self.SUPPORTED_PROTOS))
if self.proto is ESP and pkt.haslayer(ESP):
return self._decrypt_esp(pkt, verify=verify,
esn_en=esn_en, esn=esn)
elif self.proto is AH and pkt.haslayer(AH):
return self._decrypt_ah(pkt, verify=verify, esn_en=esn_en, esn=esn)
else:
raise TypeError('%s has no %s layer' % (pkt, self.proto.name))
示例3: __init__
# 需要导入模块: from scapy.layers.inet import IP [as 别名]
# 或者: from scapy.layers.inet.IP import name [as 别名]
def __init__(self, name, cipher, mode, block_size=None, iv_size=None, key_size=None):
"""
@param name: the name of this encryption algorithm
@param cipher: a Cipher module
@param mode: the mode used with the cipher module
@param block_size: the length a block for this algo. Defaults to the
`block_size` of the cipher.
@param iv_size: the length of the initialization vector of this algo.
Defaults to the `block_size` of the cipher.
@param key_size: an integer or list/tuple of integers. If specified,
force the secret keys length to one of the values.
Defaults to the `key_size` of the cipher.
"""
self.name = name
self.cipher = cipher
self.mode = mode
if block_size is not None:
self.block_size = block_size
elif cipher is not None:
self.block_size = cipher.block_size
else:
self.block_size = 1
if iv_size is None:
self.iv_size = self.block_size
else:
self.iv_size = iv_size
if key_size is not None:
self.key_size = key_size
elif cipher is not None:
self.key_size = cipher.key_size
else:
self.key_size = None
示例4: __init__
# 需要导入模块: from scapy.layers.inet import IP [as 别名]
# 或者: from scapy.layers.inet.IP import name [as 别名]
def __init__(self, name, mac, digestmod, icv_size, key_size=None):
"""
:param name: the name of this integrity algorithm
:param mac: a Message Authentication Code module
:param digestmod: a Hash or Cipher module
:param icv_size: the length of the integrity check value of this algo
:param key_size: an integer or list/tuple of integers. If specified,
force the secret keys length to one of the values.
Defaults to the `key_size` of the cipher.
"""
self.name = name
self.mac = mac
self.digestmod = digestmod
self.icv_size = icv_size
self.key_size = key_size
示例5: __init__
# 需要导入模块: from scapy.layers.inet import IP [as 别名]
# 或者: from scapy.layers.inet.IP import name [as 别名]
def __init__(self, name, mac, digestmod, icv_size, key_size=None):
"""
@param name: the name of this integrity algorithm
@param mac: a Message Authentication Code module
@param digestmod: a Hash or Cipher module
@param icv_size: the length of the integrity check value of this algo
@param key_size: an integer or list/tuple of integers. If specified,
force the secret keys length to one of the values.
Defaults to the `key_size` of the cipher.
"""
self.name = name
self.mac = mac
self.digestmod = digestmod
self.icv_size = icv_size
self.key_size = key_size