Last active
April 3, 2024 12:33
-
-
Save tomac4t/7d45b848b19e3d656e0c17a075fbdc2a to your computer and use it in GitHub Desktop.
IPIP Firefox Extension API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import requests | |
import sys | |
n = len(sys.argv) | |
for i in range (1, n): | |
ipipapi = "https://btapi.ipip.net/host/info?ip=" + sys.argv[i] + "&host=&lang=cn" | |
headers = { | |
'User-Agent': 'ipip/tt', | |
'Accept-Encoding': 'gzip' | |
} | |
response = requests.get(ipipapi, headers=headers) | |
l1,l2,l3,l4,isp,lat,lng = response.json()['area'].split('\t') | |
print(sys.argv[i],l1,l2,l3,l4,isp,lat,lng,sep=',') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import requests | |
import sys | |
n = len(sys.argv) | |
for i in range (1, n): | |
ipipapi = "https://clientapi.ipip.net/browser/firefox?ip=" + sys.argv[i] | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0', | |
} | |
response = requests.get(ipipapi, headers=headers, timeout=5) | |
data = response.json()['data'] | |
print(sys.argv[i], data['country'], data['province'], data['city'], data['isp'], sep=',') |
Author
tomac4t
commented
Apr 8, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment