(My purpose is to run tcpdump from python than exit the python script) I have to run tcpdump in remote server if i run tcp dump in generic syntax then my python program get stuck, if i run it in background then traces are not getting started just 1kb pcap file is created
ssh_client.connect(host, username=username, password=password)
stdin, stdout, stderr = ssh_client.exec_command("tcpdump -i any -w test.pcap")
# Than pcap starts at remote server but my python program gets stuck
# if i run it with background process than python program doesn't get stuck but there is no packet capture at pcap
stdin, stdout, stderr = ssh_client.exec_command("tcpdump -i any -w test.pcap &")
Hi below syntax works for me i was able to start the tcpdump & even pyhon program doesnt get stuck
stdin, stdout, stderr = ssh_client.exec_command("nohup sudo tcpdump -i any -w test.pcap >/dev/null 2>&1 &")