How to tell IP address of remote machine?

Tait Clarridge tait at clarridge.ca
Mon Oct 26 15:36:39 UTC 2009


On Sun, 2009-10-25 at 12:27 +0000, Timothy Murphy wrote:
> I had a little program which I ran each day
> as a cron job to mail me the IP address of a machine
> in a different country.
> I give the program sm.py below;
> I can't remember where I found it.
> 
> In any case, the program has ceased to work
> because the site heliohost seems to have gone off-line.
> 
> I wonder if anyone knows of an alternative site
> which I could substitute?
> Or an alternative program?
> 
> -------------------------------------
> SENDMAIL = "/usr/sbin/sendmail"
> import os
> import socket
> import urllib2
> import sys
> import time
> tt = time.ctime()
> response = urllib2.urlopen("http://darkstar.heliohost.org/ip.php")
> ipaddr = response.readline().split('<')[0]
> f = open("mylog.txt", "w")
> f.write(ipaddr + " " + "on" + " " + tt + "\n" )
> f.close()
> p = os.popen("%s -t -fgayleard at alice.it" % SENDMAIL, "w")
> p.write("To: gayleard at eircom.net\r\n")
> p.write("From: Timothy Murphy <gayleard at eircom.net>\r\n")
> p.write("Subject: Anghiari IP address\r\n")
> p.write("\r\n")
> p.write(ipaddr + "\r\n")
> p.close()
> sys.exit()
> -------------------------------------
> [tim at althea ~]$ sudo cat /etc/cron.daily/ip-address
> #!/bin/sh
> 
> /usr/bin/python /home/tim/sm.py
> -------------------------------------
> 

I have been using wget to check my external IP (for conky).

wget -O - http://ip.tupeux.com | tail

Should give you the output to STDOUT...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20091026/41d10c4f/attachment-0001.sig>


More information about the fedora-list mailing list