Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69fd900

Browse files
committed
Adding waf script for detection of generic/unknown
1 parent f9d01f6 commit 69fd900

5 files changed

Lines changed: 35 additions & 3 deletions

File tree

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ def _(*args, **kwargs):
12921292
break
12931293

12941294
if retVal:
1295-
errMsg = "WAF/IDS/IPS identified '%s'. Please " % retVal
1295+
errMsg = "WAF/IDS/IPS identified as '%s'. Please " % retVal
12961296
errMsg += "consider usage of tamper scripts (option '--tamper')"
12971297
logger.critical(errMsg)
12981298

lib/core/option.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ def _setWafFunctions():
998998
else:
999999
kb.wafFunctions.append((_["detect"], _.get("__product__", filename[:-3])))
10001000

1001+
kb.wafFunctions = sorted(kb.wafFunctions, key=lambda _: "generic" in _[1].lower())
1002+
10011003
def _setThreads():
10021004
if not isinstance(conf.threads, int) or conf.threads <= 0:
10031005
conf.threads = 1

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.revision import getRevisionNumber
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.5.91"
22+
VERSION = "1.0.5.93"
2323
REVISION = getRevisionNumber()
2424
STABLE = VERSION.count('.') <= 2
2525
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")

waf/cloudflare.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ def detect(get_page):
1818
for vector in WAF_ATTACK_VECTORS:
1919
page, headers, code = get_page(get=vector)
2020
retval = re.search(r"cloudflare-nginx", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
21-
if code > 400:
21+
22+
if code >= 400:
2223
retval |= re.search(r"\A__cfduid=", headers.get(HTTP_HEADER.SET_COOKIE, ""), re.I) is not None
2324
retval |= headers.get("cf-ray") is not None
2425
retval |= re.search(r"CloudFlare Ray ID:|var CloudFlare=", page or "") is not None
26+
2527
if retval:
2628
break
2729

waf/generic.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
import re
9+
10+
from lib.core.settings import WAF_ATTACK_VECTORS
11+
12+
__product__ = "Generic (Unknown)"
13+
14+
def detect(get_page):
15+
retval = False
16+
17+
page, _, code = get_page()
18+
if page is None or code >= 400:
19+
return False
20+
21+
for vector in WAF_ATTACK_VECTORS:
22+
page, _, code = get_page(get=vector)
23+
24+
if code >= 400:
25+
retval = True
26+
break
27+
28+
return retval

0 commit comments

Comments
 (0)