Created
March 13, 2023 12:44
-
-
Save theSoberSobber/45677a89756927bc48eb9923840fe1fe to your computer and use it in GitHub Desktop.
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
import socks | |
import socket | |
import requests | |
import os | |
import time | |
import json | |
import urllib2 | |
socks.setdefaultproxy(proxy_type=socks.PROXY_TYPE_SOCKS5, addr="127.0.0.1", port=9050) | |
socket.socket = socks.socksocket | |
i=0 | |
while (i <= 5): | |
try: | |
os.system("service tor restart") | |
time.sleep(10) | |
ip = requests.get("http://icanhazip.com").text | |
ipaddress= ip.encode('ascii','ignore').strip("\n") | |
print ipaddress | |
url="http://ipinfo.io/"+ipaddress+"/json" | |
print url | |
response= urllib2.urlopen(url) | |
data=json.load(response) | |
org=data['org'] | |
city = data['city'] | |
country = data['country'] | |
region = data['region'] | |
location = data['loc'] | |
print 'Your IP detail' | |
print 'IP : {4} \nRegion : {1} \nCountry : {2} \nCity : {3} \nService Provider : {0} \nLatitude,Longitude : {5}'.format( | |
org, region, country, city, ip, location) | |
print '\n##############################################\n' | |
i=i+1 | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment