Skip to content

Commit 9b6d30d

Browse files
committed
Minor improvement for international strings in payloads
1 parent 257fa3e commit 9b6d30d

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

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.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.5.156"
21+
VERSION = "1.3.5.157"
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)

lib/core/unescaper.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
class Unescaper(AttribDict):
1414
def escape(self, expression, quote=True, dbms=None):
15-
if conf.noEscape:
16-
return expression
17-
1815
if expression is None:
1916
return expression
2017

plugins/generic/syntax.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import re
99

10+
from lib.core.convert import getBytes
11+
from lib.core.data import conf
1012
from lib.core.exception import SqlmapUndefinedMethod
1113

1214
class Syntax(object):
@@ -23,9 +25,14 @@ def _escape(expression, quote=True, escaper=None):
2325

2426
if quote:
2527
for item in re.findall(r"'[^']*'+", expression):
26-
_ = item[1:-1]
27-
if _:
28-
retVal = retVal.replace(item, escaper(_))
28+
original = item[1:-1]
29+
if original:
30+
replacement = escaper(original) if not conf.noEscape else original
31+
32+
if replacement != original:
33+
retVal = retVal.replace(item, replacement)
34+
elif len(original) != len(getBytes(original)) and "n'%s'" % original not in retVal:
35+
retVal = retVal.replace("'%s'" % original, "n'%s'" % original)
2936
else:
3037
retVal = escaper(expression)
3138

0 commit comments

Comments
 (0)