无法导入所有模块 无法运行代码
我正在尝试运行这个简单的脚本
from scapy.all import *
# Create an IP packet
ip_packet = IP(src="192.168.1.1", dst="192.168.1.2")
# Create a TCP segment
tcp_segment = TCP(sport=1234, dport=80, flags="S", seq=1000)
# Combine the IP packet and TCP segment
packet = ip_packet / tcp_segment
# Send the packet to the destination host
send(packet)
1.尽管在代码顶部导入,但它无法识别IP和TCP方法
2. 当我运行代码时(我用我需要的特定模块替换了星号),我收到了与套接字相关的错误:
Traceback (most recent call last):
File "/home/shlomo/PycharmProjects/stbot/test_radio.py", line 13, in <module>
send(packet)
File "venv/lib/python3.11/site-packages/scapy/sendrecv.py", line 445, in send
return _send(
^^^^^^
File "venv/lib/python3.11/site-packages/scapy/sendrecv.py", line 414, in _send
socket = socket or _func(iface)(iface=iface, **kargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.11/site-packages/scapy/arch/linux.py", line 484, in __init__
self.ins = socket.socket(
^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 232, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted
Process finished with exit code 1
非常感谢您的帮助