Skip to content

Commit 788c9fa

Browse files
committed
Minor patch
1 parent 8f6a372 commit 788c9fa

2 files changed

Lines changed: 25 additions & 23 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.7.32"
23+
VERSION = "1.10.7.33"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/connect.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -524,31 +524,33 @@ def getPage(**kwargs):
524524

525525
if webSocket:
526526
ws = websocket.WebSocket()
527-
ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout)
528-
wsHeaders = tuple("%s: %s" % (getUnicode(key), getUnicode(value)) for key, value in headers.items() if getUnicode(key).upper() != HTTP_HEADER.HOST.upper())
529-
ws.connect(url, header=wsHeaders, cookie=cookie) # WebSocket will add Host field of headers automatically
530-
ws.send(urldecode(post or ""))
531-
532-
_page = []
533-
534-
if kb.webSocketRecvCount is None:
535-
while True:
536-
try:
537-
_page.append(ws.recv())
538-
if sum(len(_) for _ in _page) > MAX_CONNECTION_TOTAL_SIZE:
539-
warnMsg = "too large websocket response detected. Automatically trimming it"
540-
singleTimeWarnMessage(warnMsg)
527+
try:
528+
ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout)
529+
wsHeaders = tuple("%s: %s" % (getUnicode(key), getUnicode(value)) for key, value in headers.items() if getUnicode(key).upper() != HTTP_HEADER.HOST.upper())
530+
ws.connect(url, header=wsHeaders, cookie=cookie) # WebSocket will add Host field of headers automatically
531+
ws.send(urldecode(post or ""))
532+
533+
_page = []
534+
535+
if kb.webSocketRecvCount is None:
536+
while True:
537+
try:
538+
_page.append(ws.recv())
539+
if sum(len(_) for _ in _page) > MAX_CONNECTION_TOTAL_SIZE:
540+
warnMsg = "too large websocket response detected. Automatically trimming it"
541+
singleTimeWarnMessage(warnMsg)
542+
break
543+
except websocket.WebSocketTimeoutException:
544+
kb.webSocketRecvCount = len(_page)
541545
break
542-
except websocket.WebSocketTimeoutException:
543-
kb.webSocketRecvCount = len(_page)
544-
break
545-
else:
546-
for i in xrange(max(1, kb.webSocketRecvCount)):
547-
_page.append(ws.recv())
546+
else:
547+
for i in xrange(max(1, kb.webSocketRecvCount)):
548+
_page.append(ws.recv())
548549

549-
page = "\n".join(_page)
550+
page = "\n".join(_page)
551+
finally:
552+
ws.close()
550553

551-
ws.close()
552554
code = ws.status
553555
status = _http_client.responses.get(code, "")
554556

0 commit comments

Comments
 (0)