options: added a new option to detect errors when reported with normal status code and custom error strings

This commit is contained in:
Gauvain "GovanifY" Roussel-Tarbouriech 2019-10-09 18:27:35 +02:00
parent aed137ad80
commit 43c79de330
No known key found for this signature in database
GPG Key ID: DE62E1E2A6145556
3 changed files with 13 additions and 1 deletions

View File

@ -370,6 +370,9 @@ def cmdLineParser(argv=None):
detection.add_argument("--code", dest="code", type=int, detection.add_argument("--code", dest="code", type=int,
help="HTTP code to match when query is evaluated to True") help="HTTP code to match when query is evaluated to True")
detection.add_argument("--error-string", dest="errorString",
help="String to match when the database encountered an error")
detection.add_argument("--smart", dest="smart", action="store_true", detection.add_argument("--smart", dest="smart", action="store_true",
help="Perform thorough tests only if positive heuristic(s)") help="Perform thorough tests only if positive heuristic(s)")

View File

@ -14,6 +14,7 @@ from lib.core.common import parseXmlFile
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import paths from lib.core.data import paths
from lib.core.threads import getCurrentThreadData from lib.core.threads import getCurrentThreadData
from lib.core.data import conf
class HTMLHandler(ContentHandler): class HTMLHandler(ContentHandler):
""" """
@ -80,7 +81,11 @@ def htmlParser(page):
kb.cache.parsedDbms[key] = handler.dbms kb.cache.parsedDbms[key] = handler.dbms
# generic SQL warning/error messages # generic SQL warning/error messages
if re.search(r"SQL (warning|error|syntax)", page, re.I): if conf.errorString:
error=conf.errorString
else:
error=r"SQL (warning|error|syntax)"
if re.search(error, page, re.I):
handler._markAsErrorPage() handler._markAsErrorPage()
return handler.dbms return handler.dbms

View File

@ -350,6 +350,10 @@ regexp =
# code) # code)
# code = # code =
# String to match within the raw response when the query returns a database error
# Refer to the user's manual for further details.
errorString =
# Conduct thorough tests only if positive heuristic(s). # Conduct thorough tests only if positive heuristic(s).
# Valid: True or False # Valid: True or False
smart = False smart = False