I remember back in '99 when Jonathan Arehart wrote:
> Hello all,
>
> I'm working on a python script at the moment that will write the date and
> location from which I log in each time I do so. However, I've not found
> an easy way to get the IP address or hostname from which I'm connecting
> that is consistent across Un*ces (Linux and FreeBSD in my case).
Maybe you can use the Python socket functions?
Python 1.5.2 (#0, Apr 16 1999, 08:36:02) [GCC egcs-2.91.66 Debian GNU/Linux (egc on
unknown
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from socket import *
>>> gethostbyaddr(gethostname())
('cesum.cesum.net', ['cesum'], ['192.168.1.2'])
>>>
You can see the limits of this, since it only gets information about
the default interface. On my machine this is ethernet, not ppp. However,
if you are only running ppp on the machine this would probably work
OK. There might be some way to specify interface, but I couldn't
find it in the library reference.
HTH
Matt
--
/* Matt Sayler -- [EMAIL PROTECTED] -- atwork?astronomy:cs
http://www.cs.utexas.edu/users/mpsayler -- (512)471-7450
Have you ever imagined a world with no hypothetical situations? */
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]