summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/check.sh4
-rwxr-xr-xbin/proxy.sh78
2 files changed, 82 insertions, 0 deletions
diff --git a/bin/check.sh b/bin/check.sh
index ebbe279..5c9b938 100755
--- a/bin/check.sh
+++ b/bin/check.sh
@@ -24,6 +24,7 @@ usage(){
echo "-c --check add a process name to check"
echo "-p --print print list of process we check for"
echo "-q --quiet surpress output"
+ echo "-v --verbose be verbose"
echo "-m --mailto ADRESS send report to ADRESS"
echo "-n --nonotice don't send mail"
echo "-h --help prints this help"
@@ -50,6 +51,9 @@ while true; do
-q|--quiet) QUIET=1
shift
;;
+ -v|--verbose) QUIET=0
+ shift
+ ;;
-m|--mailto)
if [ "x$2" != "x" ]; then
NOTICETO="$2"
diff --git a/bin/proxy.sh b/bin/proxy.sh
new file mode 100755
index 0000000..a67c873
--- /dev/null
+++ b/bin/proxy.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# opens a ssh tunnel and starts a new firefox instance
+# configure your firefox profil to use the ssh tunnel
+
+user=$USER
+host=$(hostname)
+port=9999
+
+url=$user@$host
+
+while [ $# -ne 0 ]; do
+ case "$1" in
+ -u|--url)
+ if [ "x$2" = "x" ]; then
+ echo "$1 requires an argument. Abort." 1>&2
+ exit 1
+ else
+ url="$2"
+ fi
+ shift
+ shift
+ ;;
+ -h|--host)
+ if [ "x$2" = "x" ]; then
+ echo "$1 requires an argument. Abort." 1>&2
+ exit 1
+ else
+ host="$2"
+ fi
+ shift
+ shift
+ ;;
+ -p|--port)
+ if [ "x$2" = "x" ]; then
+ echo "$1 requires an argument. Abort." 1>&2
+ exit 1
+ else
+ port="$2"
+ fi
+ shift
+ shift
+ ;;
+ *)
+ echo "Usage: '$(basename $0) [-u HOST] [-p PORT]'"
+ echo "Default connection is set to $url:$port"
+ exit 1
+ esac
+done
+
+
+if [ "x$host" = x ]; then
+ echo "No host given. Abort." 1>&2
+ exit 1
+fi
+
+if [ "x$port" = x ]; then
+ echo "No pott given. Abort." 1>&2
+ exit 1
+fi
+
+if [ x$(netstat -tulpen 2>/dev/null | grep 127.0.0.1:$port | head -1 | cut -d "/" -f2) = "xssh" ]; then
+ echo "Using existing ssh tunnel."
+else
+ nohup ssh -f -N $url -D $port >>/tmp/nohub.ssh$port.log 2>&1 &
+ if [ $? -ne 0 ]; then
+ echo "Failed to create the ssh tunnel. Read /tmp/nohub.ssh$port.log for more information."
+ exit 1
+ fi
+fi
+
+nohup firefox -no-remote -P proxy >>/tmp/nohub.fx.log 2>&1 &
+if [ $? -ne 0 ]; then
+ echo "Failed to start Firefox. Read /tmp/nohub.fx.log for more information."
+ exit 1
+fi
+
+echo "Proxying all traffic through '$url:$port'."
+exit 0