Updated Get ip address
This commit is contained in:
parent
6e18e80f7a
commit
60fc63b103
1 changed files with 7 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
|
#! /usr/bin/env python
|
||||||
# Written by Rupe version 2
|
# Written by Rupe version 2
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
|
@ -60,8 +61,10 @@ DNSPort %s
|
||||||
try:
|
try:
|
||||||
my_public_ip = load(urlopen('http://jsonip.com'))['ip']
|
my_public_ip = load(urlopen('http://jsonip.com'))['ip']
|
||||||
except URLError:
|
except URLError:
|
||||||
print(" \033[91m[!]\033[0m Can't get public ip address!")
|
my_public_ip = None
|
||||||
else:
|
my_public_ip = getoutput('wget -qO - v4.ifconfig.co')
|
||||||
|
if not my_public_ip:
|
||||||
|
exit(" \033[91m[!]\033[0m Can't get public ip address!")
|
||||||
print(" {0}".format(
|
print(" {0}".format(
|
||||||
"[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))
|
"[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))
|
||||||
except CalledProcessError as err:
|
except CalledProcessError as err:
|
||||||
|
|
Loading…
Reference in a new issue