Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
943 views
in Technique[技术] by (71.8m points)

scapy - sendpfast isn't working: How to include tcprelay

I want to send traffic using scapy at faster rates. I am keeping the scapy and tcprelay files in my local folder. how should I include the 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'
>>>
question from:https://stackoverflow.com/questions/65897590/sendpfast-isnt-working-how-to-include-tcprelay

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can set

from scapy.config import conf
conf.prog.tcpreplay = "/path/to/tcpdump"

to set the path to the executable scapy will use. You could also likely just add tcpreplay's folder to your PATH.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...