|
41 | 41 | from lib.core.exception import SqlmapNoneDataException |
42 | 42 | from lib.core.exception import SqlmapUnsupportedFeatureException |
43 | 43 | from lib.core.settings import BINARY_FIELDS_TYPE_REGEX |
| 44 | +from lib.core.settings import MYSQL_BINARY_CAST_TYPE_REGEX |
44 | 45 | from lib.core.settings import CHECK_ZERO_COLUMNS_THRESHOLD |
45 | 46 | from lib.core.settings import CURRENT_DB |
46 | 47 | from lib.core.settings import KEYSET_MIN_ROWS |
@@ -178,8 +179,8 @@ def dumpTable(self, foundData=None): |
178 | 179 | # type is already known from the enumeration above, so this costs no extra request. |
179 | 180 | # (PostgreSQL excluded: its bytea already renders as readable '\xHEX' through the default text |
180 | 181 | # cast, and its hex path needs text input, so auto-hexing would double-encode.) |
181 | | - # MySQL BIT stores raw bits that the NCHAR text-cast NULLs (unlike MSSQL/PostgreSQL 'bit', which render as 0/1 or a bit-string), so hex it too |
182 | | - autoBinary = [] if Backend.isDbms(DBMS.PGSQL) else [column for column in colList if columns.get(column) and (re.search(BINARY_FIELDS_TYPE_REGEX, getUnicode(columns[column])) or (Backend.isDbms(DBMS.MYSQL) and re.search(r"(?i)\Abit\b", getUnicode(columns[column]))))] |
| 182 | + # MySQL BIT/spatial store raw bytes the NCHAR text-cast NULLs (unlike MSSQL/PostgreSQL 'bit', which render fine), so hex them too |
| 183 | + autoBinary = [] if Backend.isDbms(DBMS.PGSQL) else [column for column in colList if columns.get(column) and (re.search(BINARY_FIELDS_TYPE_REGEX, getUnicode(columns[column])) or (Backend.isDbms(DBMS.MYSQL) and re.search(MYSQL_BINARY_CAST_TYPE_REGEX, getUnicode(columns[column]))))] |
183 | 184 | conf.binaryFields = (list(binaryFields) if binaryFields else []) + [_ for _ in autoBinary if not (binaryFields and _ in binaryFields)] |
184 | 185 | if autoBinary: |
185 | 186 | debugMsg = "auto-treating binary column(s) '%s' as binary fields" % ', '.join(unsafeSQLIdentificatorNaming(_) for _ in autoBinary) |
|
0 commit comments