Re:Google now tells you your IP when you ask it in search
by fjarlq on Wednesday October 19, 2011 @03:31AM
(#3129136)
This works, but only accidentally:
curl --silent 'http://www.google.com/search?q=what+is+my+ip' | sed 's/.*Client IP address: //;s/).*//;q'
Google responds with HTTP error 403 (Forbidden), but it just so happens the client IP address is in the error page.
Re:Google now tells you your IP when you ask it in search
by gizzlon on Wednesday October 19, 2011 @04:30AM
(#3129248)
haha, nice one
Re:Google now tells you your IP when you ask it in search
by a3_nm on Wednesday October 19, 2011 @04:35AM
(#3129259)
Even simpler:
curl icanhazip.com
Re:Google now tells you your IP when you ask it in search
by libria on Wednesday October 19, 2011 @04:47AM
(#3129281)
also,
http://myip.dnsomatic.com
http://whatismyip.org
Re:Google now tells you your IP when you ask it in search
by sepent on Wednesday October 19, 2011 @05:03AM
(#3129318)
also,
http://tnx.nl/ip
Re:Google now tells you your IP when you ask it in search
by Nick_C on Saturday October 22, 2011 @11:25PM
(#3145094)
If your use-case is from ssh'ing in a remote box, this may be simpler:
#!/bin/sh
# example from `who - u`:
#nick pts/0 2011-07-20 20:44 . 7856 (xxxxxxx.xxxxxxxx.internode.on.net)
who -u | awk 'BEGIN {FS="[p.]"} /internode/ {print gensub("-",".","g",$6); exit}'
You might need to play around with gensub(...). Sometime `who` reports the IP as xxx-xxx-xxx-xxx and sometimes as xxx.xxx.xxx.xxx
Re:Google now tells you your IP when you ask it in search
by bostonvaulter2 on Wednesday October 19, 2011 @04:48AM
(#3129286)
I prefer 'curl ifconfig.me'
Re:Google now tells you your IP when you ask it in search
by ralph on Wednesday October 19, 2011 @05:24AM
(#3129367)
One way:
wget -Ufoo -qO- 'http://www.google.com/search?q=ip' |
sed -n '/.*Your public IP address is [^0-9]*\([0-9.]*\).*/{s//\1/p;q;}'
Re:Google now tells you your IP when you ask it in search
by eli on Wednesday October 19, 2011 @10:02AM
(#3130160)
Google really doesn't it like it when you script their search. Better to use one of the many, many services designed for this purpose. Or set one up yourself in roughly one line of code.
Re:Google now tells you your IP when you ask it in search
by ralph on Wednesday October 19, 2011 @12:05PM
(#3130744)
True, but the OP asked explicitly for it and no one else seemed to answer that question.
Re:Google now tells you your IP when you ask it in search
by nodata on Wednesday October 19, 2011 @04:24AM
(#3129238)
Or use https://ip.appspot.com/
Anyone want to take a stab at this for google's result page?