本文整理汇总了Python中scapy.config.conf.checkIPID方法的典型用法代码示例。如果您正苦于以下问题:Python conf.checkIPID方法的具体用法?Python conf.checkIPID怎么用?Python conf.checkIPID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scapy.config.conf
的用法示例。
在下文中一共展示了conf.checkIPID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: answers
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPID [as 别名]
def answers(self, other):
if not isinstance(other, IP):
return 0
# Check if IP addresses match
test_IPsrc = not conf.checkIPsrc or self.src == other.src
test_IPdst = self.dst == other.dst
# Check if IP ids match
test_IPid = not conf.checkIPID or self.id == other.id
test_IPid |= conf.checkIPID and self.id == socket.htons(other.id)
# Check if IP protocols match
test_IPproto = self.proto == other.proto
if not (test_IPsrc and test_IPdst and test_IPid and test_IPproto):
return 0
return self.payload.answers(other.payload)
示例2: answers
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPID [as 别名]
def answers(self, other):
if not isinstance(other, IP):
return 0
if not ( ((conf.checkIPsrc == 0) or (self.dst == other.dst)) and
(self.src == other.src) and
( ((conf.checkIPID == 0)
or (self.id == other.id)
or (conf.checkIPID == 1 and self.id == socket.htons(other.id)))) and
(self.proto == other.proto) ):
return 0
return self.payload.answers(other.payload)