[stegotorus/master] updated start script for stegotorus and renamed from start-obfsproxy.sh

commit df4585cdca5bf30c1e923005ddfaf75283704438 Author: Linda Briesemeister <linda.briesemeister@sri.com> Date: Mon Dec 19 17:41:09 2011 +0000 updated start script for stegotorus and renamed from start-obfsproxy.sh git-svn-id: svn+ssh://spartan.csl.sri.com/svn/private/DEFIANCE@184 a58ff0ac-194c-e011-a152-003048836090 --- scripts/start-obfsproxy.sh | 120 ------------------------------------------- scripts/start-stegotorus.sh | 118 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 120 deletions(-) diff --git a/scripts/start-obfsproxy.sh b/scripts/start-obfsproxy.sh deleted file mode 100755 index 45c99da..0000000 --- a/scripts/start-obfsproxy.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -ODIR=~/src/DEFIANCE/stegotorus - -################################################################################ -# helper functions: - -usage () { -if [ $# -gt 0 ]; then - echo " *** ERROR: $1" -fi -cat << EOF - -usage: $0 <OPTIONS> [server|client] [install-dir] - -Start obfsproxy server or client with given options. If the optional install-dir -is given, override the value set in the script. - -OPTIONS: - -h Show this message - -i <addr> IP address (default: 127.0.0.1) - -p <n> port number (default: 8080) - -l <severity> Log severity: warn, error, debug (default: error) - -b <host> Host name (or IP address) of Tor Bridge - with port number attached via ':' or omitted - (default: 87.73.82.145:8080) - -n <n> Multiply the number of IP addresses on the client -EOF -} - -################################################################################ -# parse command line: - -# default values: -IP=127.0.0.1 -PORT=8080 -N=1 -LOG=error -BRIDGE_IP=87.73.82.145 -BRIDGE_PORT=8080 -while getopts "hi:p:l:b:n:" OPTION -do - case $OPTION in - h|\?) - usage; exit 1 - ;; - i) - IP=$OPTARG - ;; - p) - PORT=$OPTARG - ;; - n) - N=$OPTARG - ;; - l) - LOG=`echo $OPTARG | tr '[A-Z]' '[a-z]'` # make lower case - ;; - b) - arr=(${OPTARG//:/ }) - BRIDGE_IP=${arr[0]} - if [ ${#arr[@]} -gt 1 ]; then - BRIDGE_PORT=${arr[1]} - fi - ;; - esac - shift $((OPTIND-1)); OPTIND=1 -done - -# test if $LOG is valid -case $LOG in - debug|warn|error) - ;; - *) - usage "Unknown log level given: $LOG"; exit 1 - ;; -esac - -# now $@ has remaining arguments: -if [ $# -lt 1 ]; then - usage "need 'server' or 'client' as argument"; exit 1 -fi -TYPE=`echo $1 | tr '[A-Z]' '[a-z]'` # turn argument into lower case -case $TYPE in - server|client) - ;; - *) - usage "argument $1 not recognized"; exit 1 - ;; -esac - -# check optional install location given as an argument -if [ $# -gt 1 ]; then - if [[ ! -d $2 ]]; then - usage "argument $2 is not a directory"; exit 1 - fi - if [[ ! -x $2/obfsproxy ]]; then - usage "directory $2 does not contain executable of 'obfsproxy'"; exit 1 - fi - ODIR=$2 -fi - -################################################################################ -# start obfsproxy - -echo "Using obfsproxy in \"$ODIR\"" -cd $ODIR -export EVENT_NOKQUEUE=yes -case $TYPE in - server) - ./obfsproxy --log-min-severity=$LOG chop server $BRIDGE_IP:$BRIDGE_PORT $IP:$PORT - ;; - client) - IPS="" - for (( c=1; c<=$N; c++)) ; do - IPS="${IPS}${IP}:${PORT} http " ; - done - ./obfsproxy --log-min-severity=$LOG chop socks 127.0.0.1:1080 $IPS - ;; -esac diff --git a/scripts/start-stegotorus.sh b/scripts/start-stegotorus.sh new file mode 100644 index 0000000..01129ab --- /dev/null +++ b/scripts/start-stegotorus.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +################################################################################ +# helper functions: + +usage () { +if [ $# -gt 0 ]; then + echo " *** ERROR: $1" +fi +cat << EOF + +usage: $0 <OPTIONS> [server|client] [install-dir] + +Start StegoTorus server or client from given installation directory with given options. + +OPTIONS: + -h Show this message + -i <addr> IP address (default: 127.0.0.1) + -p <n> port number (default: 8080) + -l <severity> Log severity: warn, error, debug (default: error) + -b <host> Host name (or IP address) of Tor Bridge + with port number attached via ':' or omitted + (default: 87.73.82.145:8080) + -n <n> Multiply the number of IP addresses on the client +EOF +} + +################################################################################ +# parse command line: + +# default values: +IP=127.0.0.1 +PORT=8080 +N=1 +LOG=error +BRIDGE_IP=87.73.82.145 +BRIDGE_PORT=8080 +while getopts "hi:p:l:b:n:" OPTION +do + case $OPTION in + h|\?) + usage; exit 1 + ;; + i) + IP=$OPTARG + ;; + p) + PORT=$OPTARG + ;; + n) + N=$OPTARG + ;; + l) + LOG=`echo $OPTARG | tr '[A-Z]' '[a-z]'` # make lower case + ;; + b) + arr=(${OPTARG//:/ }) + BRIDGE_IP=${arr[0]} + if [ ${#arr[@]} -gt 1 ]; then + BRIDGE_PORT=${arr[1]} + fi + ;; + esac + shift $((OPTIND-1)); OPTIND=1 +done + +# test if $LOG is valid +case $LOG in + debug|warn|error) + ;; + *) + usage "Unknown log level given: $LOG"; exit 1 + ;; +esac + +# now $@ has remaining arguments: +if [ $# -lt 1 ]; then + usage "need 'server' or 'client' as argument"; exit 1 +fi +TYPE=`echo $1 | tr '[A-Z]' '[a-z]'` # turn argument into lower case +case $TYPE in + server|client) + ;; + *) + usage "argument $1 not recognized"; exit 1 + ;; +esac + +# check optional install location given as an argument +if [ $# -lt 2 ]; then + usage "need stegotorus installation directory as argument"; exit 1 +fi +ODIR=$2 +if [[ ! -d $ODIR ]]; then + usage "$ODIR is not a directory"; exit 1 +fi +if [[ ! -x $ODIR/stegotorus ]]; then + usage "directory $ODIR does not contain executable of 'stegotorus'"; exit 1 +fi + +################################################################################ +# start stegotorus + +echo "Using stegotorus in \"$ODIR\"" +cd $ODIR +export EVENT_NOKQUEUE=yes +case $TYPE in + server) + ./stegotorus --log-min-severity=$LOG chop server $BRIDGE_IP:$BRIDGE_PORT $IP:$PORT + ;; + client) + IPS="" + for (( c=1; c<=$N; c++)) ; do + IPS="${IPS}${IP}:${PORT} http " ; + done + ./stegotorus --log-min-severity=$LOG chop socks 127.0.0.1:1080 $IPS + ;; +esac
participants (1)
-
zwol@torproject.org