diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 4c13944be..acace219a 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -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) diff --git a/lib/core/option.py b/lib/core/option.py index fd163f6a8..c164a2bd8 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -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 diff --git a/lib/core/settings.py b/lib/core/settings.py index 93f505af6..ffeaa624c 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -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") diff --git a/waf/cloudflare.py b/waf/cloudflare.py index b47725d70..f3981ac0c 100644 --- a/waf/cloudflare.py +++ b/waf/cloudflare.py @@ -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 diff --git a/waf/generic.py b/waf/generic.py new file mode 100644 index 000000000..f86a03e42 --- /dev/null +++ b/waf/generic.py @@ -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