How to "ping" a host ?

Andrae Muys amuys at shortech.com.au
Tue Jan 8 19:21:45 EST 2002


"Brad Clements" <bkc at Murkworks.com> wrote in message news:<3c3b3cac_5 at news.newsgroups.com>...
> This is most likely a limitation of the OS, not the script. Read the man
> page on ping for your system, you can probably figure out how to grant icmp
> socket access to a group of users.
> 
> If you're running on Windows, no problem!
> 

I prefer the term "feature" rather then "limitation" :).  Opening a
raw socket is understandably a privilaged action on most OS's. 
Whether that privilage is called root, Administrator, CAP_RAW_SOCKET,
or pretty_please_w_icing_on_top?  You still have to grant that
privilage to the process somehow.  It is generally better to grant
privilages to a program/user combination then either on their own
(although this is often achived by granting them to the program, and
controlling user execute privilages), as it is easier to control how a
program uses the privilage then a user.

The above is really just an application of the principle of
least-privilage (ie, at any given time, a process/user should only
have the privilages they require to do what they need to do).  The
solution already mentioned is to use an external ping program that can
be given the necessary privilages and called by os.system() (or
similar).

An alternative might be to connect to the echo or discard ports of the
host using a normal TCP connection (you could also use the UDP echo
port).  This dosn't require any special privilages.  Discard is
probably best, as it effectively becomes a SYN based ping, and that's
all you need.

Anything I've forgotten?

Andrae Muys



More information about the Python-list mailing list