Fixed store and resume of brute-forced tables/columns for MSSQL/Sybase

This commit is contained in:
Bernardo Damele 2011-02-10 11:14:05 +00:00
parent aa0fb276ba
commit 864eade744
3 changed files with 12 additions and 9 deletions

View File

@ -20,6 +20,7 @@ from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.datatype import injectionDict from lib.core.datatype import injectionDict
from lib.core.enums import DBMS
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import PLACE from lib.core.enums import PLACE
from lib.core.settings import METADB_SUFFIX from lib.core.settings import METADB_SUFFIX
@ -237,9 +238,10 @@ def resumeConfKb(expression, url, value):
elif expression == "TABLE_EXISTS" and url == conf.url: elif expression == "TABLE_EXISTS" and url == conf.url:
table = unSafeFormatString(value[:-1]) table = unSafeFormatString(value[:-1])
split = '..' if Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE) else '.'
if '.' in table: if split in table:
db, table = table.split('.') db, table = table.split(split)
else: else:
db = "%s%s" % (Backend.getIdentifiedDbms(), METADB_SUFFIX) db = "%s%s" % (Backend.getIdentifiedDbms(), METADB_SUFFIX)
@ -252,9 +254,10 @@ def resumeConfKb(expression, url, value):
elif expression == "COLUMN_EXISTS" and url == conf.url: elif expression == "COLUMN_EXISTS" and url == conf.url:
table, column = unSafeFormatString(value[:-1]).split('|') table, column = unSafeFormatString(value[:-1]).split('|')
colName, colType = column.split(' ') colName, colType = column.split(' ')
split = '..' if Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE) else '.'
if '.' in table: if split in table:
db, table = table.split('.') db, table = table.split(split)
else: else:
db = "%s%s" % (Backend.getIdentifiedDbms(), METADB_SUFFIX) db = "%s%s" % (Backend.getIdentifiedDbms(), METADB_SUFFIX)

View File

@ -502,4 +502,8 @@ def goStacked(expression, silent=False):
Request.queryPage(payload, content=False, silent=silent, noteResponseTime=False, timeBasedCompare=True) Request.queryPage(payload, content=False, silent=silent, noteResponseTime=False, timeBasedCompare=True)
def checkBooleanExpression(expression, expectingNone=True): def checkBooleanExpression(expression, expectingNone=True):
return getValue(unescaper.unescape(expression), expected=EXPECTED.BOOL, suppressOutput=True, expectingNone=expectingNone) kb.suppressSession = True
value = getValue(unescaper.unescape(expression), expected=EXPECTED.BOOL, suppressOutput=True, expectingNone=expectingNone)
kb.suppressSession = False
return value

View File

@ -55,7 +55,6 @@ def tableExists(tableFile, regex=None):
tbllock = threading.Lock() tbllock = threading.Lock()
iolock = threading.Lock() iolock = threading.Lock()
kb.threadContinue = True kb.threadContinue = True
kb.suppressSession = True
def tableExistsThread(): def tableExistsThread():
while count[0] < length and kb.threadContinue: while count[0] < length and kb.threadContinue:
@ -131,7 +130,6 @@ def tableExists(tableFile, regex=None):
finally: finally:
kb.threadContinue = True kb.threadContinue = True
kb.threadException = False kb.threadException = False
kb.suppressSession = False
clearConsoleLine(True) clearConsoleLine(True)
dataToStdout("\n") dataToStdout("\n")
@ -171,7 +169,6 @@ def columnExists(columnFile, regex=None):
collock = threading.Lock() collock = threading.Lock()
iolock = threading.Lock() iolock = threading.Lock()
kb.threadContinue = True kb.threadContinue = True
kb.suppressSession = True
def columnExistsThread(): def columnExistsThread():
while count[0] < length and kb.threadContinue: while count[0] < length and kb.threadContinue:
@ -238,7 +235,6 @@ def columnExists(columnFile, regex=None):
finally: finally:
kb.threadContinue = True kb.threadContinue = True
kb.threadException = False kb.threadException = False
kb.suppressSession = False
clearConsoleLine(True) clearConsoleLine(True)
dataToStdout("\n") dataToStdout("\n")