mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-31 07:57:47 +03:00 
			
		
		
		
	some refactoring
This commit is contained in:
		
							parent
							
								
									36999a07c4
								
							
						
					
					
						commit
						5852bad963
					
				|  | @ -21,6 +21,7 @@ import urlparse | ||||||
| import ntpath | import ntpath | ||||||
| import posixpath | import posixpath | ||||||
| import subprocess | import subprocess | ||||||
|  | import threading | ||||||
| 
 | 
 | ||||||
| from ConfigParser import DEFAULTSECT | from ConfigParser import DEFAULTSECT | ||||||
| from ConfigParser import RawConfigParser | from ConfigParser import RawConfigParser | ||||||
|  | @ -1533,14 +1534,17 @@ def pushValue(value): | ||||||
|     Push value to the stack |     Push value to the stack | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|     kb.valueStack.append(value) |     threadId = threading.currentThread().ident | ||||||
|  |     if threadId not in kb.valueStack: | ||||||
|  |         kb.valueStack[threadId] = [] | ||||||
|  |     kb.valueStack[threadId].append(value) | ||||||
| 
 | 
 | ||||||
| def popValue(): | def popValue(): | ||||||
|     """ |     """ | ||||||
|     Pop value from the stack |     Pop value from the stack | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|     return kb.valueStack.pop() |     return kb.valueStack[threading.currentThread().ident].pop() | ||||||
| 
 | 
 | ||||||
| def wasLastRequestDBMSError(): | def wasLastRequestDBMSError(): | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|  | @ -1118,7 +1118,6 @@ def __setConfAttributes(): | ||||||
|     conf.sessionFP        = None |     conf.sessionFP        = None | ||||||
|     conf.start            = True |     conf.start            = True | ||||||
|     conf.tests            = [] |     conf.tests            = [] | ||||||
|     conf.threadContinue   = True |  | ||||||
|     conf.threadException  = False |     conf.threadException  = False | ||||||
|     conf.trafficFP        = None |     conf.trafficFP        = None | ||||||
|     conf.wFileType        = None |     conf.wFileType        = None | ||||||
|  | @ -1198,11 +1197,12 @@ def __setKnowledgeBaseAttributes(flushAll=True): | ||||||
|     kb.technique       = None |     kb.technique       = None | ||||||
|     kb.testMode        = False |     kb.testMode        = False | ||||||
|     kb.testQueryCount  = 0 |     kb.testQueryCount  = 0 | ||||||
|  |     kb.threadContinue  = True | ||||||
|     kb.unionComment    = "" |     kb.unionComment    = "" | ||||||
|     kb.unionCount      = None |     kb.unionCount      = None | ||||||
|     kb.unionPosition   = None |     kb.unionPosition   = None | ||||||
|     kb.unionNegative   = False |     kb.unionNegative   = False | ||||||
|     kb.valueStack      = [] |     kb.valueStack      = {} | ||||||
| 
 | 
 | ||||||
|     if flushAll: |     if flushAll: | ||||||
|         kb.keywords        = set(getFileItems(paths.SQL_KEYWORDS)) |         kb.keywords        = set(getFileItems(paths.SQL_KEYWORDS)) | ||||||
|  |  | ||||||
|  | @ -422,7 +422,7 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse | ||||||
| 
 | 
 | ||||||
|                 found = value or (value is None and expectingNone) |                 found = value or (value is None and expectingNone) | ||||||
| 
 | 
 | ||||||
|             pushValue(kb.unionNegative) |             oldUnionNegative = kb.unionNegative | ||||||
|             kb.unionNegative = False |             kb.unionNegative = False | ||||||
| 
 | 
 | ||||||
|             if error and isTechniqueAvailable(PAYLOAD.TECHNIQUE.ERROR) and not found: |             if error and isTechniqueAvailable(PAYLOAD.TECHNIQUE.ERROR) and not found: | ||||||
|  | @ -456,7 +456,7 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse | ||||||
|                 else: |                 else: | ||||||
|                     value = __goInferenceProxy(query, fromUser, expected, batch, resumeValue, unpack, charsetType, firstChar, lastChar) |                     value = __goInferenceProxy(query, fromUser, expected, batch, resumeValue, unpack, charsetType, firstChar, lastChar) | ||||||
| 
 | 
 | ||||||
|             kb.unionNegative = popValue() |             kb.unionNegative = oldUnionNegative | ||||||
| 
 | 
 | ||||||
|             if value and isinstance(value, basestring): |             if value and isinstance(value, basestring): | ||||||
|                 value = value.strip() |                 value = value.strip() | ||||||
|  |  | ||||||
|  | @ -260,11 +260,11 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None | ||||||
|         iolock  = threading.Lock() |         iolock  = threading.Lock() | ||||||
|         valuelock  = threading.Lock() |         valuelock  = threading.Lock() | ||||||
|         kb.locks.seqLock = threading.Lock() |         kb.locks.seqLock = threading.Lock() | ||||||
|         conf.threadContinue = True |         kb.threadContinue = True | ||||||
| 
 | 
 | ||||||
|         def downloadThread(): |         def downloadThread(): | ||||||
|             try: |             try: | ||||||
|                 while conf.threadContinue: |                 while kb.threadContinue: | ||||||
|                     idxlock.acquire() |                     idxlock.acquire() | ||||||
| 
 | 
 | ||||||
|                     if index[0] >= length: |                     if index[0] >= length: | ||||||
|  | @ -276,7 +276,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None | ||||||
|                     curidx = index[0] |                     curidx = index[0] | ||||||
|                     idxlock.release() |                     idxlock.release() | ||||||
| 
 | 
 | ||||||
|                     if conf.threadContinue: |                     if kb.threadContinue: | ||||||
|                         charStart = time.time() |                         charStart = time.time() | ||||||
|                         val = getChar(curidx) |                         val = getChar(curidx) | ||||||
|                         if val is None: |                         if val is None: | ||||||
|  | @ -289,7 +289,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None | ||||||
|                     currentValue = list(value) |                     currentValue = list(value) | ||||||
|                     valuelock.release() |                     valuelock.release() | ||||||
| 
 | 
 | ||||||
|                     if conf.threadContinue: |                     if kb.threadContinue: | ||||||
|                         if showEta: |                         if showEta: | ||||||
|                             etaProgressUpdate(time.time() - charStart, index[0]) |                             etaProgressUpdate(time.time() - charStart, index[0]) | ||||||
|                         elif conf.verbose >= 1: |                         elif conf.verbose >= 1: | ||||||
|  | @ -327,7 +327,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None | ||||||
|                             dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), replaceNewlineTabs(output, stdout=True))) |                             dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), replaceNewlineTabs(output, stdout=True))) | ||||||
|                             iolock.release() |                             iolock.release() | ||||||
| 
 | 
 | ||||||
|                 if not conf.threadContinue: |                 if not kb.threadContinue: | ||||||
|                     if int(threading.currentThread().getName()) == numThreads - 1: |                     if int(threading.currentThread().getName()) == numThreads - 1: | ||||||
|                         partialValue = unicode() |                         partialValue = unicode() | ||||||
|                         for v in value: |                         for v in value: | ||||||
|  | @ -380,7 +380,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None | ||||||
|                         alive = True |                         alive = True | ||||||
|                         thread.join(5) |                         thread.join(5) | ||||||
|         except KeyboardInterrupt: |         except KeyboardInterrupt: | ||||||
|             conf.threadContinue = False |             kb.threadContinue = False | ||||||
|             raise |             raise | ||||||
| 
 | 
 | ||||||
|         infoMsg = None |         infoMsg = None | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user