On 2006-01-23, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-01-23, Jan Danielsson <[EMAIL PROTECTED]> wrote: > >> And if I'm reading it correctly, the Perl >> script's process starts tcpdump, but redirects its output to its own >> input, and reads it line by line. > [...] >> ...however, the Perl script solution looks interresting.. Is it >> possible to do something like that in Python? > > os.popen() > > http://www.python.org/doc/current/lib/os-process.html
I should have also added that there's a module that allows you to call libpcap directly (libpcap is the library that tcpdump uses to capture packets). http://sourceforge.net/projects/pylibpcap/ It's way, way more efficient than parsing tcpdump's output. If you're only grabbing a few packets it may not matter. For some of the apps I've done, using pylibpcap has cut run-times by a factor of 10 or more. -- Grant Edwards grante Yow! Life is selling at REVOLUTIONARY HAIR visi.com PRODUCTS! -- http://mail.python.org/mailman/listinfo/python-list