mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 19:13:48 +03:00
Adding waf script for detection of generic/unknown
This commit is contained in:
parent
f9d01f682b
commit
69fd900108
|
@ -1292,7 +1292,7 @@ def identifyWaf():
|
|||
break
|
||||
|
||||
if retVal:
|
||||
errMsg = "WAF/IDS/IPS identified '%s'. Please " % retVal
|
||||
errMsg = "WAF/IDS/IPS identified as '%s'. Please " % retVal
|
||||
errMsg += "consider usage of tamper scripts (option '--tamper')"
|
||||
logger.critical(errMsg)
|
||||
|
||||
|
|
|
@ -998,6 +998,8 @@ def _setWafFunctions():
|
|||
else:
|
||||
kb.wafFunctions.append((_["detect"], _.get("__product__", filename[:-3])))
|
||||
|
||||
kb.wafFunctions = sorted(kb.wafFunctions, key=lambda _: "generic" in _[1].lower())
|
||||
|
||||
def _setThreads():
|
||||
if not isinstance(conf.threads, int) or conf.threads <= 0:
|
||||
conf.threads = 1
|
||||
|
|
|
@ -19,7 +19,7 @@ from lib.core.enums import OS
|
|||
from lib.core.revision import getRevisionNumber
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.0.5.91"
|
||||
VERSION = "1.0.5.93"
|
||||
REVISION = getRevisionNumber()
|
||||
STABLE = VERSION.count('.') <= 2
|
||||
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")
|
||||
|
|
|
@ -18,10 +18,12 @@ def detect(get_page):
|
|||
for vector in WAF_ATTACK_VECTORS:
|
||||
page, headers, code = get_page(get=vector)
|
||||
retval = re.search(r"cloudflare-nginx", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
|
||||
if code > 400:
|
||||
|
||||
if code >= 400:
|
||||
retval |= re.search(r"\A__cfduid=", headers.get(HTTP_HEADER.SET_COOKIE, ""), re.I) is not None
|
||||
retval |= headers.get("cf-ray") is not None
|
||||
retval |= re.search(r"CloudFlare Ray ID:|var CloudFlare=", page or "") is not None
|
||||
|
||||
if retval:
|
||||
break
|
||||
|
||||
|
|
28
waf/generic.py
Normal file
28
waf/generic.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from lib.core.settings import WAF_ATTACK_VECTORS
|
||||
|
||||
__product__ = "Generic (Unknown)"
|
||||
|
||||
def detect(get_page):
|
||||
retval = False
|
||||
|
||||
page, _, code = get_page()
|
||||
if page is None or code >= 400:
|
||||
return False
|
||||
|
||||
for vector in WAF_ATTACK_VECTORS:
|
||||
page, _, code = get_page(get=vector)
|
||||
|
||||
if code >= 400:
|
||||
retval = True
|
||||
break
|
||||
|
||||
return retval
|
Loading…
Reference in New Issue
Block a user