本文整理匯總了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