Skip to content

Commit

Permalink
Updated toriptables2.py Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ruped24 committed Jan 4, 2016
1 parent 3ddac87 commit d1eb994
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions toriptables2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from __future__ import print_function
from commands import getoutput
from subprocess import call, check_call, CalledProcessError
from os.path import isfile
from os.path import isfile, basename
from os import devnull
from sys import stdout, stderr
from atexit import register
Expand All @@ -27,12 +27,14 @@ def __init__(self):
self.trans_port = "9040" # Tor port
self.tor_config_file = '/etc/tor/torrc'
self.torrc = '''
## Inserted by %s for tor iptables rules set
## Transparently route all traffic thru tor on port %s
VirtualAddrNetwork %s
AutomapHostsOnResolve 1
TransPort %s
DNSPort %s
''' % (self.trans_port, self.virtual_net, self.trans_port, self.local_dnsport)
''' % (basename(__file__), self.trans_port, self.virtual_net,
self.trans_port, self.local_dnsport)

def flush_iptables_rules(self):
call(["iptables", "-F"])
Expand Down

0 comments on commit d1eb994

Please sign in to comment.