Created
February 9, 2016 16:25
-
-
Save glennzw/25cb972cfeb52e55694a to your computer and use it in GitHub Desktop.
Test GoProxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#ToDo: Learn how to use functions in Bash :P | |
MAXTHREADS=20 | |
#####1. No proxy | |
echo "Downloading `wc -l sites.txt|xargs` sites with no proxy (max threads: $MAXTHREADS)" | |
start=`date +%s` | |
for i in `cat sites.txt` | |
do | |
t=$(ps aux | grep curl | grep -v grep | wc -l| xargs) | |
while [ $t -ge $MAXTHREADS ]; do | |
sleep 0.2 | |
t=$(ps aux | grep curl | grep -v grep | wc -l| xargs) | |
done | |
curl -o ./files/$i $i --silent -m 10 & | |
done | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "Done. Running time: $runtime seconds" | |
echo "" | |
rm ./files/* | |
#####2. mitmproxy | |
echo "Downloading `wc -l sites.txt|xargs` sites with mitmproxy (Python) (max threads: $MAXTHREADS)" | |
start=`date +%s` | |
for i in `cat sites.txt` | |
do | |
t=$(ps aux | grep curl | grep -v grep | wc -l| xargs) | |
while [ $t -ge $MAXTHREADS ]; do | |
sleep 0.2 | |
t=$(ps aux | grep curl | grep -v grep | wc -l| xargs) | |
done | |
curl -x localhost:8090 -o ./files/$i $i --silent -m 10 & | |
done | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "Done. Running time: $runtime seconds" | |
echo "" | |
rm ./files/* | |
#####3. GoProxy | |
echo "Downloading `wc -l sites.txt|xargs` sites with GoProxy (max threads: $MAXTHREADS)" | |
start=`date +%s` | |
for i in `cat sites.txt` | |
do | |
t=$(ps aux | grep curl | grep -v grep | wc -l| xargs) | |
while [ $t -ge $MAXTHREADS ]; do | |
sleep 0.2 | |
t=$(ps aux | grep curl | grep -v grep | wc -l| xargs) | |
done | |
curl -x localhost:8080 -o ./files/$i $i --silent -m 10 & | |
done | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "Done. Running time: $runtime seconds" | |
echo "" | |
rm ./files/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment