distinguishing NULL from BLANK

This commit is contained in:
Miroslav Stampar 2012-03-14 13:52:23 +00:00
parent e38b59a2ae
commit ca0d068575
3 changed files with 10 additions and 6 deletions

View File

@ -28,6 +28,7 @@ from lib.core.data import logger
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.exception import sqlmapValueException from lib.core.exception import sqlmapValueException
from lib.core.replication import Replication from lib.core.replication import Replication
from lib.core.settings import BLANK
from lib.core.settings import BUFFERED_LOG_SIZE from lib.core.settings import BUFFERED_LOG_SIZE
from lib.core.settings import NULL from lib.core.settings import NULL
from lib.core.settings import TRIM_STDOUT_DUMP_SIZE from lib.core.settings import TRIM_STDOUT_DUMP_SIZE
@ -377,7 +378,7 @@ class Dump:
for value in tableValues[column]['values']: for value in tableValues[column]['values']:
try: try:
if not value or re.search("^[\ *]*$", value): #NULL if not value or value == " ": # NULL
continue continue
int(value) int(value)
@ -390,7 +391,7 @@ class Dump:
for value in tableValues[column]['values']: for value in tableValues[column]['values']:
try: try:
if not value or re.search("^[\ *]*$", value): #NULL if not value or value == " ": # NULL
continue continue
float(value) float(value)
@ -455,9 +456,7 @@ class Dump:
value = u'' value = u''
else: else:
value = getUnicode(info["values"][i]) value = getUnicode(info["values"][i])
value = {" ": NULL, "": BLANK}.get(value, value)
if re.search("^[\ *]*$", value):
value = NULL
values.append(value) values.append(value)
maxlength = int(info["length"]) maxlength = int(info["length"])

View File

@ -253,6 +253,9 @@ SQL_STATEMENTS = {
# string representation for NULL value # string representation for NULL value
NULL = "NULL" NULL = "NULL"
# string representation for blank ('') value
BLANK = "<blank>"
# string representation for current database # string representation for current database
CURRENT_DB = "CD" CURRENT_DB = "CD"

View File

@ -55,10 +55,12 @@ from lib.core.exception import sqlmapNoneDataException
from lib.core.exception import sqlmapUnsupportedFeatureException from lib.core.exception import sqlmapUnsupportedFeatureException
from lib.core.exception import sqlmapUserQuitException from lib.core.exception import sqlmapUserQuitException
from lib.core.session import setOs from lib.core.session import setOs
from lib.core.settings import BLANK
from lib.core.settings import CONCAT_ROW_DELIMITER from lib.core.settings import CONCAT_ROW_DELIMITER
from lib.core.settings import CONCAT_VALUE_DELIMITER from lib.core.settings import CONCAT_VALUE_DELIMITER
from lib.core.settings import CURRENT_DB from lib.core.settings import CURRENT_DB
from lib.core.settings import MAX_INT from lib.core.settings import MAX_INT
from lib.core.settings import NULL
from lib.core.settings import SQL_STATEMENTS from lib.core.settings import SQL_STATEMENTS
from lib.core.shell import autoCompletion from lib.core.shell import autoCompletion
from lib.core.threads import getCurrentThreadData from lib.core.threads import getCurrentThreadData
@ -1635,7 +1637,7 @@ class Enumeration:
else: else:
colEntry = entry[index] if index < len(entry) else u'' colEntry = entry[index] if index < len(entry) else u''
colEntryLen = len(getUnicode(colEntry)) colEntryLen = len({" ": NULL, "": BLANK}.get(getUnicode(colEntry), getUnicode(colEntry)))
maxLen = max(colLen, colEntryLen) maxLen = max(colLen, colEntryLen)
if maxLen > kb.data.dumpedTable[column]["length"]: if maxLen > kb.data.dumpedTable[column]["length"]: