[Fixed] Getting Public IP, added fail-over

This commit is contained in:
Rupert Edwards 2020-05-30 11:58:26 -04:00 committed by GitHub
parent ba6082eaab
commit c506b3401c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,9 +71,11 @@ DNSPort %s
except URLError: except URLError:
sleep(5) sleep(5)
print(" [\033[93m?\033[0m] Still waiting for IP address...") print(" [\033[93m?\033[0m] Still waiting for IP address...")
except ValueError:
break
print print
if not my_public_ip: if not my_public_ip:
my_public_ip = getoutput('wget -qO - v4.ifconfig.co') my_public_ip = getoutput('wget -qO - ifconfig.me')
if not my_public_ip: if not my_public_ip:
exit(" \033[91m[!]\033[0m Can't get public ip address!") exit(" \033[91m[!]\033[0m Can't get public ip address!")
print(" {0}".format("[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip)) print(" {0}".format("[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))