diff --git a/plugins/dbms/mysql/syntax.py b/plugins/dbms/mysql/syntax.py index 1d2c9fb6e..108f33e84 100644 --- a/plugins/dbms/mysql/syntax.py +++ b/plugins/dbms/mysql/syntax.py @@ -10,6 +10,7 @@ See the file 'doc/COPYING' for copying permission import binascii import re +from lib.core.convert import utf8encode from lib.core.exception import sqlmapSyntaxException from plugins.generic.syntax import Syntax as GenericSyntax @@ -25,7 +26,7 @@ class Syntax(GenericSyntax): try: unescaped = unescaped.replace(item, "0x%s" % binascii.hexlify(item.strip("'"))) except UnicodeEncodeError: - unescaped = unescaped.replace(item, "CHAR(0x%s USING utf8)" % "".join(("%.2x" % ord(_)) if ord(_) < 256 else ("%.4x" % ord(_)) for _ in item.strip("'"))) + unescaped = unescaped.replace(item, "CONVERT(0x%s USING utf8)" % "".join("%.2x" % ord(_) for _ in utf8encode(item.strip("'")))) else: unescaped = "0x%s" % binascii.hexlify(expression)