From df0331fe9b3a0a4ce5e64fa0c20c561bc5e0a783 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 19 Apr 2011 23:04:10 +0000 Subject: [PATCH] some more refactoring --- lib/controller/checks.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index dbf0f1f30..e0176389e 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -7,6 +7,7 @@ Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/) See the file 'doc/COPYING' for copying permission """ +import logging import re import socket import time @@ -31,6 +32,7 @@ from lib.core.common import randomInt from lib.core.common import randomStr from lib.core.common import readInput from lib.core.common import showStaticWords +from lib.core.common import singleTimeLogMessage from lib.core.common import trimAlphaNum from lib.core.common import wasLastRequestDBMSError from lib.core.common import wasLastRequestHTTPError @@ -202,9 +204,6 @@ def checkSqlInjection(place, parameter, value): infoMsg = "testing '%s'" % title logger.info(infoMsg) - # Flag used for signaling warning messages regarding unescaping - genericWarningFlag = False - # Force back-end DBMS according to the current # test value for proper payload unescaping Backend.forceDbms(dbms[0] if isinstance(dbms, list) else dbms) @@ -387,14 +386,11 @@ def checkSqlInjection(place, parameter, value): configUnion(test.request.char, test.request.columns) - if not Backend.getIdentifiedDbms() and not genericWarningFlag: + if not Backend.getIdentifiedDbms(): warnMsg = "using unescaped version of the test " warnMsg += "because of zero knowledge of the " warnMsg += "back-end DBMS" - logger.warn(warnMsg) - - # Set the flag preventing bulking of the message for the same test - genericWarningFlag = True + singleTimeLogMessage(warnMsg, logging.WARN, title) # Test for UNION query SQL injection reqPayload, vector = unionTest(comment, place, parameter, value, prefix, suffix)