-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.sh
executable file
·54 lines (42 loc) · 1.27 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -euo pipefail
if [[ "${UID}" -ne 0 ]]; then
echo "You must be root to run this."
exit 1
fi
# "full" mode runs more period and burst combinations.
full=false
while getopts 'abfv' flag; do
case "${flag}" in
f) full=true ;;
*) error "Use either 'sudo ./run.sh' or 'sudo ./run.sh -f'." ;;
esac
done
max_burst=0.15
max_period=1.5
if [ "$full" = true ]; then
max_burst=0.25
max_period=2.0
fi
EXTERNAL_IP=`curl -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip`
START_TIME=`date +%Y%m%d-%H%M%S`
HOSTNAME=`hostname`
echo "Run $START_TIME on $HOSTNAME ($EXTERNAL_IP) started."
for burst in $(seq 0.15 0.05 ${max_burst}); do
for period in $(seq 0.5 0.05 ${max_period}); do
mn -c 2> /dev/null
killall -9 python dd nc tshark dumpcap || true
echo ""
echo "Starting attack, burst=${burst}, period=${period}"
python dos.py --rto=1000 --period "${period}" --burst "${burst}" \
--suffix "${HOSTNAME}-${START_TIME}"
killall -9 python dd nc tshark dumpcap || true
echo ""
echo "Done."
sleep 5s
done
done
su $SUDO_USER -c ./plot_bw.py
su $SUDO_USER -c ./plot_cwnd.py
echo "Visit: http://$EXTERNAL_IP:80 to view results."
./webserver.py