minor update/patch

This commit is contained in:
Miroslav Stampar 2012-01-01 22:55:32 +00:00
parent 300abc2ba2
commit 6f5ef23f28

View File

@ -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)