-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpverbtamp.sh
73 lines (62 loc) · 2.09 KB
/
httpverbtamp.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
#!/bin/bash
#####################################################################################
#
# This script tests for http verb tampering and was based on following references:
# 1. https://owasp.org/www-project-web-security-testing-guide/v41/4-Web_Application_Security_Testing/07-Input_Validation_Testing/03-Testing_for_HTTP_Verb_Tampering
# 2. https://pentestlab.blog/2012/12/20/http-methods-identification/
#
#####################################################################################
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
####################################################################################
#Funcion to print the mode use help
function PrintUsage()
{
echo "Use: `basename $0` <host> <URI> [port]"
exit 1
}
if [ $# -lt 2 ];
then
echo -e "You did not provided enough arguments! \nExiting!"
PrintUsage
elif [ $# -eq 3 ];
then
HOST="$1"
URI="$2"
PORT="$3"
elif [ $# -eq 2 ];
then
HOST="$1"
URI="$2"
PORT="80"
else
echo -e "Incorrect argument number! \nExiting!"
PrintUsage
fi
#Name of file with resource names to test
FILE=lista.txt
while read -r line;
do
#prints the URI
printf "/$URI/$line:\n"
#Fills the loop for with the http methods of your choice
for webservmethod in GET POST PUT TRACE CONNECT OPTIONS PROPFIND;
do
printf "$webservmethod ";
printf "$webservmethod /$URI/$line HTTP/1.1\nHost: $HOST\n\n" | nc -q 1 $HOST $PORT | grep "HTTP/1.1";
done
done < $FILE
exit 0