some fixes

This commit is contained in:
Miroslav Stampar 2011-01-07 16:39:47 +00:00
parent 16a06117f7
commit b313a20a3f
6 changed files with 10 additions and 10 deletions

View File

@ -422,7 +422,7 @@ def filePathToString(filePath):
def dataToStdout(data, forceOutput=False):
if not ('threadException' in kb and kb.threadException):
if forceOutput or (conf.verbose > 0) and not ('disableStdOut' in kb and kb.disableStdOut):
if forceOutput or (conf.verbose > 0) and not getCurrentThreadData().disableStdOut:
try:
sys.stdout.write(data)
sys.stdout.flush()

View File

@ -1140,7 +1140,6 @@ def __setKnowledgeBaseAttributes(flushAll=True):
kb.commonOutputs = None
kb.data = advancedDict()
kb.disableStdOut = False
# Old style injection flag
kb.unionTest = None

View File

@ -17,6 +17,7 @@ class ThreadData():
"""
def __init__(self):
self.disableStdOut = False
self.lastErrorPage = None
self.lastHTTPError = None
self.lastQueryDuration = 0

View File

@ -14,7 +14,6 @@ from lib.core.agent import agent
from lib.core.common import calculateDeltaSeconds
from lib.core.common import cleanQuery
from lib.core.common import dataToSessionFile
from lib.core.common import dataToStdout
from lib.core.common import expandAsteriskForColumns
from lib.core.common import getPublicTypeMembers
from lib.core.common import initTechnique
@ -36,6 +35,7 @@ from lib.core.enums import PAYLOAD
from lib.core.exception import sqlmapNotVulnerableException
from lib.core.settings import MIN_TIME_RESPONSES
from lib.core.settings import MAX_TECHNIQUES_PER_VALUE
from lib.core.threads import getCurrentThreadData
from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request
from lib.request.direct import direct
@ -391,8 +391,7 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse
(if selected).
"""
if suppressOutput:
kb.disableStdOut = True
getCurrentThreadData().disableStdOut = suppressOutput
try:
if conf.direct:
@ -472,8 +471,7 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse
raise sqlmapNotVulnerableException, errMsg
finally:
if suppressOutput:
kb.disableStdOut = False
getCurrentThreadData().disableStdOut = False
if value and expected == EXPECTED.BOOL:
if isinstance(value, basestring):

View File

@ -12,6 +12,7 @@ import time
from lib.core.common import calculateDeltaSeconds
from lib.core.common import dataToSessionFile
from lib.core.common import dataToStdout
from lib.core.common import safeStringFormat
from lib.core.common import randomStr
from lib.core.common import replaceNewlineTabs
@ -129,7 +130,7 @@ def resume(expression, payload):
else:
infoMsg += logValue
logger.info(infoMsg)
dataToStdout("[%s] [INFO] %s\n" % (time.strftime("%X"), infoMsg))
return resumedValue

View File

@ -46,6 +46,7 @@ from lib.core.session import setOs
from lib.core.settings import SQL_STATEMENTS
from lib.core.shell import autoCompletion
from lib.core.unescaper import unescaper
from lib.core.threads import getCurrentThreadData
from lib.parse.banner import bannerParser
from lib.request import inject
from lib.request.connect import Connect as Request
@ -309,7 +310,7 @@ class Enumeration:
break
else:
query = rootQuery.blind.query % user
kb.disableStdOut = True
getCurrentThreadData().disableStdOut = True
elif kb.dbms == DBMS.MSSQL:
if kb.dbmsVersion[0] in ( "2005", "2008" ):
query = rootQuery.blind.query2 % (user, index, user)
@ -319,7 +320,7 @@ class Enumeration:
query = rootQuery.blind.query % (user, index)
password = inject.getValue(query, inband=False)
if kb.dbms == DBMS.SYBASE:
kb.disableStdOut = False
getCurrentThreadData().disableStdOut = False
password = "0x%s" % strToHex(password)
infoMsg = "retrieved: %s" % password
logger.info(infoMsg)