Jump to content
Sign in to follow this  
z0ny

Retrieve public IP

Recommended Posts

Here's a command that shows your public IP, no matter whether you're behind a router: :D

 

wget -q www.whatismyip.com && grep displaycopy index.html|cut -d\' -f2 && rm -f index.html

 

z0ny

Share this post


Link to post
Share on other sites

kick ass man, thanks

Share this post


Link to post
Share on other sites

the above scrfipt doesnt seem to work anymore, perhaps because www.whatismyip.com have changed their code, (looking in index.html tells you to use a different url)

 

so i modified it slightly so now it reads

 

wget -q www.whatismyip.com/automation/n09230945.asp && cat n09230945.asp && rm -f n09230945.asp

 

which does display the ip but it's badly formatted,

 

 

[anyweb@localhost ~]$ wget -q www.whatismyip.com/automation/n09230945.asp && cat n09230945.asp && rm -f n09230945.asp

81.235.240.204[anyweb@localhost ~]$

 

so who can tidy it up ?

 

 

 

cheers

anyweb

Share this post


Link to post
Share on other sites
so who can tidy it up ?

 

$ wget -q http://www.whatismyip.com/automation/n09230945.asp -O - && echo

 

Done

Share this post


Link to post
Share on other sites

I updated the command ;)

 

elinks --dump www.whatismyip.com | grep -i "Your IP Is" | awk '{ print $4 }'

Share this post


Link to post
Share on other sites
I updated the command ;)

 

Not to sound a bit funny but why update the command when mine still works just perfectly? Also you are using the main URL which anyweb has already pointed out doesn't wish automation!

 

$ wget -q http://www.whatismyip.com/automation/n09230945.asp -O - && echo

 

Still works fine!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...