I am trying to read from tcpdump output using python. I am using subprocess to read from tcpdump stdout on fedora, redhat, SUSE, but actually my script doesn't work on Ubuntu. my question sounds like this questionhttp://stackoverflow.com/questions/7163877/getting-stdout-from-a-tcpdump-subprocess-after-terminating-it, but actually, I don't find a proper solution.. This is my python code:
tcp_cmd = "tcpdump -i eth2 dst 224.1.1.1"
tcp_handle = Popen(tcp_cmd,shell=True,stdout=PIPE, stderr=PIPE)
tcp_handle.terminate()
result = tcp_handle.stdout.read()`enter code here`
print result