[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] Add local and remote proxy switching experiments.
commit 8a18185d9b2b353fd1442c1603518df2c3586f89
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Sun Oct 30 22:57:10 2011 -0700
Add local and remote proxy switching experiments.
These are mainly copied from the paper branch, but they use the nicer
new common.sh test infrastructure and are easier to run.
---
experiments/common.sh | 1 +
experiments/switching/local-http-alternating.sh | 61 +++++++++++++++++++++++
experiments/switching/local-http-constant.sh | 56 +++++++++++++++++++++
experiments/switching/proxy-loop.sh | 38 ++++++++++++++
experiments/switching/remote-tor-alternating.sh | 57 +++++++++++++++++++++
experiments/switching/remote-tor-constant.sh | 52 +++++++++++++++++++
6 files changed, 265 insertions(+), 0 deletions(-)
diff --git a/experiments/common.sh b/experiments/common.sh
index 6f2deea..7e5d0a4 100644
--- a/experiments/common.sh
+++ b/experiments/common.sh
@@ -4,6 +4,7 @@
FIREFOX=firefox
SOCAT=socat
THTTPD=thttpd
+TOR=tor
visible_sleep() {
N="$1"
diff --git a/experiments/switching/local-http-alternating.sh b/experiments/switching/local-http-alternating.sh
new file mode 100755
index 0000000..d83651a
--- /dev/null
+++ b/experiments/switching/local-http-alternating.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Usage: ./local-http-alternating.sh
+#
+# Tests a download over alternating flash proxies.
+
+. ../common.sh
+
+FLASHPROXY_DIR=../../../flashproxy
+
+PROFILE_1=flashexp1
+PROFILE_2=flashexp2
+PROXY_URL="http://localhost:8000/swfcat.swf?facilitator=127.0.0.1:9002"
+DATA_FILE_NAME="$FLASHPROXY_DIR/dump"
+
+# Declare an array.
+declare -a PIDS_TO_KILL
+stop() {
+ browser_clear "$PROFILE_1"
+ browser_clear "$PROFILE_2"
+ if [ -n "${PIDS_TO_KILL[*]}" ]; then
+ echo "Kill pids ${PIDS_TO_KILL[@]}."
+ kill "${PIDS_TO_KILL[@]}"
+ fi
+ echo "Delete data file."
+ rm -f "$DATA_FILE_NAME"
+ exit
+}
+trap stop EXIT
+
+echo "Create data file."
+dd if=/dev/null of="$DATA_FILE_NAME" bs=1M seek=1024 2>/dev/null || exit
+
+echo "Start web server."
+"$THTTPD" -D -d "$FLASHPROXY_DIR" -p 8000 &
+PIDS_TO_KILL+=($!)
+
+echo "Start facilitator."
+"$FLASHPROXY_DIR"/facilitator.py -d --relay 127.0.0.1:8000 >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 2
+
+echo "Start connector."
+"$FLASHPROXY_DIR"/connector.py --facilitator 127.0.0.1 >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+echo "Start browsers."
+ensure_browser_started "$PROFILE_1"
+ensure_browser_started "$PROFILE_2"
+
+./proxy-loop.sh "$PROXY_URL" "$PROFILE_1" "$PROFILE_2" >/dev/null 2>&1 &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+echo "Start socat."
+"$SOCAT" TCP-LISTEN:2000,reuseaddr,fork SOCKS4A:localhost:dummy:0,socksport=9001 &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+time wget http://localhost:2000/dump -t 0 -O /dev/null
diff --git a/experiments/switching/local-http-constant.sh b/experiments/switching/local-http-constant.sh
new file mode 100755
index 0000000..b551140
--- /dev/null
+++ b/experiments/switching/local-http-constant.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# Usage: ./local-http-constant.sh
+#
+# Tests a download over an uninterrupted flash proxy.
+
+. ../common.sh
+
+FLASHPROXY_DIR=../../../flashproxy
+
+PROFILE_1=flashexp1
+PROFILE_2=flashexp2
+PROXY_URL="http://localhost:8000/swfcat.swf?facilitator=127.0.0.1:9002"
+DATA_FILE_NAME="$FLASHPROXY_DIR/dump"
+
+# Declare an array.
+declare -a PIDS_TO_KILL
+stop() {
+ browser_clear "$PROFILE_1"
+ browser_clear "$PROFILE_2"
+ if [ -n "${PIDS_TO_KILL[*]}" ]; then
+ echo "Kill pids ${PIDS_TO_KILL[@]}."
+ kill "${PIDS_TO_KILL[@]}"
+ fi
+ echo "Delete data file."
+ rm -f "$DATA_FILE_NAME"
+ exit
+}
+trap stop EXIT
+
+echo "Create data file."
+dd if=/dev/null of="$DATA_FILE_NAME" bs=1M seek=1024 2>/dev/null || exit
+
+echo "Start web server."
+"$THTTPD" -D -d "$FLASHPROXY_DIR" -p 8000 &
+PIDS_TO_KILL+=($!)
+
+echo "Start facilitator."
+"$FLASHPROXY_DIR"/facilitator.py -d --relay 127.0.0.1:8000 >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 2
+
+echo "Start connector."
+"$FLASHPROXY_DIR"/connector.py --facilitator 127.0.0.1 >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+echo "Start browser."
+browser_goto "$PROFILE_1" "$PROXY_URL"
+
+echo "Start socat."
+"$SOCAT" TCP-LISTEN:2000,reuseaddr,fork SOCKS4A:localhost:dummy:0,socksport=9001 &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+time wget http://localhost:2000/dump -t 0 -O /dev/null
diff --git a/experiments/switching/proxy-loop.sh b/experiments/switching/proxy-loop.sh
new file mode 100755
index 0000000..3c3b78a
--- /dev/null
+++ b/experiments/switching/proxy-loop.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Runs overlapping flash proxy instances in a loop.
+# Usage: /proxy-loop.sh <URL> PROFILE1 PROFILE2
+
+# The profiles need to have the open_newwindow configuration option set
+# properly. See ../README.
+# browser.link.open_newwindow=1 (default is 3)
+
+. ../common.sh
+
+URL=$1
+PROFILE_1=$2
+PROFILE_2=$3
+
+# OVERLAP must be at most half of PERIOD.
+PERIOD=10
+OVERLAP=2
+
+ensure_browser_started "$PROFILE_1"
+browser_clear "$PROFILE_1"
+ensure_browser_started "$PROFILE_2"
+browser_clear "$PROFILE_2"
+
+while true; do
+ echo "1 on"
+ firefox -P "$PROFILE_1" -remote "openurl($URL)"
+ sleep $OVERLAP
+ echo "2 off"
+ firefox -P "$PROFILE_2" -remote "openurl(about:blank)"
+ sleep $(($PERIOD - (2 * $OVERLAP)))
+ echo "2 on"
+ firefox -P "$PROFILE_2" -remote "openurl($URL)"
+ sleep $OVERLAP
+ echo "1 off"
+ firefox -P "$PROFILE_1" -remote "openurl(about:blank)"
+ sleep $(($PERIOD - (2 * $OVERLAP)))
+done
diff --git a/experiments/switching/remote-tor-alternating.sh b/experiments/switching/remote-tor-alternating.sh
new file mode 100755
index 0000000..e7c14fd
--- /dev/null
+++ b/experiments/switching/remote-tor-alternating.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# Usage: ./remote-tor-alternating.sh
+#
+# Tests a Tor download over alternating flash proxies.
+
+. ../common.sh
+
+FLASHPROXY_DIR=../../../flashproxy
+
+PROFILE_1=flashexp1
+PROFILE_2=flashexp2
+PROXY_URL="http://localhost:8000/swfcat.swf?facilitator=127.0.0.1:9002"
+DATA_FILE_NAME="$FLASHPROXY_DIR/dump"
+
+# Declare an array.
+declare -a PIDS_TO_KILL
+stop() {
+ browser_clear "$PROFILE_1"
+ browser_clear "$PROFILE_2"
+ if [ -n "${PIDS_TO_KILL[*]}" ]; then
+ echo "Kill pids ${PIDS_TO_KILL[@]}."
+ kill "${PIDS_TO_KILL[@]}"
+ fi
+ exit
+}
+trap stop EXIT
+
+echo "Start web server."
+"$THTTPD" -D -d "$FLASHPROXY_DIR" -p 8000 &
+PIDS_TO_KILL+=($!)
+
+echo "Start facilitator."
+"$FLASHPROXY_DIR"/facilitator.py -d --relay tor1.bamsoftware.com >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 2
+
+echo "Start connector."
+"$FLASHPROXY_DIR"/connector.py --facilitator 127.0.0.1 >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+echo "Start Tor."
+"$TOR" -f "$FLASHPROXY_DIR"/torrc &
+PIDS_TO_KILL+=($!)
+
+echo "Start browsers."
+ensure_browser_started "$PROFILE_1"
+ensure_browser_started "$PROFILE_2"
+
+./proxy-loop.sh "$PROXY_URL" "$PROFILE_1" "$PROFILE_2" >/dev/null 2>&1 &
+PIDS_TO_KILL+=($!)
+
+# Let Tor bootstrap.
+visible_sleep 15
+
+time torify wget http://torperf.torproject.org/.5mbfile -t 0 -O /dev/null
diff --git a/experiments/switching/remote-tor-constant.sh b/experiments/switching/remote-tor-constant.sh
new file mode 100755
index 0000000..0f84a06
--- /dev/null
+++ b/experiments/switching/remote-tor-constant.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# Usage: ./remote-tor-constant.sh
+#
+# Tests a Tor download over an uninterrupted flash proxy.
+
+. ../common.sh
+
+FLASHPROXY_DIR=../../../flashproxy
+
+PROFILE_1=flashexp1
+PROFILE_2=flashexp2
+PROXY_URL="http://localhost:8000/swfcat.swf?facilitator=127.0.0.1:9002"
+DATA_FILE_NAME="$FLASHPROXY_DIR/dump"
+
+# Declare an array.
+declare -a PIDS_TO_KILL
+stop() {
+ browser_clear "$PROFILE_1"
+ if [ -n "${PIDS_TO_KILL[*]}" ]; then
+ echo "Kill pids ${PIDS_TO_KILL[@]}."
+ kill "${PIDS_TO_KILL[@]}"
+ fi
+ exit
+}
+trap stop EXIT
+
+echo "Start web server."
+"$THTTPD" -D -d "$FLASHPROXY_DIR" -p 8000 &
+PIDS_TO_KILL+=($!)
+
+echo "Start facilitator."
+"$FLASHPROXY_DIR"/facilitator.py -d --relay tor1.bamsoftware.com >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 2
+
+echo "Start connector."
+"$FLASHPROXY_DIR"/connector.py --facilitator 127.0.0.1 >/dev/null &
+PIDS_TO_KILL+=($!)
+visible_sleep 1
+
+echo "Start Tor."
+"$TOR" -f "$FLASHPROXY_DIR"/torrc &
+PIDS_TO_KILL+=($!)
+
+echo "Start browsers."
+browser_goto "$PROFILE_1" "$PROXY_URL"
+
+# Let Tor bootstrap.
+visible_sleep 15
+
+time torify wget http://torperf.torproject.org/.5mbfile -t 0 -O /dev/null
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits