Updated Get public ip address

This commit is contained in:
Rupert Edwards 2016-07-16 15:52:28 -04:00 committed by GitHub
parent 72d052725f
commit 1f80a8bf44

View file

@ -59,14 +59,14 @@ DNSPort %s
"[\033[92m+\033[0m] Anonymizer status \033[92m[ON]\033[0m")) "[\033[92m+\033[0m] Anonymizer status \033[92m[ON]\033[0m"))
print(" {0}".format("[\033[92m*\033[0m] Getting public IP, please wait ...")) print(" {0}".format("[\033[92m*\033[0m] Getting public IP, please wait ..."))
try: try:
try: my_public_ip = load(urlopen('http://jsonip.com'))['ip']
my_public_ip = load(urlopen('http://jsonip.com'))['ip'] except URLError:
except URLError: my_public_ip = None
my_public_ip = getoutput('wget -qO - v4.ifconfig.co') my_public_ip = getoutput('wget -qO - v4.ifconfig.co')
print(" {0}".format( if not my_public_ip:
"[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip)) exit(" \033[91m[!]\033[0m Can't get public ip address!")
except: print(" {0}".format(
print(" \033[91m[!]\033[0m Can't get public ip address!") "[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))
except CalledProcessError as err: except CalledProcessError as err:
print("[!] Command failed: %s" % err.cmd) print("[!] Command failed: %s" % err.cmd)