mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
minor update
This commit is contained in:
parent
518b3e094c
commit
29001a4fce
|
@ -287,7 +287,7 @@ class Connect:
|
||||||
|
|
||||||
if silent or (ignoreTimeout and "timeout" in tbMsg):
|
if silent or (ignoreTimeout and "timeout" in tbMsg):
|
||||||
return None, None
|
return None, None
|
||||||
elif kb.retriesCount < conf.retries:
|
elif kb.retriesCount < conf.retries and not conf.threadException:
|
||||||
kb.retriesCount += 1
|
kb.retriesCount += 1
|
||||||
|
|
||||||
warnMsg += ", sqlmap is going to retry the request"
|
warnMsg += ", sqlmap is going to retry the request"
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from lib.core.common import clearConsoleLine
|
from lib.core.common import clearConsoleLine
|
||||||
|
@ -29,27 +30,59 @@ def tableExists(tableFile):
|
||||||
infoMsg = "checking table existence using items from '%s'" % tableFile
|
infoMsg = "checking table existence using items from '%s'" % tableFile
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
count = 0
|
count = [0]
|
||||||
length = len(tables)
|
length = len(tables)
|
||||||
|
threads = []
|
||||||
|
tbllock = threading.Lock()
|
||||||
|
iolock = threading.Lock()
|
||||||
|
kb.locks.seqLock = threading.Lock()
|
||||||
|
kb.threadContinue = True
|
||||||
|
|
||||||
|
def tableExistsThread():
|
||||||
|
while count[0] < length and kb.threadContinue:
|
||||||
|
tbllock.acquire()
|
||||||
|
table = tables[count[0]]
|
||||||
|
count[0] += 1
|
||||||
|
tbllock.release()
|
||||||
|
|
||||||
for table in tables:
|
if conf.db and not conf.db.endswith(METADB_SUFFIX):
|
||||||
if conf.db and not conf.db.endswith(METADB_SUFFIX):
|
table = "%s.%s" % (conf.db, table)
|
||||||
table = "%s.%s" % (conf.db, table)
|
result = inject.checkBooleanExpression("%s" % safeStringFormat("EXISTS(SELECT %d FROM %s)", (randomInt(1), table)))
|
||||||
result = inject.checkBooleanExpression("%s" % safeStringFormat("EXISTS(SELECT %d FROM %s)", (randomInt(1), table)))
|
|
||||||
|
|
||||||
if result:
|
iolock.acquire()
|
||||||
retVal.append(table)
|
if result:
|
||||||
|
retVal.append(table)
|
||||||
|
|
||||||
|
if conf.verbose in (1, 2):
|
||||||
|
clearConsoleLine(True)
|
||||||
|
infoMsg = "\r[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), table)
|
||||||
|
dataToStdout(infoMsg, True)
|
||||||
|
|
||||||
if conf.verbose in (1, 2):
|
if conf.verbose in (1, 2):
|
||||||
clearConsoleLine(True)
|
status = '%d/%d items (%d%s)' % (count[0], length, round(100.0*count[0]/length), '%')
|
||||||
infoMsg = "\r[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), table)
|
dataToStdout("\r[%s] [INFO] tried: %s" % (time.strftime("%X"), status), True)
|
||||||
dataToStdout(infoMsg, True)
|
iolock.release()
|
||||||
|
|
||||||
count += 1
|
# Start the threads
|
||||||
|
for numThread in range(conf.threads):
|
||||||
|
thread = threading.Thread(target=tableExistsThread, name=str(numThread))
|
||||||
|
thread.start()
|
||||||
|
threads.append(thread)
|
||||||
|
|
||||||
if conf.verbose in (1, 2):
|
# And wait for them to all finish
|
||||||
status = '%d/%d items (%d%s)' % (count, length, round(100.0*count/length), '%')
|
try:
|
||||||
dataToStdout("\r[%s] [INFO] tried: %s" % (time.strftime("%X"), status), True)
|
alive = True
|
||||||
|
while alive:
|
||||||
|
alive = False
|
||||||
|
for thread in threads:
|
||||||
|
if thread.isAlive():
|
||||||
|
alive = True
|
||||||
|
thread.join(5)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
kb.threadContinue = False
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
kb.locks.seqLock = None
|
||||||
|
|
||||||
clearConsoleLine(True)
|
clearConsoleLine(True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user