diff --git a/toriptables2.py b/toriptables2.py index 356859e..c310d40 100755 --- a/toriptables2.py +++ b/toriptables2.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +#! /usr/bin/env python # Written by Rupe version 2 # """ @@ -60,10 +61,12 @@ DNSPort %s try: my_public_ip = load(urlopen('http://jsonip.com'))['ip'] except URLError: - print(" \033[91m[!]\033[0m Can't get public ip address!") - else: - print(" {0}".format( - "[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip)) + my_public_ip = None + 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( + "[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip)) except CalledProcessError as err: print("[!] Command failed: %s" % err.cmd)