Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
urls to get ip
#1
since i have been working on a module/command to get the user's current public IP address, as the world sees it, and web queries seem to be the way to go, i have done some searching and found several with easy output (mostly JSON or a raw IP) and decided to share my list.

connected  to 'https://api.ipify.org?format=json'
response = '{"ip":"10.20.30.40"}'
connected  to 'http://jsonip.com/'
response = '{"ip":"10.20.30.40","about":"/about","Pro!":"http://getjsonip.com"}'
connected  to 'http://icanhazip.com'
response = '10.20.30.40\n'
connected  to 'http://ipinfo.io/ip'
response = '10.20.30.40\n'
connected  to 'http://whatismyip.akamai.com/'
response = '10.20.30.40'
connected  to 'http://checkip.dyndns.org/'
response = '<html><head><title>Current IP Check</title></head><body>Current IP Address: 10.20.30.40</body></html>\r\n'
connected  to 'http://ipinfo.io/json'
response = '{\n  "ip": "10.20.30.40",\n  "hostname": "host.name",\n  "city": "",\n  "region": "",\n  "country": "XX",\n  "loc": "lat,long'\
connected  to 'https://ipinfo.io/json'
response = '{\n  "ip": "10.20.30.40",\n  "hostname": "host.name",\n  "city": "",\n  "region": "",\n  "country": "XX",\n  "loc": "lat,long'\
connected  to 'https://ifconfig.co/json'
response = '{"ip":"10.20.30.40","ip_decimal":169090600,"country":"Countyname","city":"Unknown","hostname":"host.name"}'
connected  to 'https://api.ipify.org?format=json'
response = '{"ip":"10.20.30.40"}'
edit 1: show each response format like a python string literal assignment
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
http://checkip.amazonaws.com/
http://ipecho.net/plain
http://ifconfig.me
http://smart-ip.net/myip
http://www.telize.com/ip

These are from my script. I have removed the duplicated.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
thanks! i have some more, now.  but a couple of those don't work.  checkip.amazonaws.com has a bad TLS key (wrong hostname reference) and once you get around that, it redirects to a login page. telize.com is down and the main page has a link to a page that explains why.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
I didn't check them since I wrote the script to see my public address. It uses icanhazip.com and it works all the time.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
it would have been useful if translate/NAT standards had an ICMP request which required each point where the address changes to add the new address and TTL to a list in the payload and send it back as a reply when the TTL runs out.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
(Dec-31-2016, 03:31 AM)Skaperen Wrote: it would have been useful if translate/NAT standards had an ICMP request which required each point where the address changes to add the new address and TTL to a list in the payload and send it back as a reply when the TTL runs out.

Useful to hackers mostly...
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#7
i suppose so.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#8
Some fun with it,a more fancy version of "what's my ip" that all need Liar
To run what_ip
git clone https://[email protected]/snippsat/what_ip.git
# Now cd into what_ip folder
python app.py
# In browser
http://127.0.0.1:5000/
Reply
#9
(Jan-02-2017, 04:03 AM)snippsat Wrote: Some fun with it,a more fancy version of "what's my ip" that all need Liar
To run what_ip

is that the server code?  i just found the one i made in C many years ago that used a library i wrote that simplified writing daemons (maybe as much as could be done in C).  ask me for "httpaddrhtml.c" and/or "httpaddrjson.c" if you want to see the source.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#10
Quote:is that the server code?
Yes,if you new to Flask running python app.py start the build in Flask web-server.
The severer is running,then in browser http://127.0.0.1:5000/.
Need Flask and Requests pip install Flask requests
Quote: i just found the one i made in C many years ago that used a library i wrote that simplified writing daemons (maybe as much as could be done in C)
Cool Cool 
but i think a web-app is the more modern approach.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020