[英]How would I make a packet sniffer in python?
I used a code snippet from stackoverflow, I can't find the post now, but this is what it was 我使用了stackoverflow的代码段,现在找不到该帖子,但这就是它的意思。
from scapy.all import *
sniff(filter="192.168.1.25", prn=lambda x:x.sprintf("{IP:%IP.src% -> %IP.dst%\n}")
I'm getting an unexpected EOF while parsing 解析时出现意外的EOF
I don't know much about scapy, nor socket. 我对船骨和插座都不了解。 I have no idea how to approach it.
我不知道该如何处理。 Can anyone provide a working example below?
谁能在下面提供一个可行的例子? I've looked all over and was unable to find one, and this topic has been dead for years
我四处张望,找不到一个,这个话题已经死了好多年了
I'm not really willing to learn socket/scapy, just want an example, something temporary, so if socket is the best, post below 我不太愿意学习套接字/ capy,只是想举个例子,一些暂时的东西,所以如果套接字是最好的,请在下面发布
this was a known Issue a year ago, try upgrading pip ,then reinstall scapy using 这是一年前的已知问题,请尝试升级pip,然后使用重新安装scapy
pip install scapy --upgrade
if this doesn't cut it. pip install scapy --upgrade
如果不切的话。
Download the developer version https://github.com/secdev/scapy/archive/master.zip you might run into different errors but this fixes you current error. 下载开发人员版本https://github.com/secdev/scapy/archive/master.zip,您可能会遇到其他错误,但这可以解决当前的错误。
Try this: 尝试这个:
from scapy.sendrecv import sniff
sniff(filter="192.168.1.25", prn=lambda x: x.sprintf("{IP:%IP.src% -> %IP.dst%\n}"))
The above post was correct, this was fixed ages ago. 上面的帖子是正确的,这是很久以前修复的。 please update against the RC versions:
请针对RC版本进行更新:
pip install scapy --pre --upgrade
Note: the --pre
enables RC versions 注意:--
--pre
启用RC版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.