4242from lib .core .progress import ProgressBar
4343from lib .core .unescaper import unescaper
4444from lib .request .connect import Connect as Request
45+
4546def bisection (payload , expression , length = None , charsetType = None , firstChar = None , lastChar = None ):
4647 """
4748 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
110111 dataToStdout ("[%s] [INFO] retrieved: " % time .strftime ("%X" ))
111112
112113 queriesCount = [0 ] # As list to deal with nested scoping rules
114+
113115 def getChar (idx , asciiTbl = asciiTbl ):
114116 maxValue = asciiTbl [len (asciiTbl )- 1 ]
115117 minValue = 0
@@ -133,6 +135,7 @@ def getChar(idx, asciiTbl=asciiTbl):
133135 return None
134136 else :
135137 return chr (minValue + 1 )
138+
136139 def etaProgressUpdate (charTime , index ):
137140 if len (progressTime ) <= ( (length * 3 ) / 100 ):
138141 eta = 0
@@ -144,11 +147,13 @@ def etaProgressUpdate(charTime, index):
144147 progressTime .append (charTime )
145148 progress .update (index )
146149 progress .draw (eta )
150+
147151 if conf .threads > 1 and isinstance (length , int ) and length > 1 :
148152 value = [ None ] * length
149153 index = [ firstChar ] # As list for python nested function scoping
150154 idxlock = threading .Lock ()
151155 iolock = threading .Lock ()
156+
152157 def downloadThread ():
153158 try :
154159 while True :
@@ -201,6 +206,7 @@ def downloadThread():
201206 errMsg = unhandledException ()
202207 logger .error ("thread %d: %s" % (numThread + 1 , errMsg ))
203208 traceback .print_exc ()
209+
204210 # Start the threads
205211 for numThread in range (numThreads ):
206212 thread = threading .Thread (target = downloadThread )
0 commit comments