Python script for tracert
Thomas Guettler
hv at tbz-pariv.de
Wed Oct 1 11:09:36 EDT 2008
Hi,
I wrote small python only script for tcptraceroute some time ago.
This works without a subprocess:
http://www.thomas-guettler.de/scripts/tcptraceroute.py.txt
Gabriel Genellina schrieb:
> En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <mailcindy at gmail.com>
> escribió:
>
>> Hello.. I'm trying to do a scripting for tracert in windows using
>> python...
>> I'm using popen(), but it displays only after the tracert is completed. i
>> want the results to be displayed for every route.
>>
>> can anyone help me in this..
>
> Use the subprocess module:
>
> import subprocess
> host = 'www.microsoft.com'
> p = subprocess.Popen(["tracert", '-d', '-w', '100', host],
> stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
> while True:
> line = p.stdout.readline()
> if not line: break
> print '-->',line,
> p.wait()
>
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
More information about the Python-list
mailing list