使用 scapy 嗅探数据包时出错

使用 scapy 嗅探数据包时出错
arp = ARP(pdst=ip1,psrc=ip2,op="is-at")
packet = ethernet / arp
while True:
    sendp(packet, iface=iface)
    time.sleep(10)

错误是 -

File "/home/darshan/.local/lib/python2.7/site-           packages/scapy/arch/linux.py", line 414, in __init__
self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,   socket.htons(type))
File "/usr/lib/python2.7/socket.py", line 191, in __init__
_sock = _realsocket(family, type, proto)
error: [Errno 1] Operation not permitted

我是网络新手,请帮忙。我无法调试它。

答案1

仅允许 root 打开原始套接字。用于sudo运行 Python 程序。

相关内容