mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 02:53:46 +03:00
minor optimization and refactoring
This commit is contained in:
parent
0a7a648694
commit
5770c08784
|
@ -384,7 +384,7 @@ IDS_WAF_CHECK_PAYLOAD = "AND 1=1 UNION ALL SELECT 1,2,3,table_name FROM informat
|
||||||
ROTATING_CHARS = ('\\', '|', '|', '/', '-')
|
ROTATING_CHARS = ('\\', '|', '|', '/', '-')
|
||||||
|
|
||||||
# Chunk length (in items) used by BigArray objects (only last chunk and cached one are held in memory)
|
# Chunk length (in items) used by BigArray objects (only last chunk and cached one are held in memory)
|
||||||
BIGARRAY_CHUNK_LENGTH = 5000
|
BIGARRAY_CHUNK_LENGTH = 4096
|
||||||
|
|
||||||
# Only console display last n table rows
|
# Only console display last n table rows
|
||||||
TRIM_STDOUT_DUMP_SIZE = 256
|
TRIM_STDOUT_DUMP_SIZE = 1024
|
||||||
|
|
|
@ -320,8 +320,8 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False):
|
||||||
stopLimit = 1
|
stopLimit = 1
|
||||||
|
|
||||||
threadData = getCurrentThreadData()
|
threadData = getCurrentThreadData()
|
||||||
threadData.shared.limits = range(startLimit, stopLimit)
|
threadData.shared.limits = iter(xrange(startLimit, stopLimit))
|
||||||
numThreads = min(conf.threads, len(threadData.shared.limits))
|
numThreads = min(conf.threads, (stopLimit - startLimit))
|
||||||
threadData.shared.outputs = BigArray()
|
threadData.shared.outputs = BigArray()
|
||||||
|
|
||||||
if stopLimit > TURN_OFF_RESUME_INFO_LIMIT:
|
if stopLimit > TURN_OFF_RESUME_INFO_LIMIT:
|
||||||
|
@ -340,13 +340,12 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False):
|
||||||
|
|
||||||
while kb.threadContinue:
|
while kb.threadContinue:
|
||||||
kb.locks.limits.acquire()
|
kb.locks.limits.acquire()
|
||||||
if threadData.shared.limits:
|
try:
|
||||||
num = threadData.shared.limits[-1]
|
num = threadData.shared.limits.next()
|
||||||
del threadData.shared.limits[-1]
|
except StopIteration:
|
||||||
kb.locks.limits.release()
|
|
||||||
else:
|
|
||||||
kb.locks.limits.release()
|
|
||||||
break
|
break
|
||||||
|
finally:
|
||||||
|
kb.locks.limits.release()
|
||||||
|
|
||||||
output = __errorFields(expression, expressionFields, expressionFieldsList, expected, num, resumeValue)
|
output = __errorFields(expression, expressionFields, expressionFieldsList, expected, num, resumeValue)
|
||||||
|
|
||||||
|
|
|
@ -261,8 +261,8 @@ def unionUse(expression, unpack=True, dump=False):
|
||||||
stopLimit = 1
|
stopLimit = 1
|
||||||
|
|
||||||
threadData = getCurrentThreadData()
|
threadData = getCurrentThreadData()
|
||||||
threadData.shared.limits = range(startLimit, stopLimit)
|
threadData.shared.limits = iter(xrange(startLimit, stopLimit))
|
||||||
numThreads = min(conf.threads, len(threadData.shared.limits))
|
numThreads = min(conf.threads, (stopLimit - startLimit))
|
||||||
threadData.shared.value = BigArray()
|
threadData.shared.value = BigArray()
|
||||||
|
|
||||||
if stopLimit > TURN_OFF_RESUME_INFO_LIMIT:
|
if stopLimit > TURN_OFF_RESUME_INFO_LIMIT:
|
||||||
|
@ -281,13 +281,12 @@ def unionUse(expression, unpack=True, dump=False):
|
||||||
|
|
||||||
while kb.threadContinue:
|
while kb.threadContinue:
|
||||||
kb.locks.limits.acquire()
|
kb.locks.limits.acquire()
|
||||||
if threadData.shared.limits:
|
try:
|
||||||
num = threadData.shared.limits[-1]
|
num = threadData.shared.limits.next()
|
||||||
del threadData.shared.limits[-1]
|
except StopIteration:
|
||||||
kb.locks.limits.release()
|
|
||||||
else:
|
|
||||||
kb.locks.limits.release()
|
|
||||||
break
|
break
|
||||||
|
finally:
|
||||||
|
kb.locks.limits.release()
|
||||||
|
|
||||||
if Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE):
|
if Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE):
|
||||||
field = expressionFieldsList[0]
|
field = expressionFieldsList[0]
|
||||||
|
|
|
@ -266,7 +266,7 @@ def attackDumpedTable():
|
||||||
colUser = column
|
colUser = column
|
||||||
break
|
break
|
||||||
|
|
||||||
for i in range(count):
|
for i in xrange(count):
|
||||||
for column in columns:
|
for column in columns:
|
||||||
if column == colUser or column == '__infos__':
|
if column == colUser or column == '__infos__':
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -130,6 +130,7 @@ def main():
|
||||||
kb.threadException = True
|
kb.threadException = True
|
||||||
|
|
||||||
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
|
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
|
||||||
|
if conf.threads > 1:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user