Update toriptables2.py

This commit is contained in:
Rupert Edwards 2015-12-21 21:14:35 -05:00
parent 7f8340b540
commit b9f1c0174d

View file

@ -1,5 +1,5 @@
#! /usr/bin/env python #! /usr/bin/env python
# By Rupe # Written by Rupe version 2
""" """
Tor Iptables script is an anonymizer Tor Iptables script is an anonymizer
that sets up iptables and tor to route all services that sets up iptables and tor to route all services
@ -11,6 +11,7 @@ from commands import getoutput
from subprocess import call from subprocess import call
from os.path import isfile from os.path import isfile
from os import devnull from os import devnull
from sys import stdout, stderr
from atexit import register from atexit import register
from argparse import ArgumentParser from argparse import ArgumentParser
@ -42,7 +43,7 @@ DNSPort 53
@register @register
def restart_tor(): def restart_tor():
fnull = open(devnull, 'w') fnull = open(devnull, 'w')
call(["service", "tor", "restart"], stderr=fnull) call(["service", "tor", "restart"], stdout=fnull, stderr=fnull)
call(["iptables", "-t", "nat", "-A", "OUTPUT", "-m", "owner", "--uid-owner", call(["iptables", "-t", "nat", "-A", "OUTPUT", "-m", "owner", "--uid-owner",
"%s" % self.tor_uid, "-j", "RETURN"]) "%s" % self.tor_uid, "-j", "RETURN"])