我想要以更快的速度使用send发送流量。我将scapy和tcprelay文件保存在本地文件夹中。我应该如何包含tcprelay?
[amaragra@guestshell ~]$ ls -l
total 8
drwxr-xr-x 8 root root 1024 Jan 26 07:14 scapy
drwxr-xr-x 11 root root 1024 Jan 26 07:31 tcpreplay
[amaragra@guestshell ~]$
amaragra@guestshell ~$ python
import sys
sys.path.insert(0, "scapy")
from scapy.all import *
pkt = Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/IP(src="10.1.1.1", dst="10.1.1.2")/UDP(sport=5001, dport=5002)/Raw(RandString(size=1460))
sendpfast(pkt, pps=1000, loop=10000, parse_results=1)
ERROR: Could not execute tcpreplay, is it installed?
Traceback (most recent call last):
File "scapy/scapy/sendrecv.py", line 435, in sendpfast stderr=subprocess.PIPE)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scapy/scapy/sendrecv.py", line 449, in sendpfast os.unlink(f)
OSError: [Errno 2] No such file or directory: '/tmp/scapy8arQdz'
>>>
发布于 2021-01-26 16:22:08
您可以设置
from scapy.config import conf
conf.prog.tcpreplay = "/path/to/tcpdump"
来设置可执行文件的路径,将使用。您也可以将tcpreplay
的文件夹添加到您的路径中。
https://stackoverflow.com/questions/65897590
复制相似问题