sendpfast isn't working: How to include tcprelay

Viewed 457

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'
>>>
1 Answers

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.

Related