diff --git a/lib/controller/checks.py b/lib/controller/checks.py index eaddbe791..1b9e9f7f5 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -32,7 +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 singleTimeWarnMessage from lib.core.common import trimAlphaNum from lib.core.common import wasLastRequestDBMSError from lib.core.common import wasLastRequestHTTPError @@ -399,7 +399,7 @@ def checkSqlInjection(place, parameter, value): warnMsg = "using unescaped version of the test " warnMsg += "because of zero knowledge of the " warnMsg += "back-end DBMS" - singleTimeLogMessage(warnMsg, logging.WARN, title) + singleTimeWarnMessage(warnMsg, logging.WARN, title) # Test for UNION query SQL injection reqPayload, vector = unionTest(comment, place, parameter, value, prefix, suffix) diff --git a/lib/core/common.py b/lib/core/common.py index faddf94cb..90d87c323 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -640,7 +640,10 @@ def filePathToString(filePath): return strRepl -def singleTimeLogMessage(message, level=logging.WARN, flag=None): +def singleTimeWarnMessage(message): + singleTimeLogMessage(message, logging.WARN) + +def singleTimeLogMessage(message, level=logging.INFO, flag=None): if flag is None: flag = hash(message) @@ -664,7 +667,7 @@ def dataToStdout(data, forceOutput=False): warnMsg += "replacement with '?' character. Please, find " warnMsg += "proper character representation inside " warnMsg += "coresponding output files. " - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) sys.stdout.write(output) else: diff --git a/lib/request/basic.py b/lib/request/basic.py index f6097f13e..942ac0240 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -23,7 +23,7 @@ from lib.core.common import getUnicode from lib.core.common import isWindowsDriveLetterPath from lib.core.common import posixToNtSlashes from lib.core.common import sanitizeAsciiString -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -140,7 +140,7 @@ def checkCharEncoding(encoding): except LookupError: warnMsg = "unknown web page charset '%s'. " % encoding warnMsg += "Please report by e-mail to %s." % ML - singleTimeLogMessage(warnMsg, logging.WARN, encoding) + singleTimeWarnMessage(warnMsg, logging.WARN, encoding) encoding = None return encoding @@ -153,7 +153,7 @@ def getHeuristicCharEncoding(page): retVal = detect(page)['encoding'] infoMsg = "heuristics detected web page charset '%s'" % retVal - singleTimeLogMessage(infoMsg, logging.INFO, retVal) + singleTimeWarnMessage(infoMsg, logging.INFO, retVal) return retVal diff --git a/lib/request/connect.py b/lib/request/connect.py index 69097ad9b..1e4d13bd1 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -29,7 +29,7 @@ from lib.core.common import logHTTPTraffic from lib.core.common import parseTargetUrl from lib.core.common import readInput from lib.core.common import removeReflectiveValues -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.common import stdev from lib.core.common import urlEncodeCookieValues from lib.core.common import wasLastRequestDelayed @@ -413,16 +413,16 @@ class Connect: warnMsg += "without flag T in --technique option " warnMsg += "(e.g. --flush-session --technique=BEUS) or try to " warnMsg += "lower the --time-sec value (e.g. --time-sec=2)" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) elif kb.originalPage is None: warnMsg = "if the problem persists please try to rerun " warnMsg += "with the --random-agent switch turned on " warnMsg += "and/or try to use proxy switches (--ignore-proxy, --proxy,...)" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) elif conf.threads > 1: warnMsg = "if the problem persists please try to lower " warnMsg += "the number of used threads (--threads)" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) time.sleep(1) diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index c1b6e1f50..1fc388a42 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -25,7 +25,7 @@ from lib.core.common import pushValue from lib.core.common import readInput from lib.core.common import replaceNewlineTabs from lib.core.common import safeStringFormat -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.common import unhandledExceptionMessage from lib.core.data import conf from lib.core.data import kb @@ -116,7 +116,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None if conf.threads == 1 and not timeBasedCompare: warnMsg = "running in a single-thread mode. please consider usage of " warnMsg += "--threads option to declare higher number of threads" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) if conf.verbose in (1, 2) and not showEta: if isinstance(length, int) and conf.threads > 1: diff --git a/lib/techniques/inband/union/test.py b/lib/techniques/inband/union/test.py index 3f3b650b7..40f1a36bc 100644 --- a/lib/techniques/inband/union/test.py +++ b/lib/techniques/inband/union/test.py @@ -24,7 +24,7 @@ from lib.core.common import popValue from lib.core.common import pushValue from lib.core.common import randomStr from lib.core.common import removeReflectiveValues -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.common import stdev from lib.core.common import wasLastRequestDBMSError from lib.core.data import conf @@ -214,7 +214,7 @@ def __unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix warnMsg = "please consider usage of --union-char option " warnMsg += "(e.g. --union-char=1) and/or try to force " warnMsg += "back-end DBMS (e.g. --dbms=mysql) to make it work" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) return validPayload, vector diff --git a/lib/techniques/inband/union/use.py b/lib/techniques/inband/union/use.py index d76e94345..64f4d84f9 100644 --- a/lib/techniques/inband/union/use.py +++ b/lib/techniques/inband/union/use.py @@ -25,7 +25,7 @@ from lib.core.common import isNumPosStrValue from lib.core.common import listToStrValue from lib.core.common import parseUnionPage from lib.core.common import removeReflectiveValues -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.convert import safecharencode from lib.core.data import conf from lib.core.data import kb @@ -94,7 +94,7 @@ def __oneShotUnionUse(expression, unpack=True): warnMsg = "if the problem persists with 'None' values please try to use " warnMsg += "hidden switch --no-cast (fixing problems with some collation " warnMsg += "issues)" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) return output diff --git a/plugins/dbms/mysql/filesystem.py b/plugins/dbms/mysql/filesystem.py index e18e2b36a..a8da89db8 100644 --- a/plugins/dbms/mysql/filesystem.py +++ b/plugins/dbms/mysql/filesystem.py @@ -7,7 +7,7 @@ Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/) See the file 'doc/COPYING' for copying permission """ -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.common import randomStr from lib.core.data import conf from lib.core.data import kb @@ -97,7 +97,7 @@ class Filesystem(GenericFilesystem): warnMsg = "expect junk characters inside the " warnMsg += "file as a leftover from UNION query" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) def stackedWriteFile(self, wFile, dFile, fileType, confirm=True): debugMsg = "creating a support table to write the hexadecimal " diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index ba938fe11..243fd3b92 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -30,7 +30,7 @@ from lib.core.common import randomStr from lib.core.common import readInput from lib.core.common import safeStringFormat from lib.core.common import safeSQLIdentificatorNaming -from lib.core.common import singleTimeLogMessage +from lib.core.common import singleTimeWarnMessage from lib.core.common import strToHex from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming @@ -1410,7 +1410,7 @@ class Enumeration: if (i + 1) < conf.limitStart: warnMsg = "skipping first %d pivot " % conf.limitStart warnMsg += "point values" - singleTimeLogMessage(warnMsg) + singleTimeWarnMessage(warnMsg) break elif (i + 1) > conf.limitStop: breakRetrieval = True