ifconfig in python

alex goretoy aleksandr.goretoy at gmail.com
Tue Jan 20 07:35:56 CET 2009


ifconfig -a|grep "inet addr"|awk '{print $2}'

wget http://myip.dk&& cat index.html|grep "<div class=\"Box\""&& rm
index.html*

this wget prolly better with urllib as prevoiusly noted by Дамјан, hope this
helps...

-Alex Goretoy
http://www.alexgoretoy.com
somebodywhocarez at gmail.com


On Tue, Jan 20, 2009 at 3:42 AM, Дамјан Георгиевски <gdamjan at gmail.com>wrote:

> Something *like*  this could work:
>
>        myip = urllib2.urlopen('http://whatismyip.org/').read(<http://whatismyip.org/%27%29.read%28>
> )
>
> of course then you are depending on an external service, not a very
> reliable one even. But then again, you might create an internal service
> like that yourself.
>
> This cgi-bin shell code like this for ex:
>
> #! /bin/sh
> echo "Content-type: text/plain"
> echo
> echo "${REMOTE_ADDR}"
>
>
> --
> дамјан ( http://softver.org.mk/damjan/ )
>
> Spammers scratch here with a diamond to find my address:
> |||||||||||||||||||||||||||||||||||||||||||||||
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090120/be77220c/attachment.html>


More information about the Python-list mailing list