I'm writing a python script that executes tcpdump through subprocess.open
Now, I want this script to not output anything to the screen(stdout), but just run silently. I've tried doing this:
ps_dump = subprocess.Popen(['tcpdump', '-U', '-w', pcapfile, 'port 53'], stdout=subprocess.PIPE)
But it still outputs these:
device eth0 entered promiscuous mode tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
device eth0 left promiscuous mode
I want to completely suppress these. If i run the script it shouldn't print anything. I read that you can suppress in linux using >/dev/null but how do I use it in the Popen command above?
Any suggestions or answer as to how to get this to work?