-
Notifications
You must be signed in to change notification settings - Fork 0
/
stress_vegeta.sh
executable file
·76 lines (62 loc) · 2.1 KB
/
stress_vegeta.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown/Orange 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
# Cyan 0;36 Light Cyan 1;36
# Light Gray 0;37 White 1;37
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
tfile=$(mktemp /tmp/XXXXX.conf) #Create a temp file .conf
#listen : port you want to listen
#server_name : Name of the domain (e.g amazon.fr / amazon.fr)
#index : name of the index . If the URI is /www then it will check at /www/index.html
#location : all the rules to access files / img ...
#E.G : location / { root ./www } if you go to amazon.be you can access all the files in directory ./www
#client_max_body_size : limit the size of the client body
#allowed method : if no method allowed you only have GET
echo "server {
listen :9000;
server_name localhost;
index doesnotexist index.html;
location / {
allowed_method GET;
root ./www;
}
# error_page 404 ./404.html;
}
server {
listen :8000;
server_name localhost;
index doesnotexist index.html;
location / {
root ./www;
}
# error_page 404 ./404.html;
}
server {
listen :7000;
server_name localhost;
index doesnotexist index.html;
location / {
allowed_method POST GET;
root ./www;
}
error_page 404 ./404.html;
error_page 403 ./403.html;
}
" > $tfile
gnome-terminal -x sh -c "./webserv $tfile"
echo -e "\n${RED}ATTACK GET - PORT 9000 ${NC}"
echo "GET http://localhost:9000" | stress_test/vegeta attack -duration=10s | tee results.bin | stress_test/vegeta report
echo -e "\n${RED}ATTACK GET - PORT 8000 ${NC}"
echo "GET http://localhost:8000/" | stress_test/vegeta attack -duration=10s| tee results.bin | stress_test/vegeta report
echo -e "\n${BLUE}SIMULTANEOUS ATTACK GET - PORT 9000 & 7000${NC}"
stress_test/vegeta attack -duration=10s -targets=stress_test/target.list | tee results.bin | stress_test/vegeta report
rm $tfile;
rm results.bin