0

I need to execute multiple different commands to replay pcaps into my network.

The first pcap is over 100 seconds, I need to play it and then immediately play other pcaps.

My problem is, when I execute this line in my python code:

h2.cmd('tcpreplay --intf1=h2-eth0 BenignTest.pcap 10.0.0.1')

The program waits for this 100 second pcap to finish before continuing. I need the program to continue as soon as it sends that command.

Is there a way to make tcpreplay non-blocking like this?

HCF3301
  • 508
  • 1
  • 4
  • 14

1 Answers1

0

Turns out it is as simple as adding & to the end of the command.

h2.cmd('tcpreplay --intf1=h2-eth0 BenignTest.pcap 10.0.0.1 &')

& sends the command to the background and frees up the terminal being used.

https://bashitout.com/2013/05/18/Ampersands-on-the-command-line.html

HCF3301
  • 508
  • 1
  • 4
  • 14