well, here and there, merry Christmas to all :)

This commit is contained in:
Miroslav Stampar 2010-12-24 20:17:53 +00:00
parent 706d8e0b88
commit 6845d402fa
2 changed files with 55 additions and 13 deletions

View File

@ -123,12 +123,24 @@ def columnExists(columnFile):
infoMsg = "checking column existence using items from '%s'" % columnFile
logger.info(infoMsg)
count = 0
count = [0]
length = len(columns)
threads = []
collock = threading.Lock()
iolock = threading.Lock()
kb.locks.seqLock = threading.Lock()
kb.threadContinue = True
def columnExistsThread():
while count[0] < length and kb.threadContinue:
collock.acquire()
column = columns[count[0]]
count[0] += 1
collock.release()
for column in columns:
result = inject.checkBooleanExpression("%s" % safeStringFormat("EXISTS(SELECT %s FROM %s)", (column, table)))
iolock.acquire()
if result:
retVal.append(column)
@ -137,11 +149,41 @@ def columnExists(columnFile):
infoMsg = "\r[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), column)
dataToStdout(infoMsg, True)
count += 1
if conf.verbose in (1, 2):
status = '%d/%d items (%d%s)' % (count, length, round(100.0*count/length), '%')
status = '%d/%d items (%d%s)' % (count[0], length, round(100.0*count[0]/length), '%')
dataToStdout("\r[%s] [INFO] tried: %s" % (time.strftime("%X"), status), True)
iolock.release()
# Start the threads
for numThread in range(conf.threads):
thread = threading.Thread(target=columnExistsThread, name=str(numThread))
thread.start()
threads.append(thread)
# And wait for them to all finish
try:
alive = True
while alive:
alive = False
for thread in threads:
if thread.isAlive():
alive = True
thread.join(5)
except KeyboardInterrupt:
kb.threadContinue = False
kb.threadException = True
print
logger.debug("waiting for threads to finish")
try:
while (threading.activeCount() > 1):
pass
except KeyboardInterrupt:
raise sqlmapThreadException, "user aborted"
finally:
kb.locks.seqLock = None
clearConsoleLine(True)

View File

@ -1227,7 +1227,7 @@ class Enumeration:
value = value[:-1] + chr(ord(value[-1]) + 1)
query = rootQuery.blind.query % (column, conf.tbl, column, value)
else:
query = rootQuery.blind.query2 % (column, conf.tbl, colList[0], entries[column][index])
query = rootQuery.blind.query2 % (column, conf.tbl, colList[0], entries[colList[0]][index])
value = inject.getValue(query, inband=False)
lengths[column] = max(lengths[column], len(value))