diff options
author | Arturo FilastoĢ <hellais@torproject.org> | 2011-08-25 01:57:59 +0200 |
---|---|---|
committer | Arturo FilastoĢ <hellais@torproject.org> | 2011-08-25 01:57:59 +0200 |
commit | 2da67986a68571789172cc1f469f2d010d8128de (patch) | |
tree | 9dd26d05d27049b90cda7870bee71d5b6d5f94b3 /packages | |
parent | 817713dc33ae88217b61c73d4b9b0446a1a89855 (diff) | |
download | torouter-2da67986a68571789172cc1f469f2d010d8128de.tar.gz torouter-2da67986a68571789172cc1f469f2d010d8128de.zip |
Make the network interfaces be inside config.py
Diffstat (limited to 'packages')
-rw-r--r-- | packages/torouter-web/src/tui/config.py | 3 | ||||
-rw-r--r-- | packages/torouter-web/src/tui/controllers/network.py | 2 | ||||
-rw-r--r-- | packages/torouter-web/src/tui/utils/parsing.py | 9 |
3 files changed, 9 insertions, 5 deletions
diff --git a/packages/torouter-web/src/tui/config.py b/packages/torouter-web/src/tui/config.py index 73087f2..69ea54d 100644 --- a/packages/torouter-web/src/tui/config.py +++ b/packages/torouter-web/src/tui/config.py @@ -11,6 +11,9 @@ globals = {} # Add your own (username, password) pair authinfo = ("test", "test") +# Network devices +network_devices = ('wlan0', 'eth0', 'eth1') + #interfaces_file = os.getcwd() + "/../../torouter-prep/configs/interfaces" #torrc_file = os.getcwd() + "/../../torouter-prep/configs/torrc" torrc_file = "/var/tmp/tor-tui/torrc" diff --git a/packages/torouter-web/src/tui/controllers/network.py b/packages/torouter-web/src/tui/controllers/network.py index 6b62da7..598d332 100644 --- a/packages/torouter-web/src/tui/controllers/network.py +++ b/packages/torouter-web/src/tui/controllers/network.py @@ -81,7 +81,7 @@ class wireless: itfc.set_mac(data.mac) itfc.wifi['netmask'] = data.netmask itfc.wifi['address'] = data.address - filecontent = itfc.exclude_output("wlan0") + itfc.output(itfc.wifi) + filecontent = itfc.exclude_output(config.network_interfaces[0]) + itfc.output(itfc.wifi) files = [('/etc/network/interfaces', filecontent)] fileio.write(files) #print itfc.output(itfc.wifi) diff --git a/packages/torouter-web/src/tui/utils/parsing.py b/packages/torouter-web/src/tui/utils/parsing.py index 690d15d..310ea5c 100644 --- a/packages/torouter-web/src/tui/utils/parsing.py +++ b/packages/torouter-web/src/tui/utils/parsing.py @@ -2,6 +2,7 @@ # files, they will be used inside torouter to visualize # and edit configuration import os, re +from tui import config class interfaces: def __init__(self,filename): @@ -31,7 +32,7 @@ class interfaces: def parse_line(self, line, iface): name = line.split(" ")[0] values = " ".join(line.split(" ")[1:]).rstrip() - if iface == "wlan0": + if iface == config.network_interfaces[0]: if self.wifi.has_key(name): if type(self.wifi[name]) is list: self.wifi[name].append(values) @@ -39,7 +40,7 @@ class interfaces: self.wifi[name] = [self.wifi[name],values] else: self.wifi.update({name : values}) - elif iface == "eth1": + elif iface == config.network_interfaces[2]: if self.eth1.has_key(name): if type(self.eth1[name]) is list: self.eth1[name].append(values) @@ -47,7 +48,7 @@ class interfaces: self.eth1[name] = [self.eth1[name],values] else: self.eth1.update({name : values}) - elif iface == "eth0": + elif iface == config.network_interfaces[1]: if self.eth0.has_key(name): if type(self.eth0[name]) is list: self.eth0[name].append(values) @@ -103,7 +104,7 @@ class interfaces: # XXX currently works for one pre-up entry, must make it work also for arrays def set_mac(self, mac): - self.wifi['pre-up'] = 'ifconfig wlan0 hw ether ' + mac + self.wifi['pre-up'] = 'ifconfig ' + config.network_interfaces[0] + ' hw ether ' + mac class torrc: |