Question

I want to generate Wireshark/tcpdump traces at the end of a Python script, in a cap file.I looked at libcap for example but when executing the command, the script is stopped. How can I generate a cap file without suspending my intial python script? Thank you

Was it helpful?

Solution

You can start command in background:

import os
os.spawnl(os.P_NOWAIT, 'your_command')

Or:

import subprocess
process = subprocess.Popen(['your_command', 'arg1', 'arg2'])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top