Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73b0de6

Browse files
committed
Fixes #3149
1 parent fae97b3 commit 73b0de6

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

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

lib/request/redirecthandler.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8-
import re
98
import time
109
import types
1110
import urllib2
@@ -124,12 +123,21 @@ def http_error_302(self, req, fp, code, msg, headers):
124123

125124
req.headers[HTTP_HEADER.HOST] = getHostHeader(redurl)
126125
if headers and HTTP_HEADER.SET_COOKIE in headers:
126+
cookies = dict()
127127
delimiter = conf.cookieDel or DEFAULT_COOKIE_DELIMITER
128-
_ = headers[HTTP_HEADER.SET_COOKIE].split(delimiter)[0]
129-
if HTTP_HEADER.COOKIE not in req.headers:
130-
req.headers[HTTP_HEADER.COOKIE] = _
131-
else:
132-
req.headers[HTTP_HEADER.COOKIE] = re.sub(r"%s{2,}" % delimiter, delimiter, ("%s%s%s" % (re.sub(r"\b%s=[^%s]*%s?" % (re.escape(_.split('=')[0]), delimiter, delimiter), "", req.headers[HTTP_HEADER.COOKIE]), delimiter, _)).strip(delimiter))
128+
last = None
129+
130+
for part in req.headers.get(HTTP_HEADER.COOKIE, "").split(delimiter) + headers.getheaders(HTTP_HEADER.SET_COOKIE):
131+
if '=' in part:
132+
part = part.strip()
133+
key, value = part.split('=', 1)
134+
cookies[key] = value
135+
last = key
136+
elif last:
137+
cookies[key] += "%s%s" % (delimiter, part)
138+
139+
req.headers[HTTP_HEADER.COOKIE] = delimiter.join("%s=%s" % (key, cookies[key]) for key in cookies)
140+
133141
try:
134142
result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
135143
except urllib2.HTTPError, e:

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
4848
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
4949
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
5050
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
51-
cf3cd30872fdf466ebad56e425c72376 lib/core/settings.py
51+
76d92cc81e93bb60ee7f5948dea88678 lib/core/settings.py
5252
dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py
5353
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
5454
95f04c1c1d8c3998d86e1bdf0e12771c lib/core/target.py
@@ -79,7 +79,7 @@ c2fb1abbb7127ec6419bbf852c0a458d lib/request/inject.py
7979
aaf956c1e9855836c3f372e29d481393 lib/request/methodrequest.py
8080
51eeaa8abf5ba62aaaade66d46ff8b00 lib/request/pkihandler.py
8181
2c3774b72586985719035b195f144d7b lib/request/rangehandler.py
82-
aa809d825b33bea76a63ecd97cf7792c lib/request/redirecthandler.py
82+
0d0567907afa2aa1493fb90ce09edfc0 lib/request/redirecthandler.py
8383
7f12d8f3b6665ed7053954bba70ff718 lib/request/templates.py
8484
747f9941a68361bd779ec760f71568e9 lib/takeover/abstraction.py
8585
acc1db3667bf910b809eb279b60595eb lib/takeover/icmpsh.py

0 commit comments

Comments
 (0)