urls to get ip - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html) +--- Forum: Bar (https://python-forum.io/forum-27.html) +--- Thread: urls to get ip (/thread-1396.html) |
urls to get ip - Skaperen - Dec-30-2016 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 RE: urls to get ip - wavic - Dec-30-2016 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. RE: urls to get ip - Skaperen - Dec-30-2016 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. RE: urls to get ip - wavic - Dec-30-2016 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. RE: urls to get ip - Skaperen - Dec-31-2016 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. RE: urls to get ip - Ofnuts - Jan-01-2017 (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... RE: urls to get ip - Skaperen - Jan-02-2017 i suppose so. RE: urls to get ip - snippsat - Jan-02-2017 Some fun with it,a more fancy version of "what's my ip" that all need 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/ RE: urls to get ip - Skaperen - Jan-02-2017 (Jan-02-2017, 04:03 AM)snippsat Wrote: Some fun with it,a more fancy version of "what's my ip" that all need 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. RE: urls to get ip - snippsat - Jan-02-2017 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 but i think a web-app is the more modern approach. |