-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckWAF.py
55 lines (47 loc) · 1.74 KB
/
checkWAF.py
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
import requests
import sys
def checkWaf(url, header="", proxy="", timeout=5, allow_redirects=False):
payload = '/cdxy.old/.svn/.bashrc/.mdb/.inc/etc/passwd'
retVal = False
retVal1 = False
infoMsg = "checking if the target is protected by\n"
infoMsg += "some kind of WAF/IPS/IDS\n"
print(infoMsg)
try:
code = requests.get(url, stream=True, headers=header, timeout=timeout, proxies=proxy,
allow_redirects=allow_redirects).status_code
if code != 200:
retVal = True
except Exception as e:
print(e)
retVal = True
try:
code1 = requests.get(url + payload, stream=True, headers=header, timeout=timeout, proxies=proxy,
allow_redirects=allow_redirects, verify=False).status_code
if code1 != 404:
retVal1 = True
except Exception as e:
print(e)
retVal1 = True
if retVal:
warnMsg = 'Target URL not stable\n'
warnMsg += '[' + str(code) + '] ' + url + '\n'
print(warnMsg)
message = "are you sure that you want to\n"
message += "continue with further fuzzing? [y/N]\n"
print(message)
output = input()
if not output or output[0] not in ("Y", "y"):
print('User Quit!')
sys.exit(0)
if retVal1:
warnMsg = "heuristics detected that the target\n"
warnMsg += "is protected by some kind of WAF/IPS/IDS\n"
print(warnMsg)
message = "are you sure that you want to\n"
message += "continue with further fuzzing? [y/N]\n"
print(message)
output = input()
if not output or output[0] not in ("Y", "y"):
print('User Quit!')
sys.exit(0)