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

Skip to content

Commit 82f0f06

Browse files
committed
Fixes #3646
1 parent 2d4ceaf commit 82f0f06

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty import six
1919

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

thirdparty/clientform/clientform.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def _show_debug_messages():
109109
except ImportError:
110110
from lib.utils import sgmllib
111111

112-
import sys, types, copy, re, random
112+
import sys, re, random
113113

114114
if sys.version_info >= (3, 0):
115115
xrange = range
@@ -149,6 +149,14 @@ def compress_text(text): return _compress_re.sub(" ", text.strip())
149149
def normalize_line_endings(text):
150150
return re.sub(r"(?:(?<!\r)\n)|(?:\r(?!\n))", "\r\n", text)
151151

152+
def _quote_plus(value):
153+
if not isinstance(value, six.string_types):
154+
value = six.text_type(value)
155+
156+
if isinstance(value, six.text_type):
157+
value = value.encode("utf8")
158+
159+
return _urllib.parse.quote_plus(value)
152160

153161
# This version of urlencode is from my Python 1.5.2 back-port of the
154162
# Python 2.1 CVS maintenance branch of urllib. It will accept a sequence
@@ -190,33 +198,27 @@ def urlencode(query,doseq=False,):
190198
if not doseq:
191199
# preserve old behavior
192200
for k, v in query:
193-
k = _urllib.parse.quote_plus(str(k))
194-
v = _urllib.parse.quote_plus(str(v))
201+
k = _quote_plus(k)
202+
v = _quote_plus(v)
195203
l.append(k + '=' + v)
196204
else:
197205
for k, v in query:
198-
k = _urllib.parse.quote_plus(str(k))
199-
if type(v) == types.StringType:
200-
v = _urllib.parse.quote_plus(v)
201-
l.append(k + '=' + v)
202-
elif type(v) == types.UnicodeType:
203-
# is there a reasonable way to convert to ASCII?
204-
# encode generates a string, but "replace" or "ignore"
205-
# lose information and "strict" can raise UnicodeError
206-
v = _urllib.parse.quote_plus(v.encode("ASCII","replace"))
206+
k = _quote_plus(k)
207+
if isinstance(v, six.string_types):
208+
v = _quote_plus(v)
207209
l.append(k + '=' + v)
208210
else:
209211
try:
210212
# is this a sufficient test for sequence-ness?
211213
x = len(v)
212214
except TypeError:
213215
# not a sequence
214-
v = _urllib.parse.quote_plus(str(v))
216+
v = _quote_plus(v)
215217
l.append(k + '=' + v)
216218
else:
217219
# loop over the sequence
218220
for elt in v:
219-
l.append(k + '=' + _urllib.parse.quote_plus(str(elt)))
221+
l.append(k + '=' + _quote_plus(elt))
220222
return '&'.join(l)
221223

222224
def unescape(data, entities, encoding=DEFAULT_ENCODING):

0 commit comments

Comments
 (0)