本文整理汇总了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
示例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()
示例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
示例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
示例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()
示例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()