Update toriptables2.py

This commit is contained in:
Rupert Edwards 2016-01-03 22:33:56 -05:00
parent dbb0b1a41d
commit 95c7a0d3f7

View file

@ -8,7 +8,7 @@ and traffic including DNS through the tor network.
from __future__ import print_function
from commands import getoutput
from subprocess import call, check_call
from subprocess import call, check_call, CalledProcessError
from os.path import isfile
from os import devnull
from sys import stdout, stderr
@ -44,10 +44,13 @@ DNSPort 53
import sys
sys.tracebacklimit = 0
fnull = open(devnull, 'w')
try:
tor_restart = check_call(["service", "tor", "restart"],
stdout=fnull, stderr=fnull)
if tor_restart is 0:
print(" {0}".format("[\033[92m+\033[0m] Anonymizer \033[92mON\033[0m"))
except CalledProcessError as err:
print("\n[!] Command failed: %s" % err.cmd)
call(["iptables", "-t", "nat", "-A", "OUTPUT", "-m", "owner", "--uid-owner",
"%s" % self.tor_uid, "-j", "RETURN"])