mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-30 23:47:45 +03:00 
			
		
		
		
	Patch for websocket (with multiple recv requirement)
This commit is contained in:
		
							parent
							
								
									1bfb9efb91
								
							
						
					
					
						commit
						c028fb9003
					
				|  | @ -2006,6 +2006,7 @@ def _setKnowledgeBaseAttributes(flushAll=True): | |||
|     kb.uChar = NULL | ||||
|     kb.udfFail = False | ||||
|     kb.unionDuplicates = False | ||||
|     kb.webSocketRecvCount = None | ||||
|     kb.wizardMode = False | ||||
|     kb.xpCmdshellAvailable = False | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ from lib.core.enums import OS | |||
| from thirdparty.six import unichr as _unichr | ||||
| 
 | ||||
| # sqlmap version (<major>.<minor>.<month>.<monthly commit>) | ||||
| VERSION = "1.3.11.112" | ||||
| VERSION = "1.3.11.113" | ||||
| TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" | ||||
| TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} | ||||
| VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) | ||||
|  | @ -232,6 +232,9 @@ STDIN_PIPE_DASH = '-' | |||
| # URL used in dummy runs | ||||
| DUMMY_URL = "http://foo/bar?id=1" | ||||
| 
 | ||||
| # Timeout used during initial websocket (pull) testing | ||||
| WEBSOCKET_INITIAL_TIMEOUT = 3 | ||||
| 
 | ||||
| # The name of the operating system dependent module imported. The following names have currently been registered: 'posix', 'nt', 'mac', 'os2', 'ce', 'java', 'riscos' | ||||
| PLATFORM = os.name | ||||
| PYVERSION = sys.version.split()[0] | ||||
|  |  | |||
|  | @ -119,6 +119,7 @@ from lib.core.settings import UNENCODED_ORIGINAL_VALUE | |||
| from lib.core.settings import UNICODE_ENCODING | ||||
| from lib.core.settings import URI_HTTP_HEADER | ||||
| from lib.core.settings import WARN_TIME_STDEV | ||||
| from lib.core.settings import WEBSOCKET_INITIAL_TIMEOUT | ||||
| from lib.request.basic import decodePage | ||||
| from lib.request.basic import forgeHeaders | ||||
| from lib.request.basic import processResponse | ||||
|  | @ -451,10 +452,25 @@ class Connect(object): | |||
| 
 | ||||
|             if webSocket: | ||||
|                 ws = websocket.WebSocket() | ||||
|                 ws.settimeout(timeout) | ||||
|                 ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout) | ||||
|                 ws.connect(url, header=("%s: %s" % _ for _ in headers.items() if _[0] not in ("Host",)), cookie=cookie)  # WebSocket will add Host field of headers automatically | ||||
|                 ws.send(urldecode(post or "")) | ||||
|                 page = ws.recv() | ||||
| 
 | ||||
|                 _page = [] | ||||
| 
 | ||||
|                 if kb.webSocketRecvCount is None: | ||||
|                     while True: | ||||
|                         try: | ||||
|                             _page.append(ws.recv()) | ||||
|                         except websocket.WebSocketTimeoutException: | ||||
|                             kb.webSocketRecvCount = len(_page) | ||||
|                             break | ||||
|                 else: | ||||
|                     for i in xrange(max(1, kb.webSocketRecvCount)): | ||||
|                         _page.append(ws.recv()) | ||||
| 
 | ||||
|                 page = "\n".join(_page) | ||||
| 
 | ||||
|                 ws.close() | ||||
|                 code = ws.status | ||||
|                 status = _http_client.responses[code] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user