ping with python?

Rupert Kolb rupert.kolb at med.uni-tuebingen.de
Fri Feb 7 13:38:59 EST 2003


Michael Muller wrote:
> In article <mailman.1044380290.15748.python-list at python.org>, "Rupert
> Kolb" <rupert.kolb at med.uni-tuebingen.de> wrote:
> 
> 
> 
>>Hi,
>>I have to write a tool, which needs (among other things) to ping some
>>hosts.
>>The "ping" should work at linux, solaris and windows (i.e. to be
>>plattform independant).
>>In former times I usually used net::ping ;-)  Is there a plattform
>>independant "ping" in python?  Rupert Kolb
>>
> 
> 
> I've always called the ping command from os.popen().  If there is a
> python ping module out there, I'm not aware of it.  A quick search of
> parnassus doesn't reveal one.
> 
> I believe that in order to implement "ping" you need to be able to work with raw
> packets, which is only possible when running as root (the ping command is
> suid root on all of my systems).

Yes, to use the icmp protocol, you need root permissions:
the "normal" system ping uses icmp.

In net::ping you can choose "udp", "icmp" and "tcp". Only "icmp" needs 
root permissions.

Rupert






More information about the Python-list mailing list