aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-10-02 16:44:03 +0200
committerficus <ficus@robocracy.org>2012-10-02 16:44:03 +0200
commitfcf6a8630b7ae818e7719d6e811d01d9359388c3 (patch)
tree81610e80263e0f326f300b1bc7ea4264df9f29ab
parent7dcf9aa0db8585eb3489bcf0903e67bdd9dee027 (diff)
downloadtorouter-fcf6a8630b7ae818e7719d6e811d01d9359388c3.zip
torouter-fcf6a8630b7ae818e7719d6e811d01d9359388c3.tar.gz
remove unused told TUI
-rw-r--r--packages/Makefile6
-rw-r--r--packages/torouter-takeover/README1
-rw-r--r--packages/torouter-web/LICENSE32
-rw-r--r--packages/torouter-web/NOTES6
-rw-r--r--packages/torouter-web/README13
-rw-r--r--packages/torouter-web/debian/README6
-rw-r--r--packages/torouter-web/debian/README.Debian8
-rw-r--r--packages/torouter-web/debian/changelog11
-rw-r--r--packages/torouter-web/debian/compat1
-rw-r--r--packages/torouter-web/debian/control13
-rw-r--r--packages/torouter-web/debian/copyright36
-rw-r--r--packages/torouter-web/debian/dirs1
-rw-r--r--packages/torouter-web/debian/postinst39
-rw-r--r--packages/torouter-web/debian/postrm37
-rw-r--r--packages/torouter-web/debian/preinst35
-rw-r--r--packages/torouter-web/debian/prerm38
-rwxr-xr-xpackages/torouter-web/debian/rules6
-rw-r--r--packages/torouter-web/debian/source/format1
-rw-r--r--packages/torouter-web/debian/torouter-tui.default10
-rw-r--r--packages/torouter-web/debian/torouter-tui.init155
-rw-r--r--packages/torouter-web/setup.py17
-rw-r--r--packages/torouter-web/src/__init__.py0
-rw-r--r--packages/torouter-web/src/daemon.py129
-rw-r--r--packages/torouter-web/src/runui.py60
-rw-r--r--packages/torouter-web/src/static/main.css56
-rw-r--r--packages/torouter-web/src/tui/__init__.py0
-rw-r--r--packages/torouter-web/src/tui/config.py21
-rw-r--r--packages/torouter-web/src/tui/controllers/__init__.py0
-rw-r--r--packages/torouter-web/src/tui/controllers/main.py27
-rw-r--r--packages/torouter-web/src/tui/controllers/network.py140
-rw-r--r--packages/torouter-web/src/tui/controllers/old/main.py11
-rw-r--r--packages/torouter-web/src/tui/controllers/old/status.py9
-rw-r--r--packages/torouter-web/src/tui/controllers/old/wizard.py81
-rw-r--r--packages/torouter-web/src/tui/controllers/tor.py59
-rw-r--r--packages/torouter-web/src/tui/models/router_config.py19
-rw-r--r--packages/torouter-web/src/tui/utils/__init__.py0
-rw-r--r--packages/torouter-web/src/tui/utils/configuration.py109
-rw-r--r--packages/torouter-web/src/tui/utils/fileio.py24
-rw-r--r--packages/torouter-web/src/tui/utils/parsing.py145
-rw-r--r--packages/torouter-web/src/tui/utils/session.py26
-rw-r--r--packages/torouter-web/src/tui/view.py14
-rw-r--r--packages/torouter-web/src/tui/views/base.html83
-rw-r--r--packages/torouter-web/src/tui/views/firewall.html7
-rw-r--r--packages/torouter-web/src/tui/views/index.html1
-rw-r--r--packages/torouter-web/src/tui/views/login.html7
-rw-r--r--packages/torouter-web/src/tui/views/logout.html1
-rw-r--r--packages/torouter-web/src/tui/views/main.html1
-rw-r--r--packages/torouter-web/src/tui/views/saved.html8
-rw-r--r--packages/torouter-web/src/tui/views/status.html3
-rw-r--r--packages/torouter-web/src/tui/views/torconfig.html11
-rw-r--r--packages/torouter-web/src/tui/views/torstatus.html5
-rw-r--r--packages/torouter-web/src/tui/views/wired.html7
-rw-r--r--packages/torouter-web/src/tui/views/wireless.html8
-rw-r--r--packages/torouter-web/src/tui/views/wizard.html12
54 files changed, 1 insertions, 1555 deletions
diff --git a/packages/Makefile b/packages/Makefile
index 875f65f..3ceff87 100644
--- a/packages/Makefile
+++ b/packages/Makefile
@@ -1,8 +1,4 @@
-debs: webdeb prepdeb mvdebs
-
-webdeb:
- # By default we will but not sign for now
- #cd torouter-web && debuild --no-tgz-check -us -uc
+debs: prepdeb mvdebs
prepdeb:
# By default we will but not sign for now
diff --git a/packages/torouter-takeover/README b/packages/torouter-takeover/README
deleted file mode 100644
index e889ed2..0000000
--- a/packages/torouter-takeover/README
+++ /dev/null
@@ -1 +0,0 @@
-This is where our debtakeover script will be packaged.
diff --git a/packages/torouter-web/LICENSE b/packages/torouter-web/LICENSE
deleted file mode 100644
index cb2a71c..0000000
--- a/packages/torouter-web/LICENSE
+++ /dev/null
@@ -1,32 +0,0 @@
-===============================================================================
-The tui code is distributed under this license:
-
-Copyright (c) 2011, Arturo Filasto'
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-
- * Neither the names of the copyright owners nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/torouter-web/NOTES b/packages/torouter-web/NOTES
deleted file mode 100644
index 83656ab..0000000
--- a/packages/torouter-web/NOTES
+++ /dev/null
@@ -1,6 +0,0 @@
-eth0 is internet
-eth1 is private network
-
-http://wiki.debian.org/NetworkConfiguration
-
-
diff --git a/packages/torouter-web/README b/packages/torouter-web/README
deleted file mode 100644
index 60e1eeb..0000000
--- a/packages/torouter-web/README
+++ /dev/null
@@ -1,13 +0,0 @@
-TUI - Tor web User Interface
-----------------------------
-
-This is the Tor web User Interface for the Torouter.
-
-It requires web.py:
- git clone git://github.com/webpy/webpy.git
-
-To start the web server run:
- python runui.py
-
-- Arturo Filasto' <hellais@torproject.org>
-
diff --git a/packages/torouter-web/debian/README b/packages/torouter-web/debian/README
deleted file mode 100644
index cda2d60..0000000
--- a/packages/torouter-web/debian/README
+++ /dev/null
@@ -1,6 +0,0 @@
-The Debian Package torouter-tui
-----------------------------
-
-This package is for the Torouter Web UI project from the Tor Project.
-
- -- Jacob Appelbaum <jacob@torproject.org> Wed, 17 Aug 2011 17:15:08 -0400
diff --git a/packages/torouter-web/debian/README.Debian b/packages/torouter-web/debian/README.Debian
deleted file mode 100644
index 27e430c..0000000
--- a/packages/torouter-web/debian/README.Debian
+++ /dev/null
@@ -1,8 +0,0 @@
-torouter for Debian
--------------------
-
-This is a package for Debian that converts a DreamPlug into a Torouter.
-
-It will configure the system without prompting the user for any input.
-
- -- Jacob Appelbaum <jacob@torproject.org> Wed, 27 Jul 2011 09:51:21 -0400
diff --git a/packages/torouter-web/debian/changelog b/packages/torouter-web/debian/changelog
deleted file mode 100644
index 3522869..0000000
--- a/packages/torouter-web/debian/changelog
+++ /dev/null
@@ -1,11 +0,0 @@
-torouter-tui (0.0.1-2) unstable; urgency=low
-
- * Fix python-daemon dependancy problem
-
- -- Bryan Newbold <bnewbold@robocracy.org> Tue, 11 Sep 2012 14:47:35 +0200
-
-torouter-tui (0.0.1-1) unstable; urgency=low
-
- * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-
- -- Jacob Appelbaum <jacob@appelbaum.net> Wed, 17 Aug 2011 16:58:00 -0400
diff --git a/packages/torouter-web/debian/compat b/packages/torouter-web/debian/compat
deleted file mode 100644
index 7f8f011..0000000
--- a/packages/torouter-web/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/packages/torouter-web/debian/control b/packages/torouter-web/debian/control
deleted file mode 100644
index 8a949ef..0000000
--- a/packages/torouter-web/debian/control
+++ /dev/null
@@ -1,13 +0,0 @@
-Source: torouter-tui
-Section: unknown
-Priority: extra
-Maintainer: Jacob Appelbaum <jacob@torproject.org>
-Build-Depends: debhelper (>= 7.0.50~), python-dev
-Standards-Version: 3.9.1
-Homepage: <https://www.torproject.org/>
-
-Package: torouter-tui
-Architecture: all
-Depends: ${misc:Depends}, python, python-webpy, python-daemon
-Description: Torouter web UI
- This package provides the Torouter web UI.
diff --git a/packages/torouter-web/debian/copyright b/packages/torouter-web/debian/copyright
deleted file mode 100644
index eeef3f2..0000000
--- a/packages/torouter-web/debian/copyright
+++ /dev/null
@@ -1,36 +0,0 @@
-Format: http://dep.debian.net/deps/dep5
-Upstream-Name: torouter
-Source: <https://www.torproject.org/>
-
-Files: *
-Copyright: 2011 Arturo Filasto' <hellais@torproject.org>
-License: BSD-3-Clause
-
-Files: debian/*
-Copyright: 2011 Jacob Appelbaum <jacob@torproject.org>
-License: BSD-3-Clause
-
-License: BSD-3-Clause
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
- .
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
diff --git a/packages/torouter-web/debian/dirs b/packages/torouter-web/debian/dirs
deleted file mode 100644
index e772481..0000000
--- a/packages/torouter-web/debian/dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin
diff --git a/packages/torouter-web/debian/postinst b/packages/torouter-web/debian/postinst
deleted file mode 100644
index 97e9113..0000000
--- a/packages/torouter-web/debian/postinst
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# postinst script for torouter
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <postinst> `configure' <most-recently-configured-version>
-# * <old-postinst> `abort-upgrade' <new version>
-# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-# <new-version>
-# * <postinst> `abort-remove'
-# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-# <failed-install-package> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- configure)
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/packages/torouter-web/debian/postrm b/packages/torouter-web/debian/postrm
deleted file mode 100644
index 632ac80..0000000
--- a/packages/torouter-web/debian/postrm
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# postrm script for torouter
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <postrm> `remove'
-# * <postrm> `purge'
-# * <old-postrm> `upgrade' <new-version>
-# * <new-postrm> `failed-upgrade' <old-version>
-# * <new-postrm> `abort-install'
-# * <new-postrm> `abort-install' <old-version>
-# * <new-postrm> `abort-upgrade' <old-version>
-# * <disappearer's-postrm> `disappear' <overwriter>
-# <overwriter-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
- ;;
-
- *)
- echo "postrm called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/packages/torouter-web/debian/preinst b/packages/torouter-web/debian/preinst
deleted file mode 100644
index 1cc598e..0000000
--- a/packages/torouter-web/debian/preinst
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# preinst script for torouter
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <new-preinst> `install'
-# * <new-preinst> `install' <old-version>
-# * <new-preinst> `upgrade' <old-version>
-# * <old-preinst> `abort-upgrade' <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- install|upgrade)
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/packages/torouter-web/debian/prerm b/packages/torouter-web/debian/prerm
deleted file mode 100644
index 4bb95dd..0000000
--- a/packages/torouter-web/debian/prerm
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-# prerm script for torouter
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <prerm> `remove'
-# * <old-prerm> `upgrade' <new-version>
-# * <new-prerm> `failed-upgrade' <old-version>
-# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
-# * <deconfigured's-prerm> `deconfigure' `in-favour'
-# <package-being-installed> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- remove|upgrade|deconfigure)
- ;;
-
- failed-upgrade)
- ;;
-
- *)
- echo "prerm called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/packages/torouter-web/debian/rules b/packages/torouter-web/debian/rules
deleted file mode 100755
index e92c9cb..0000000
--- a/packages/torouter-web/debian/rules
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-export DH_VERBOSE=1
-
-%:
- dh $@
diff --git a/packages/torouter-web/debian/source/format b/packages/torouter-web/debian/source/format
deleted file mode 100644
index 89ae9db..0000000
--- a/packages/torouter-web/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (native)
diff --git a/packages/torouter-web/debian/torouter-tui.default b/packages/torouter-web/debian/torouter-tui.default
deleted file mode 100644
index f0fa807..0000000
--- a/packages/torouter-web/debian/torouter-tui.default
+++ /dev/null
@@ -1,10 +0,0 @@
-# Defaults for torouter-web initscript
-# sourced by /etc/init.d/torouter-web
-# installed at /etc/default/torouter-web by the maintainer scripts
-
-#
-# This is a POSIX shell fragment
-#
-
-# When the package is configured - we set this accordingly
-# ARGS=""
diff --git a/packages/torouter-web/debian/torouter-tui.init b/packages/torouter-web/debian/torouter-tui.init
deleted file mode 100644
index 7b7a0a0..0000000
--- a/packages/torouter-web/debian/torouter-tui.init
+++ /dev/null
@@ -1,155 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: torouter-tui
-# Required-Start: $network $syslog
-# Required-Stop: $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: torouter-tui initscript
-# Description: This file starts the torouter-tui python web UI.
-### END INIT INFO
-
-# Author: Jacob Appelbaum <jacob@appelbaum.net>
-#
-
-# Do NOT "set -e"
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="torouter-tui python web UI"
-NAME=runui.py
-DAEMON=/usr/bin/$NAME
-DAEMON_ARGS=""
-PIDFILE=/var/run/torouter-tui.pid
-SCRIPTNAME=/etc/init.d/torouter-tui
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
-. /lib/lsb/init-functions
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
- # Return
- # 0 if daemon has been started
- # 1 if daemon was already running
- # 2 if daemon could not be started
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
- || return 1
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
- $DAEMON_ARGS \
- || return 2
- # Add code here, if necessary, that waits for the process to be ready
- # to handle requests from services started subsequently which depend
- # on this one. As a last resort, sleep for some time.
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
- # Return
- # 0 if daemon has been stopped
- # 1 if daemon was already stopped
- # 2 if daemon could not be stopped
- # other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
- RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- # Wait for children to finish too if this is a daemon that forks
- # and if the daemon is only ever run from this initscript.
- # If the above conditions are not satisfied then add some other code
- # that waits for the process to drop all resources that could be
- # needed by services started subsequently. A last resort is to
- # sleep for some time.
- start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
- [ "$?" = 2 ] && return 2
- # Many daemons don't delete their pidfiles when they exit.
- rm -f $PIDFILE
- return "$RETVAL"
-}
-
-#
-# Function that sends a SIGHUP to the daemon/service
-#
-do_reload() {
- #
- # If the daemon can reload its configuration without
- # restarting (for example, when it is sent a SIGHUP),
- # then implement that here.
- #
- start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
- return 0
-}
-
-case "$1" in
- start)
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- stop)
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
- ;;
- #reload|force-reload)
- #
- # If do_reload() is not implemented then leave this commented out
- # and leave 'force-reload' as an alias for 'restart'.
- #
- #log_daemon_msg "Reloading $DESC" "$NAME"
- #do_reload
- #log_end_msg $?
- #;;
- restart|force-reload)
- #
- # If the "reload" option is implemented then remove the
- # 'force-reload' alias
- #
- log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
-esac
-
-:
diff --git a/packages/torouter-web/setup.py b/packages/torouter-web/setup.py
deleted file mode 100644
index fe01ab8..0000000
--- a/packages/torouter-web/setup.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-from distutils.core import setup
-
-setup(name='torouter-tui',
- packages=['tui', 'tui.controllers',
- 'tui.models', 'tui.utils'],
- package_dir = {'tui': 'src/tui'},
- package_data = {'tui': ['src/tui', 'views/*html']},
- data_files = [('/usr/share/torouter-tui/static',
- ['src/static/main.css'])],
- version='0.1',
- description='Torouter Web UI',
- author='Arturo Filasto',
- author_email='hellais@torproject.org',
- url='https://www.torproject.org/',
- scripts=['src/runui.py', 'src/daemon.py'])
-
diff --git a/packages/torouter-web/src/__init__.py b/packages/torouter-web/src/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/packages/torouter-web/src/__init__.py
+++ /dev/null
diff --git a/packages/torouter-web/src/daemon.py b/packages/torouter-web/src/daemon.py
deleted file mode 100644
index 4ccc15c..0000000
--- a/packages/torouter-web/src/daemon.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env python
-
-import sys, os, time, atexit
-from signal import SIGTERM
-
-class Daemon:
- """
- A generic daemon class.
-
- Usage: subclass the Daemon class and override the run() method
- """
- def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
- self.stdin = stdin
- self.stdout = stdout
- self.stderr = stderr
- self.pidfile = pidfile
-
- def daemonize(self):
- """
- do the UNIX double-fork magic, see Stevens' "Advanced
- Programming in the UNIX Environment" for details (ISBN 0201563177)
- http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
- """
- try:
- pid = os.fork()
- if pid > 0:
- # exit first parent
- sys.exit(0)
- except OSError, e:
- sys.stderr.write("fork #1 failed: %d (%s)\n" % (e.errno, e.strerror))
- sys.exit(1)
-
- # decouple from parent environment
- #os.chdir("/")
- os.setsid()
- os.umask(0)
-
- # do second fork
- try:
- pid = os.fork()
- if pid > 0:
- # exit from second parent
- sys.exit(0)
- except OSError, e:
- sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror))
- sys.exit(1)
-
- # redirect standard file descriptors
- sys.stdout.flush()
- sys.stderr.flush()
- si = file(self.stdin, 'r')
- so = file(self.stdout, 'a+')
- se = file(self.stderr, 'a+', 0)
- os.dup2(si.fileno(), sys.stdin.fileno())
- os.dup2(so.fileno(), sys.stdout.fileno())
- os.dup2(se.fileno(), sys.stderr.fileno())
-
- # write pidfile
- atexit.register(self.delpid)
- pid = str(os.getpid())
- file(self.pidfile,'w+').write("%s\n" % pid)
-
- def delpid(self):
- os.remove(self.pidfile)
-
- def start(self):
- """
- Start the daemon
- """
- # Check for a pidfile to see if the daemon already runs
- try:
- pf = file(self.pidfile,'r')
- pid = int(pf.read().strip())
- pf.close()
- except IOError:
- pid = None
-
- if pid:
- message = "pidfile %s already exist. Daemon already running?\n"
- sys.stderr.write(message % self.pidfile)
- sys.exit(1)
-
- # Start the daemon
- self.daemonize()
- self.run()
-
- def stop(self):
- """
- Stop the daemon
- """
- # Get the pid from the pidfile
- try:
- pf = file(self.pidfile,'r')
- pid = int(pf.read().strip())
- pf.close()
- except IOError:
- pid = None
-
- if not pid:
- message = "pidfile %s does not exist. Daemon not running?\n"
- sys.stderr.write(message % self.pidfile)
- return # not an error in a restart
-
- # Try killing the daemon process
- try:
- while 1:
- os.kill(pid, SIGTERM)
- time.sleep(0.1)
- except OSError, err:
- err = str(err)
- if err.find("No such process") > 0:
- if os.path.exists(self.pidfile):
- os.remove(self.pidfile)
- else:
- print str(err)
- sys.exit(1)
-
- def restart(self):
- """
- Restart the daemon
- """
- self.stop()
- self.start()
-
- def run(self):
- """
- You should override this method when you subclass Daemon. It will be called after the process has been
- daemonized by start() or restart().
- """
diff --git a/packages/torouter-web/src/runui.py b/packages/torouter-web/src/runui.py
deleted file mode 100644
index 87c6626..0000000
--- a/packages/torouter-web/src/runui.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-# tui - Tor web UI
-# by Arturo Filasto' <hellais@torproject.org>
-#
-
-import sys, time, os
-from daemon import Daemon
-import web
-from tui import config
-import tui.controllers
-
-from tui.utils import session
-from tui.view import render
-
-# This is the main structure of URLs
-urls = (
- '/', 'tui.controllers.main.index',
-# '/config/(tor|router)', 'tui.controllers.main.config',
- '/network', 'tui.controllers.network.main',
- '/network/firewall', 'tui.controllers.network.firewall',
- '/network/wireless', 'tui.controllers.network.wireless',
- '/network/wired', 'tui.controllers.network.wired',
- '/network/status', 'tui.controllers.network.status',
- '/tor', 'tui.controllers.tor.status',
- '/tor/config', 'tui.controllers.tor.torrc',
- '/logout', 'tui.controllers.main.logout'
- )
-# '/wizard/([0-9a-f]{1,2})?', 'tui.controllers.wizard.step',
-# '/status', 'tui.controllers.status')
-
-app = web.application(urls, globals())
-# add session management to the app
-session.add_session_to_app(app)
-app.internalerror = web.debugerror
-
-class TorWebDaemon(Daemon):
- def run(self):
- app.run()
-
-DEBUG = False
-if __name__ == "__main__":
- if DEBUG:
- app.run()
- service = TorWebDaemon('/tmp/tui.pid')
- if len(sys.argv) == 2:
- if 'start' == sys.argv[1]:
- sys.argv[1] = '8080'
- service.start()
- elif 'stop' == sys.argv[1]:
- service.stop()
- elif 'restart' == sys.argv[1]:
- service.restart()
- else:
- print "Unknown command"
- sys.exit(2)
- sys.exit(0)
- else:
- print "starting daemon..."
- service.start()
-
diff --git a/packages/torouter-web/src/static/main.css b/packages/torouter-web/src/static/main.css
deleted file mode 100644
index 7277912..0000000
--- a/packages/torouter-web/src/static/main.css
+++ /dev/null
@@ -1,56 +0,0 @@
-
-/* Clear all */
-body { margin: 0;border: 0;padding: 0; }
-
-div.wrapper {
- min-height: 300px;
- width: 800px;
- margin: 0 auto;
-}
-
-div.footer {
- text-align: center;
- background-color: #333;
- color: white;
- padding-top: 20px;
- padding-bottom: 20px;
-}
-
-div.header {
- color: white;
-}
-
-div.header ul {
- list-style: none;
- height: 20px;
-}
-
-div.header ul li {
- font-size: 20px;
- float: left;
- padding: 5px 10px;
-}
-
-div.header ul#submenu li {
- font-size: 15px;
-}
-
-div.header ul#submenu li a.sel {
- color: black;
- text-decoration: none;
-}
-
-/* More specific stuff */
-#torrc {
-list-style: none;
-line-height: 2em;
-}
-
-#torrc em {
-font-weight: bold;
-font-style: normal;
-}
-
-
-
-
diff --git a/packages/torouter-web/src/tui/__init__.py b/packages/torouter-web/src/tui/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/packages/torouter-web/src/tui/__init__.py
+++ /dev/null
diff --git a/packages/torouter-web/src/tui/config.py b/packages/torouter-web/src/tui/config.py
deleted file mode 100644
index 989c102..0000000
--- a/packages/torouter-web/src/tui/config.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# tui, Tor web UI
-# by Arturo Filasto' <hellais@torproject.org>
-#
-
-import web, os
-
-cache = False
-
-globals = {}
-
-# Add your own (username, password) pair
-authinfo = ("test", "test")
-
-# Network devices
-network_devices = ('uap0', '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"
-interfaces_file = "/var/tmp/tor-tui/interfaces"
-
diff --git a/packages/torouter-web/src/tui/controllers/__init__.py b/packages/torouter-web/src/tui/controllers/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/packages/torouter-web/src/tui/controllers/__init__.py
+++ /dev/null
diff --git a/packages/torouter-web/src/tui/controllers/main.py b/packages/torouter-web/src/tui/controllers/main.py
deleted file mode 100644
index fb925d3..0000000
--- a/packages/torouter-web/src/tui/controllers/main.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import web
-from tui import config
-from tui import view
-from tui.view import render
-from tui.utils import session
-
-"""
-The main page for network configuration
-"""
-class index:
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.index())
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.check_login(web.input()) == 0:
- return render.base(render.index())
- else:
- return render.base(render.login())
-
-class logout:
- def GET(self):
- session.logout()
- return render.base(render.logout())
-
diff --git a/packages/torouter-web/src/tui/controllers/network.py b/packages/torouter-web/src/tui/controllers/network.py
deleted file mode 100644
index 598d332..0000000
--- a/packages/torouter-web/src/tui/controllers/network.py
+++ /dev/null
@@ -1,140 +0,0 @@
-import web
-from tui import config
-from tui import view
-from tui.view import render
-from tui.utils import session, configuration, parsing, fileio
-
-"""
-This function is used to generate the network
-submenus.
-"""
-def menu(n):
- a = []
- for i in range(0,5):
- if i == n:
- a.append("sel")
- else:
- a.append("")
- print a
- return """<ul id="submenu">
- <li><a href="/network" class="%s">Main</a></li>
- <li><a href="/network/firewall" class="%s">Firewall</a></li>
- <li><a href="/network/wireless" class="%s">Wireless</a></li>
- <li><a href="/network/wired" class="%s">Wired</a></li>
- <li><a href="/network/status" class="%s">Status</a></li>
-</ul>
-""" % tuple(a)
-
-"""
-The main page for network configuration
-"""
-class main:
- # XXX do all the backend stuff
- def update_config(self, data):
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.main(),menu(0))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- return render.base(render.main(),menu(0))
- else:
- return render.base(render.login())
-
-"""
-The firewall configuration page
-"""
-class firewall:
- # XXX do all the backend stuff
- def update_config(self, data):
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.firewall(configuration.get_form("firewall")),menu(1))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- return render.base(render.firewall(configuration.get_form("firewall")),menu(1))
- else:
- return render.base(render.login())
-
-
-
-"""
-Wireless network configuration page
-"""
-class wireless:
- # XXX do all the backend stuff
- def update_config(self, data):
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
- itfc.set_ssid(data.essid)
- itfc.set_mac(data.mac)
- itfc.wifi['netmask'] = data.netmask
- itfc.wifi['address'] = data.address
- 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)
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.wireless(configuration.get_form("wireless")),menu(2))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- print web.input()
- return render.base(render.saved(web.input()),menu(2))
- else:
- return render.base(render.login())
-
-"""
-Wired network configuration page
-"""
-class wired:
- # XXX do all the backend stuff
- def update_config(self, data):
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.wired(configuration.get_form("wired")),menu(3))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- return render.base(render.wired(),menu(3))
- else:
- return render.base(render.login())
-
-"""
-General status page, displays a bit more detail than main
-"""
-class status:
- def GET(self):
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
- network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1)
- return render.base(render.status(network),menu(4))
-
- def POST(self):
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
- network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1)
- return render.base(render.status(),menu(4))
-
diff --git a/packages/torouter-web/src/tui/controllers/old/main.py b/packages/torouter-web/src/tui/controllers/old/main.py
deleted file mode 100644
index 9127e72..0000000
--- a/packages/torouter-web/src/tui/controllers/old/main.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import web
-
-
-class index:
- def GET(self):
- return "index"
-
-class config:
- def GET(self):
- return "config"
-
diff --git a/packages/torouter-web/src/tui/controllers/old/status.py b/packages/torouter-web/src/tui/controllers/old/status.py
deleted file mode 100644
index 05f0bf8..0000000
--- a/packages/torouter-web/src/tui/controllers/old/status.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import web
-import config
-
-from config import views
-from web import form
-
-class status:
- def GET():
- print "status"
diff --git a/packages/torouter-web/src/tui/controllers/old/wizard.py b/packages/torouter-web/src/tui/controllers/old/wizard.py
deleted file mode 100644
index 7b82df2..0000000
--- a/packages/torouter-web/src/tui/controllers/old/wizard.py
+++ /dev/null
@@ -1,81 +0,0 @@
-import web
-
-from web import form
-from config import view
-
-class step:
- cur_step = 1
- next_step = 2
- wiztext = []
- wizform = []
-
- wiztext.append("Tor Configuration")
- wizform.append(form.Form(
- form.Textbox('Nickname',
- form.notnull, description="Relay Nickname"),
- form.Textbox('RelayBandwidthRate',
- form.notnull, description="Relay Bandwidth Rate"),
- form.Textbox('RelayBandwidthBurst',
- form.notnull, description="Relay Bandwidth Burst"),
- form.Textbox('ContactInfo',
- form.notnull, description="Contact Info"),
- form.Textbox('ExitPolicy',
- form.notnull, description="Exit Policy"),
- form.Button('Next Step')
- ))
-
- wiztext.append("Wireless setup")
- wizform.append(form.Form(
- form.Textbox('essid',
- form.notnull, description="Wireless ESSID"),
- form.Textbox('mac',
- form.notnull, description="MAC address"),
- form.Textbox('whatever',
- form.notnull, description="Wireless ESSID"),
- form.Button('Next Step')
- ))
-
- wiztext.append("")
- wizform.append(form.Form(
- form.Textbox('essid',
- form.notnull, description="Wireless ESSID"),
- form.Textbox('mac',
- form.notnull, description="MAC address"),
- form.Textbox('whatever',
- form.notnull, description="Wireless ESSID"),
- form.Button('Next Step')
- ))
-
- wiztext.append("")
- wizform.append(form.Form(
- form.Textbox('essid',
- form.notnull, description="Wireless ESSID"),
- form.Textbox('mac',
- form.notnull, description="MAC address"),
- form.Textbox('whatever',
- form.notnull, description="Wireless ESSID"),
- form.Button('Next Step')
- ))
-
- def GET(self, step):
- if step:
- self.cur_step = int(step)
- self.next_step = int(step) + 1
- else:
- self.cur_step = 1
- self.next_step = 2
- if len(self.wizform) < int(self.cur_step):
- return "Done!"
- return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step)
-
- def POST(self, step):
- x = web.input()
- self.cur_step = int(step)
- self.next_step = int(step) + 1
- if len(self.wizform) < int(self.cur_step):
- return "Done!"
- return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step)
-
-
-
-
diff --git a/packages/torouter-web/src/tui/controllers/tor.py b/packages/torouter-web/src/tui/controllers/tor.py
deleted file mode 100644
index e671d80..0000000
--- a/packages/torouter-web/src/tui/controllers/tor.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import web
-from tui import config
-from tui import view
-from tui.view import render
-from tui.utils import session, parsing, fileio
-
-"""
-The main Tor status page
-"""
-class status:
- def GET(self):
- if session.is_logged() > 0:
- trc = parsing.torrc(config.torrc_file)
- trc.parse()
- output = trc.html_output()
- return render.base(render.torstatus(output,config.torrc_file))
- else:
- return render.base(render.login())
-
-
- def POST(self):
- if session.is_logged() > 0:
- trc = parsing.torrc(config.torrc_file)
- trc.parse()
- output = trc.html_output()
- return render.base(render.torstatus(output,config.torrc_file))
- else:
- return render.base(render.login())
-
-"""
-Tor configuration page
-"""
-class torrc:
- def update_config(self, data):
- # Now it will just write to /tmp/torrc
- files = [('/tmp/torrc',data.torrc)]
- fileio.write(files)
-
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- trc = parsing.torrc(config.torrc_file)
- output = trc.output()
- return render.base(render.torconfig(output))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- trc = parsing.torrc(config.torrc_file)
- trc.parse()
- output = trc.html_output()
- return render.base(render.torstatus(output,config.torrc_file))
- else:
- return render.base(render.login())
-
-
diff --git a/packages/torouter-web/src/tui/models/router_config.py b/packages/torouter-web/src/tui/models/router_config.py
deleted file mode 100644
index a9bd975..0000000
--- a/packages/torouter-web/src/tui/models/router_config.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import web
-from tui.config import db
-
-def new_config(conf):
- db.insert('router_config',
- essid=conf['essid'],
- field1=conf['field1'],
- field2=conf['field2']
- )
-
-
-def write_config():
- db.update('router_config',
- essid=conf['essid'],
- field1=conf['field1'],
- field2=conf['field2']
- )
-
-
diff --git a/packages/torouter-web/src/tui/utils/__init__.py b/packages/torouter-web/src/tui/utils/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/packages/torouter-web/src/tui/utils/__init__.py
+++ /dev/null
diff --git a/packages/torouter-web/src/tui/utils/configuration.py b/packages/torouter-web/src/tui/utils/configuration.py
deleted file mode 100644
index 336aa54..0000000
--- a/packages/torouter-web/src/tui/utils/configuration.py
+++ /dev/null
@@ -1,109 +0,0 @@
-import web
-import re
-from tui.utils import parsing
-from tui import config
-
-def get(name):
- conf = {}
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
-
- if name == "wireless":
- conf['essid'] = "tor"
- conf['mac'] = "00:11:22:33:44:55"
- for entry in itfc.wifi['post-up']:
- if re.search("sys_cfg_ssid", entry):
- conf['essid'] = entry.split(" ")[2].split("\"")[1]
-
- if type(itfc.wifi['pre-up']) is str:
- conf['mac'] = itfc.wifi['pre-up'].split(" ")[4]
- else:
- for entry in itfc.wifi['pre-up']:
- if re.search("ether", entry):
- print "hahah"
- conf['mac'] = entry.split(" ")[4]
-
- conf['netmask'] = itfc.wifi['netmask']
- conf['address'] = itfc.wifi['address']
- conf['encryption'] = "open"
- conf['key'] = ""
- return conf
- elif name == "firewall":
- conf['el1'] = "Element 1"
- conf['el2'] = "Element 2"
- conf['el3'] = "Element 3"
- return conf
- elif name == "wired":
- conf['el1'] = "Element 1"
- conf['el2'] = "Element 2"
- conf['el3'] = "Element 3"
- return conf
- elif name == "tor":
- conf['el1'] = "Element 1"
- conf['el2'] = "Element 2"
- conf['el3'] = "Element 3"
- return conf
-
-def write(name, data):
- if name == "wireless":
- return True
- elif name == "firewall":
- return True
- elif name == "wired":
- return True
- elif name == "tor":
- return True
-
-def get_form(name):
- # Also these are just skeletons
- if name == "wireless":
- c = get(name)
- return web.form.Form(
- web.form.Textbox(name='essid',
- description='ESSID', value=c['essid']),
- web.form.Textbox(name='mac',
- description='MAC address', value=c['mac']),
- web.form.Textbox(name='address',
- description='IP address', value=c['address']),
- web.form.Textbox(name='netmask',
- description='Netmask address', value=c['netmask']),
- web.form.Dropdown(name='enctype', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'],
- description='Encryption scheme', value=c['encryption']),
- web.form.Password(name='key',
- description='Key', value=c['key']),
- web.form.Button('save')
- )
- elif name == "firewall":
- c = get(name)
- return web.form.Form(
- web.form.Textbox(name='el1',
- description='The first element', value=c['el2']),
- web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'],
- description='The second selement', value=c['el2']),
- web.form.Password(name='el3',
- description='The third element', value=c['el3']),
- web.form.Button('save')
- )
- elif name == "wired":
- c = get(name)
- return web.form.Form(
- web.form.Textbox(name='el1',
- description='The first element', value=c['el2']),
- web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'],
- description='The second selement', value=c['el2']),
- web.form.Password(name='el3',
- description='The third element', value=c['el3']),
- web.form.Button('save')
- )
- elif name == "tor":
- c = get(name)
- return web.form.Form(
- web.form.Textbox(name='el1',
- description='The first element', value=c['el2']),
- web.form.Dropdown(name='el2', args=['WPA2', 'WPA', 'WEP (not reccomended)', 'open'],
- description='The second selement', value=c['el2']),
- web.form.Password(name='el3',
- description='The third element', value=c['el3']),
- web.form.Button('save')
- )
-
diff --git a/packages/torouter-web/src/tui/utils/fileio.py b/packages/torouter-web/src/tui/utils/fileio.py
deleted file mode 100644
index c6574b7..0000000
--- a/packages/torouter-web/src/tui/utils/fileio.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import os
-
-def write(files):
- tmp_dir = "/var/tmp/tor-tui/"
- tmpfiles = []
- for file in files:
- if not os.path.exists(tmp_dir):
- os.mkdir(tmp_dir)
- tmpfile = tmp_dir + file[0].split("/")[-1:][0]
- tmpfiles.append((tmpfile,file[0]))
- # open the tmp file for write
- f = open(tmpfile, 'w')
- # write the data (file[1]) to the temp file
- f.write(file[1])
- f.close()
-
- # rename all the file. This operation is atomic
- #for file in tmpfiles:
- # os.rename(file[0], file[1])
-
-# for testing
-#files = [('/tmp/file1','blablbal'),('/tmp/file2','The content'),('/tmp/file3','The content 3')]
-#write(files)
-
diff --git a/packages/torouter-web/src/tui/utils/parsing.py b/packages/torouter-web/src/tui/utils/parsing.py
deleted file mode 100644
index 310ea5c..0000000
--- a/packages/torouter-web/src/tui/utils/parsing.py
+++ /dev/null
@@ -1,145 +0,0 @@
-# These functions are for parsing /etc/network/interface
-# 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):
- self.filename = filename
- try:
- self.fp = open(filename, "r")
- except:
- # this will happen on our first run or at reboot
- self.fp = open("/etc/tor/torrc", "r")
- self.wifi = {}
- self.eth1 = {}
- self.eth0 = {}
-
- def exclude_output(self, iexclude):
- iface = None
- output = ""
- self.fp = open(self.filename, "r")
- for line in self.fp.readlines():
- if line.lstrip().startswith("iface"):
- iface = line.split(" ")[1]
- if iface == iexclude:
- continue
- else:
- output += line
- return output
-
- def parse_line(self, line, iface):
- name = line.split(" ")[0]
- values = " ".join(line.split(" ")[1:]).rstrip()
- if iface == config.network_interfaces[0]:
- if self.wifi.has_key(name):
- if type(self.wifi[name]) is list:
- self.wifi[name].append(values)
- else:
- self.wifi[name] = [self.wifi[name],values]
- else:
- self.wifi.update({name : values})
- elif iface == config.network_interfaces[2]:
- if self.eth1.has_key(name):
- if type(self.eth1[name]) is list:
- self.eth1[name].append(values)
- else:
- self.eth1[name] = [self.eth1[name],values]
- else:
- self.eth1.update({name : values})
- elif iface == config.network_interfaces[1]:
- if self.eth0.has_key(name):
- if type(self.eth0[name]) is list:
- self.eth0[name].append(values)
- else:
- self.eth0[name] = [self.eth0[name],values]
- else:
- self.eth0.update({name : values})
-
- def parse(self):
- iface = None
- for line in self.fp.readlines():
- line = line.lstrip()
- if line.startswith("#") or line == "":
- continue
- if line.startswith("iface"):
- iface = line.split(" ")[1]
- if iface:
- self.parse_line(line, iface)
-
- def html_output(self, data):
- output = "<h3>Interface %s</h3>\n" % data['iface'].split(" ")[0]
- output += "<table class=\"interface\" id=\"%s\">\n" % data['iface'].split(" ")[0]
-
- for item in data.items():
- if item[0] != "iface":
- if type(item[1]) is list:
- for i in item[1]:
- output += "<tr><td>%s</td><td>%s</td></tr>\n" % (item[0], i)
- else:
- output += "<tr><td>%s</td><td>%s</td></tr>\n" % (item[0],item[1])
- output += "</table>"
- print output
- return output
-
- def output(self, data):
- output = "iface %s\n" % data['iface']
- for item in data.items():
- if item[0] != "iface":
- if type(item[1]) is list:
- for i in item[1]:
- output += item[0] + " " + i + "\n"
- else:
- output += item[0] + " " + item[1] + "\n"
- return output
-
- def set_ssid(self, essid):
- i = 0
- for entry in self.wifi['post-up']:
- if re.search("sys_cfg_ssid", entry):
- print essid
- self.wifi['post-up'][i] = '/usr/bin/uaputl sys_cfg_ssid "' + essid + '"'
- i += 1
-
- # 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 ' + config.network_interfaces[0] + ' hw ether ' + mac
-
-
-class torrc:
- def __init__(self,filename):
- self.fp = open(filename, "r")
- self.parsed = []
-
- def parse(self):
- for line in self.fp.readlines():
- line = line.lstrip()
- if line.startswith("#") or line == "":
- continue
- else:
- self.parsed.append(line)
-
- def output(self):
- output = ""
- for line in self.fp.readlines():
- print line
- output += line
- return output
-
- def html_output(self):
- output = "<ul id=\"torrc\">"
- for line in self.parsed:
- if line != "\n":
- output += "<li><em>%s</em> %s</li>" % (line.split(" ")[0], " ".join(line.split(" ")[1:]))
- output += "</ul>"
- print output
- return output
-
-#interfaces_file = os.getcwd() + "/../../../torouter-prep/configs/interfaces"
-#itfc = interfaces(interfaces_file)
-#itfc.parse()
-#itfc.html_output(itfc.wifi)
-#itfc.html_output(itfc.eth1)
-#itfc.html_output(itfc.eth0)
-
diff --git a/packages/torouter-web/src/tui/utils/session.py b/packages/torouter-web/src/tui/utils/session.py
deleted file mode 100644
index 4570196..0000000
--- a/packages/torouter-web/src/tui/utils/session.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import web
-from tui import config
-
-# The main session class
-
-def add_session_to_app(app):
-
- if web.config.get("_session") is None:
- store = web.session.DiskStore('sessions')
- session = web.session.Session(app, store, initializer={'login': 0, 'privilege': 0})
- web.config._session = session
- else:
- session = web.config._session
-
-def is_logged():
- return web.config._session.login
-
-def check_login(data):
- if (data.user == config.authinfo[0]) and (data.password == config.authinfo[1]):
- web.config._session.login = 1
- return 0
- return 1
-
-def logout():
- web.config._session.kill()
-
diff --git a/packages/torouter-web/src/tui/view.py b/packages/torouter-web/src/tui/view.py
deleted file mode 100644
index ea885be..0000000
--- a/packages/torouter-web/src/tui/view.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import os
-import web
-from tui import config
-
-t_globals = dict(
- datestr=web.datestr,
- )
-
-# get the path where the script currently resides
-current_path = "/".join(os.path.abspath(__file__).split("/")[:-1])
-# create the render object
-render = web.template.render(current_path+'/views', cache=config.cache, globals=t_globals)
-render._keywords['globals']['render'] = render
-
diff --git a/packages/torouter-web/src/tui/views/base.html b/packages/torouter-web/src/tui/views/base.html
deleted file mode 100644
index 5db0249..0000000
--- a/packages/torouter-web/src/tui/views/base.html
+++ /dev/null
@@ -1,83 +0,0 @@
-$def with (page,submenu=None)
-
-<!html>
-
-<html>
-<head>
- <title>TUI - Tor Web User Interface</title>
-<style type="text/css">
-/* Clear all */
-body { margin: 0;border: 0;padding: 0; }
-
-div.wrapper {
- min-height: 300px;
- width: 800px;
- margin: 0 auto;
-}
-
-div.footer {
- text-align: center;
- background-color: #333;
- color: white;
- padding-top: 20px;
- padding-bottom: 20px;
-}
-
-div.header {
- color: white;
-}
-
-div.header ul {
- list-style: none;
- height: 20px;
-}
-
-div.header ul li {
- font-size: 20px;
- float: left;
- padding: 5px 10px;
-}
-
-div.header ul#submenu li {
- font-size: 15px;
-}
-
-div.header ul#submenu li a.sel {
- color: black;
- text-decoration: none;
-}
-
-/* More specific stuff */
-#torrc {
-list-style: none;
-line-height: 2em;
-}
-
-#torrc em {
-font-weight: bold;
-font-style: normal;
-}
-</style>
-<!-- link REL="stylesheet" href="/static/main.css" type="text/css" -->
-</head>
-<body>
-<div class="header">
- <ul id="menu">
- <li><a href="/">Home</a></li>
- <li><a href="/network">Network</a></li>
- <li><a href="/tor">Tor</a></li>
- <li><a href="/logout">logout</a></li>
- </ul>
- $:submenu
-</div>
-
-<div class="wrapper">
-$:page
-</div>
-
-<div class="footer">
-2011 - The Tor Project
-</div>
-
-</body>
-</html>
diff --git a/packages/torouter-web/src/tui/views/firewall.html b/packages/torouter-web/src/tui/views/firewall.html
deleted file mode 100644
index 30f5a9b..0000000
--- a/packages/torouter-web/src/tui/views/firewall.html
+++ /dev/null
@@ -1,7 +0,0 @@
-$def with (form)
-
-<h2>Firewall configuration page</h2>
-
-<form action="" method="POST">
-$:form.render()
-</form>
diff --git a/packages/torouter-web/src/tui/views/index.html b/packages/torouter-web/src/tui/views/index.html
deleted file mode 100644
index 3907d84..0000000
--- a/packages/torouter-web/src/tui/views/index.html
+++ /dev/null
@@ -1 +0,0 @@
-The main index
diff --git a/packages/torouter-web/src/tui/views/login.html b/packages/torouter-web/src/tui/views/login.html
deleted file mode 100644
index 1377078..0000000
--- a/packages/torouter-web/src/tui/views/login.html
+++ /dev/null
@@ -1,7 +0,0 @@
-Login is required
-<form method="POST" action="/">
- Login: <input type="text" name="user">
- Password: <input type="password" name="password">
- <input type="submit" name="login">
-</form>
-
diff --git a/packages/torouter-web/src/tui/views/logout.html b/packages/torouter-web/src/tui/views/logout.html
deleted file mode 100644
index f027ed4..0000000
--- a/packages/torouter-web/src/tui/views/logout.html
+++ /dev/null
@@ -1 +0,0 @@
-Successfully logged out!
diff --git a/packages/torouter-web/src/tui/views/main.html b/packages/torouter-web/src/tui/views/main.html
deleted file mode 100644
index dc503e7..0000000
--- a/packages/torouter-web/src/tui/views/main.html
+++ /dev/null
@@ -1 +0,0 @@
-the main page
diff --git a/packages/torouter-web/src/tui/views/saved.html b/packages/torouter-web/src/tui/views/saved.html
deleted file mode 100644
index ba14488..0000000
--- a/packages/torouter-web/src/tui/views/saved.html
+++ /dev/null
@@ -1,8 +0,0 @@
-$def with (content)
-
-<ul>
-
-$for i in content.items():
- <li><em>$i[0]</em>: $i[1]</li>
-
-</ul>
diff --git a/packages/torouter-web/src/tui/views/status.html b/packages/torouter-web/src/tui/views/status.html
deleted file mode 100644
index bfe2fcd..0000000
--- a/packages/torouter-web/src/tui/views/status.html
+++ /dev/null
@@ -1,3 +0,0 @@
-$def with (content)
-
-$:content
diff --git a/packages/torouter-web/src/tui/views/torconfig.html b/packages/torouter-web/src/tui/views/torconfig.html
deleted file mode 100644
index 223c339..0000000
--- a/packages/torouter-web/src/tui/views/torconfig.html
+++ /dev/null
@@ -1,11 +0,0 @@
-$def with (content)
-
-<form method="POST" action="/tor/config" enctype="multipart/form-data">
-<ul>
-<li><textarea cols="100" rows="50" name="torrc">
-$:content
-</textarea></li>
-<li><input type="submit" name="save"></li>
-</ul>
-</form>
-
diff --git a/packages/torouter-web/src/tui/views/torstatus.html b/packages/torouter-web/src/tui/views/torstatus.html
deleted file mode 100644
index a2eeacf..0000000
--- a/packages/torouter-web/src/tui/views/torstatus.html
+++ /dev/null
@@ -1,5 +0,0 @@
-$def with (content, torrc)
-<h2>This is the content of $:torrc</h2>
-$:content
-
-<a href="/tor/config">edit torrc</a>
diff --git a/packages/torouter-web/src/tui/views/wired.html b/packages/torouter-web/src/tui/views/wired.html
deleted file mode 100644
index 3676f63..0000000
--- a/packages/torouter-web/src/tui/views/wired.html
+++ /dev/null
@@ -1,7 +0,0 @@
-$def with (form)
-
-<h2>Wired configuration page</h2>
-
-<form action="" method="POST">
-$:form.render()
-</form>
diff --git a/packages/torouter-web/src/tui/views/wireless.html b/packages/torouter-web/src/tui/views/wireless.html
deleted file mode 100644
index 48242bc..0000000
--- a/packages/torouter-web/src/tui/views/wireless.html
+++ /dev/null
@@ -1,8 +0,0 @@
-$def with (form)
-
-<h2>Wireless configuration page</h2>
-
-<form action="" method="POST">
-$:form.render()
-</form>
-
diff --git a/packages/torouter-web/src/tui/views/wizard.html b/packages/torouter-web/src/tui/views/wizard.html
deleted file mode 100644
index 0890507..0000000
--- a/packages/torouter-web/src/tui/views/wizard.html
+++ /dev/null
@@ -1,12 +0,0 @@
-$def with (wiz_form, text, step, next_step)
-
-<h1>Step number $step</h1>
-
-$text
-
-<form action="/wizard/$next_step" method="POST">
-$:wiz_form.render()
-
-</form>
-
-<!-- a href=/wizard/$next_step>Next ($next_step)</a-->