當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。