diff --git a/lib/core/agent.py b/lib/core/agent.py index 1604f83cd..68fc22817 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -37,7 +37,6 @@ from lib.core.settings import BOUNDARY_BACKSLASH_MARKER from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR from lib.core.settings import DEFAULT_COOKIE_DELIMITER from lib.core.settings import DEFAULT_GET_POST_DELIMITER -from lib.core.settings import DEFAULT_MYSQL_CHARACTER_SET from lib.core.settings import GENERIC_SQL_COMMENT from lib.core.settings import PAYLOAD_DELIMITER from lib.core.settings import REPLACEMENT_MARKER @@ -401,10 +400,7 @@ class Agent(object): nulledCastedField = field else: if not (Backend.isDbms(DBMS.SQLITE) and not isDBMSVersionAtLeast('3')): - if Backend.isDbms(DBMS.MYSQL): - nulledCastedField = rootQuery.cast.query.replace(")", " CHARACTER SET %s)") % (field, DEFAULT_MYSQL_CHARACTER_SET) - else: - nulledCastedField = rootQuery.cast.query % field + nulledCastedField = rootQuery.cast.query % field if Backend.getIdentifiedDbms() in (DBMS.ACCESS,): nulledCastedField = rootQuery.isnull.query % (nulledCastedField, nulledCastedField) else: diff --git a/lib/core/settings.py b/lib/core/settings.py index 1e14fd755..d478ae50a 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -224,10 +224,6 @@ HOST_ALIASES = ("host",) HSQLDB_DEFAULT_SCHEMA = "PUBLIC" -# Default character set used in MySQL -# Reference: http://pieroxy.net/blog/2013/05/28/mysql_charset_hell.html -DEFAULT_MYSQL_CHARACTER_SET = "latin1" - # Names that can't be used to name files on Windows OS WINDOWS_RESERVED_NAMES = ("CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9") diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 39fad7e77..db6df84a1 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -37,7 +37,6 @@ from lib.core.enums import DBMS from lib.core.enums import PAYLOAD from lib.core.exception import SqlmapThreadException from lib.core.settings import CHAR_INFERENCE_MARK -from lib.core.settings import DEFAULT_MYSQL_CHARACTER_SET from lib.core.settings import INFERENCE_BLANK_BREAK from lib.core.settings import INFERENCE_UNKNOWN_CHAR from lib.core.settings import INFERENCE_GREATER_CHAR @@ -593,9 +592,6 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None _ = finalValue or partialValue - if Backend.isDbms(DBMS.MYSQL) and safechardecode(_) != _: - _ = getUnicode(safechardecode(_).encode(DEFAULT_MYSQL_CHARACTER_SET)) - return getCounter(kb.technique), safecharencode(_) if kb.safeCharEncode else _ def queryOutputLength(expression, payload): diff --git a/plugins/dbms/mysql/syntax.py b/plugins/dbms/mysql/syntax.py index 312141b55..e593a51fb 100644 --- a/plugins/dbms/mysql/syntax.py +++ b/plugins/dbms/mysql/syntax.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission import binascii from lib.core.convert import utf8encode -from lib.core.settings import DEFAULT_MYSQL_CHARACTER_SET from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): @@ -27,7 +26,7 @@ class Syntax(GenericSyntax): try: retVal = "0x%s" % binascii.hexlify(value) except UnicodeEncodeError: - retVal = "CONVERT(0x%s USING %s)" % ("".join("%.2x" % ord(_) for _ in utf8encode(value)), DEFAULT_MYSQL_CHARACTER_SET) + retVal = "CONVERT(0x%s USING utf8)" % "".join("%.2x" % ord(_) for _ in utf8encode(value)) return retVal return Syntax._escape(expression, quote, escaper)