ping with python?

Christian Tismer tismer at tismer.com
Wed Feb 5 10:38:03 EST 2003


Rupert Kolb wrote:
> Jeff Bauer wrote:
> 
>>> This page http://www.python.org/~jeremy/python.html has
>>> an implementation of ping.
>>
>>
>>
>> In addition to Jeremy's code, Matthew Cowles has also
>> written a Python implementation of ping:
>>
>>   http://www.visi.com/~mdc/pythonstuff.html
> 
> 
> Thanks for the links.
> 
> Now I have the problem, that both implementations need root permissions 
> to execute it under unix.
> (I tried the Net::Ping. There I do not have to be root, to execute a 
> ping. And I found no SUID program in the perl installation directory.)

The icmp protocol cannot be used without
root priviledges. See ping for example:

tismer at tismer:~$ ls -la $(which ping)
-rwsr-xr-x    1 root     root        15244 Nov 18  2001 /bin/ping
tismer at tismer:~$

It has the sticky bit set.
The Perl package uses the UDP protocol by default
and doesn't need root access. See

http://www.perl.com/doc/manual/html/lib/Net/Ping.html

Maybe you could verify that it really doesn't
work without root when specifying the ICMP protocol.

Unfortunately I have no idea how the Python
ping implementations must be changed to support UDP.
I could install and read Net::Ping, but I don't like to.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/






More information about the Python-list mailing list