Update toriptables2.py
This commit is contained in:
parent
1f80a8bf44
commit
76f44f5fa6
1 changed files with 17 additions and 7 deletions
|
@ -1,5 +1,4 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
#! /usr/bin/env python
|
|
||||||
# Written by Rupe version 2
|
# Written by Rupe version 2
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
|
@ -17,6 +16,7 @@ from sys import stdout, stderr
|
||||||
from atexit import register
|
from atexit import register
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from json import load
|
from json import load
|
||||||
|
from pynotify import init, Notification
|
||||||
from urllib2 import urlopen, URLError
|
from urllib2 import urlopen, URLError
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,12 +61,14 @@ 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:
|
||||||
my_public_ip = None
|
print(" \033[91m[!]\033[0m Can't get public ip address!")
|
||||||
my_public_ip = getoutput('wget -qO - v4.ifconfig.co')
|
else:
|
||||||
if not my_public_ip:
|
print(" {0}".format(
|
||||||
exit(" \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))
|
||||||
print(" {0}".format(
|
init('toriptables2')
|
||||||
"[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))
|
my_ip = Notification("Your public IP address is %s" % my_public_ip)
|
||||||
|
my_ip.show()
|
||||||
|
|
||||||
except CalledProcessError as err:
|
except CalledProcessError as err:
|
||||||
print("[!] Command failed: %s" % err.cmd)
|
print("[!] Command failed: %s" % err.cmd)
|
||||||
|
|
||||||
|
@ -120,6 +122,14 @@ if __name__ == '__main__':
|
||||||
load_tables.flush_iptables_rules()
|
load_tables.flush_iptables_rules()
|
||||||
print(" {0}".format(
|
print(" {0}".format(
|
||||||
"[\033[93m!\033[0m] Anonymizer status \033[91m[OFF]\033[0m"))
|
"[\033[93m!\033[0m] Anonymizer status \033[91m[OFF]\033[0m"))
|
||||||
|
try:
|
||||||
|
my_real_ip = load(urlopen('http://jsonip.com'))['ip']
|
||||||
|
except URLError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
init('toriptables2')
|
||||||
|
my_own_ip = Notification("Your public IP address is %s" % my_real_ip)
|
||||||
|
my_own_ip.show()
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
Loading…
Reference in a new issue