当前位置: 首页>>代码示例>>Python>>正文


Python conf.checkIPsrc方法代码示例

本文整理汇总了Python中scapy.config.conf.checkIPsrc方法的典型用法代码示例。如果您正苦于以下问题:Python conf.checkIPsrc方法的具体用法?Python conf.checkIPsrc怎么用?Python conf.checkIPsrc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scapy.config.conf的用法示例。


在下文中一共展示了conf.checkIPsrc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hashret

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPsrc [as 别名]
def hashret(self):
        if ( (self.proto == socket.IPPROTO_ICMP)
             and (isinstance(self.payload, ICMP))
             and (self.payload.type in [3,4,5,11,12]) ):
            return self.payload.payload.hashret()
        else:
            if conf.checkIPsrc and conf.checkIPaddr:
                return strxor(inet_aton(self.src),inet_aton(self.dst))+struct.pack("B",self.proto)+self.payload.hashret()
            else:
                return struct.pack("B", self.proto)+self.payload.hashret() 
开发者ID:medbenali,项目名称:CyberScan,代码行数:12,代码来源:inet.py

示例2: answers

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPsrc [as 别名]
def answers(self, other):
        if not isinstance(other, TCP):
            return 0
        if conf.checkIPsrc:
            if not ((self.sport == other.dport) and
                    (self.dport == other.sport)):
                return 0
        if (abs(other.seq-self.ack) > 2+len(other.payload)):
            return 0
        return 1 
开发者ID:medbenali,项目名称:CyberScan,代码行数:12,代码来源:inet.py

示例3: answers

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPsrc [as 别名]
def answers(self, other):
        if not isinstance(other, SCTP):
            return 0
        if conf.checkIPsrc:
            if not ((self.sport == other.dport) and
                    (self.dport == other.sport)):
                return 0
        return 1 
开发者ID:secdev,项目名称:scapy,代码行数:10,代码来源:sctp.py

示例4: hashret

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPsrc [as 别名]
def hashret(self):
        if ((self.proto == socket.IPPROTO_ICMP) and
            (isinstance(self.payload, ICMP)) and
                (self.payload.type in [3, 4, 5, 11, 12])):
            return self.payload.payload.hashret()
        if not conf.checkIPinIP and self.proto in [4, 41]:  # IP, IPv6
            return self.payload.hashret()
        if self.dst == "224.0.0.251":  # mDNS
            return struct.pack("B", self.proto) + self.payload.hashret()
        if conf.checkIPsrc and conf.checkIPaddr:
            return (strxor(inet_pton(socket.AF_INET, self.src),
                           inet_pton(socket.AF_INET, self.dst)) +
                    struct.pack("B", self.proto) + self.payload.hashret())
        return struct.pack("B", self.proto) + self.payload.hashret() 
开发者ID:secdev,项目名称:scapy,代码行数:16,代码来源:inet.py

示例5: answers

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import checkIPsrc [as 别名]
def answers(self, other):
        if not isinstance(other, TCP):
            return 0
        # RST packets don't get answers
        if other.flags.R:
            return 0
        # We do not support the four-way handshakes with the SYN+ACK
        # answer split in two packets (one ACK and one SYN): in that
        # case the ACK will be seen as an answer, but not the SYN.
        if self.flags.S:
            # SYN packets without ACK are not answers
            if not self.flags.A:
                return 0
            # SYN+ACK packets answer SYN packets
            if not other.flags.S:
                return 0
        if conf.checkIPsrc:
            if not ((self.sport == other.dport) and
                    (self.dport == other.sport)):
                return 0
        # Do not check ack value for SYN packets without ACK
        if not (other.flags.S and not other.flags.A) \
           and abs(other.ack - self.seq) > 2:
            return 0
        # Do not check ack value for RST packets without ACK
        if self.flags.R and not self.flags.A:
            return 1
        if abs(other.seq - self.ack) > 2 + len(other.payload):
            return 0
        return 1 
开发者ID:secdev,项目名称:scapy,代码行数:32,代码来源:inet.py


注:本文中的scapy.config.conf.checkIPsrc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。