From 20df4fd946824dd9ed4da8b63dbce07293882780 Mon Sep 17 00:00:00 2001 From: MatijaS Date: Wed, 3 Aug 2016 21:54:04 +0200 Subject: [PATCH 1/6] Bash script to change proxy every so often A simple bash script that runs toriptables2 repeatedly, with number of repetitions and delay between them up to the user. Useful since using same proxy all the time still lets people follow you and identify you from your digital footprint, while changing it at least once per few hours improves your anonymity greatly. --- updateproxy.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 updateproxy.sh diff --git a/updateproxy.sh b/updateproxy.sh new file mode 100644 index 0000000..7569218 --- /dev/null +++ b/updateproxy.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +#Change proxy every DELAY seconds for MAX times +FILE=./toriptables2.py +COUNTER=0 +MAX=$1 # +DELAY=$2 + +#Check if arg was received +if [ -z "$2" ]; then + echo "USAGE: ./updateproxy.sh " + exit +fi + +while [ $COUNTER -lt $MAX ]; do + python $FILE -l + sleep $DELAY + let COUNTER=COUNTER+1 +done From fca9a29e95bb02f115205facdbe32476bf5fc31a Mon Sep 17 00:00:00 2001 From: MatijaS Date: Wed, 3 Aug 2016 22:36:04 +0200 Subject: [PATCH 2/6] fixing a typo --- updateproxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updateproxy.sh b/updateproxy.sh index 7569218..733a5df 100644 --- a/updateproxy.sh +++ b/updateproxy.sh @@ -8,7 +8,7 @@ DELAY=$2 #Check if arg was received if [ -z "$2" ]; then - echo "USAGE: ./updateproxy.sh " + echo "USAGE: ./updateproxy.sh " exit fi From f7e8caffc1c06bf0bfe855753208ccac8b0760db Mon Sep 17 00:00:00 2001 From: MatijaS Date: Wed, 3 Aug 2016 23:29:18 +0200 Subject: [PATCH 3/6] Update updateproxy.sh Hopefully this fixes ip leakage problem. --- updateproxy.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/updateproxy.sh b/updateproxy.sh index 733a5df..7911777 100644 --- a/updateproxy.sh +++ b/updateproxy.sh @@ -8,12 +8,16 @@ DELAY=$2 #Check if arg was received if [ -z "$2" ]; then - echo "USAGE: ./updateproxy.sh " + echo "USAGE: sudo ./updateproxy.sh " exit fi +#iptables dropping packets makes sure your real ip isn't leaked if webpage +#is being fetched during the proxy reload. while [ $COUNTER -lt $MAX ]; do + iptables -P OUTPUT DROP python $FILE -l + iptables -P OUTPUT ACCEPT sleep $DELAY let COUNTER=COUNTER+1 done From 1588c4c922b7d413ce74ed6837012ec7b8a5be38 Mon Sep 17 00:00:00 2001 From: Matija Sirk Date: Thu, 4 Aug 2016 00:07:35 +0200 Subject: [PATCH 4/6] adding -w option to iptables Script now waits for exclusive xtables lock instead of crashing when it's unable to get it. --- updateproxy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updateproxy.sh b/updateproxy.sh index 7911777..0698d7c 100644 --- a/updateproxy.sh +++ b/updateproxy.sh @@ -15,9 +15,9 @@ fi #iptables dropping packets makes sure your real ip isn't leaked if webpage #is being fetched during the proxy reload. while [ $COUNTER -lt $MAX ]; do - iptables -P OUTPUT DROP + iptables -w -P OUTPUT DROP python $FILE -l - iptables -P OUTPUT ACCEPT + iptables -w -P OUTPUT ACCEPT sleep $DELAY let COUNTER=COUNTER+1 done From 5749a88bcfd419c1fbae30217ea3a780ea3a2425 Mon Sep 17 00:00:00 2001 From: Matija Sirk Date: Thu, 4 Aug 2016 00:21:27 +0200 Subject: [PATCH 5/6] Update updateproxy.sh --- updateproxy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updateproxy.sh b/updateproxy.sh index 0698d7c..26e853a 100644 --- a/updateproxy.sh +++ b/updateproxy.sh @@ -3,12 +3,12 @@ #Change proxy every DELAY seconds for MAX times FILE=./toriptables2.py COUNTER=0 -MAX=$1 # +MAX=$1 DELAY=$2 #Check if arg was received if [ -z "$2" ]; then - echo "USAGE: sudo ./updateproxy.sh " + echo "USAGE: sudo ${0} " exit fi From 86f9ce943e2c2c70a70af417d74506c9d8f5f1db Mon Sep 17 00:00:00 2001 From: Matija Sirk Date: Thu, 4 Aug 2016 08:59:00 +0200 Subject: [PATCH 6/6] Update updateproxy.sh --- updateproxy.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/updateproxy.sh b/updateproxy.sh index 26e853a..2f164f6 100644 --- a/updateproxy.sh +++ b/updateproxy.sh @@ -1,23 +1,23 @@ #!/bin/bash #Change proxy every DELAY seconds for MAX times -FILE=./toriptables2.py +FILE=toriptables2.py COUNTER=0 -MAX=$1 +MAX=$1 # DELAY=$2 -#Check if arg was received -if [ -z "$2" ]; then +#Check if args was received +if [ $# -ne 2 ]; then echo "USAGE: sudo ${0} " exit fi #iptables dropping packets makes sure your real ip isn't leaked if webpage #is being fetched during the proxy reload. -while [ $COUNTER -lt $MAX ]; do +while [ ${COUNTER} -lt ${MAX} ]; do iptables -w -P OUTPUT DROP - python $FILE -l + ${FILE} -l iptables -w -P OUTPUT ACCEPT - sleep $DELAY - let COUNTER=COUNTER+1 + sleep ${DELAY} + let "COUNTER += 1" done