Minor layout adjustments

This commit is contained in:
Bernardo Damele 2010-02-04 17:45:56 +00:00
parent 22995787d1
commit b08a4efb4b

View File

@ -42,6 +42,7 @@ from lib.core.exception import unhandledException
from lib.core.progress import ProgressBar from lib.core.progress import ProgressBar
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
def bisection(payload, expression, length=None, charsetType=None, firstChar=None, lastChar=None): def bisection(payload, expression, length=None, charsetType=None, firstChar=None, lastChar=None):
""" """
Bisection algorithm that can be used to perform blind SQL injection Bisection algorithm that can be used to perform blind SQL injection
@ -110,6 +111,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
dataToStdout("[%s] [INFO] retrieved: " % time.strftime("%X")) dataToStdout("[%s] [INFO] retrieved: " % time.strftime("%X"))
queriesCount = [0] # As list to deal with nested scoping rules queriesCount = [0] # As list to deal with nested scoping rules
def getChar(idx, asciiTbl=asciiTbl): def getChar(idx, asciiTbl=asciiTbl):
maxValue = asciiTbl[len(asciiTbl)-1] maxValue = asciiTbl[len(asciiTbl)-1]
minValue = 0 minValue = 0
@ -133,6 +135,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
return None return None
else: else:
return chr(minValue + 1) return chr(minValue + 1)
def etaProgressUpdate(charTime, index): def etaProgressUpdate(charTime, index):
if len(progressTime) <= ( (length * 3) / 100 ): if len(progressTime) <= ( (length * 3) / 100 ):
eta = 0 eta = 0
@ -144,11 +147,13 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
progressTime.append(charTime) progressTime.append(charTime)
progress.update(index) progress.update(index)
progress.draw(eta) progress.draw(eta)
if conf.threads > 1 and isinstance(length, int) and length > 1: if conf.threads > 1 and isinstance(length, int) and length > 1:
value = [ None ] * length value = [ None ] * length
index = [ firstChar ] # As list for python nested function scoping index = [ firstChar ] # As list for python nested function scoping
idxlock = threading.Lock() idxlock = threading.Lock()
iolock = threading.Lock() iolock = threading.Lock()
def downloadThread(): def downloadThread():
try: try:
while True: while True:
@ -201,6 +206,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
errMsg = unhandledException() errMsg = unhandledException()
logger.error("thread %d: %s" % (numThread + 1, errMsg)) logger.error("thread %d: %s" % (numThread + 1, errMsg))
traceback.print_exc() traceback.print_exc()
# Start the threads # Start the threads
for numThread in range(numThreads): for numThread in range(numThreads):
thread = threading.Thread(target=downloadThread) thread = threading.Thread(target=downloadThread)