Traceback (most recent call last): File "D:\蜗牛学苑\pythonProject\scan-mysql.py", line 32, in <module> sniff(iface='WLAN', prn=handle_packet, filter='tcp or udp') File "D:\Program Files\Python\lib\site-packages\scapy\sendrecv.py", line 1311, in sniff sniffer._run(*args, **kwargs) File "D:\Program Files\Python\lib\site-packages\scapy\sendrecv.py", line 1254, in _run session.on_packet_received(p) File "D:\Program Files\Python\lib\site-packages\scapy\sessions.py", line 109, in on_packet_received result = self.prn(pkt) File "D:\蜗牛学苑\pythonProject\scan-mysql.py", line 8, in handle_packet if packet.haslayer(Raw) and packet[TCP].dport == 3306: File "D:\Program Files\Python\lib\site-packages\scapy\packet.py", line 1327, in __getitem__ raise IndexError("Layer [%s] not found" % name) IndexError: Layer [TCP] not found 进程已结束,退出代码1
时间: 2023-07-21 14:05:56 浏览: 179
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个错误的意思是找不到TCP层。这可能是因为你的抓包过滤器只包含了TCP或UDP,但实际上有些包可能没有这些层。你可以尝试使用更宽泛的过滤器,例如:filter='port 3306'。或者你可以使用更高级的过滤器来检查包是否包含TCP层,例如:filter='tcp and port 3306'。这样可以确保你只处理包含TCP层和端口3306的数据包。
阅读全文