Skip to content

Commit ca0d068

Browse files
committed
distinguishing NULL from BLANK
1 parent e38b59a commit ca0d068

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

lib/core/dump.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from lib.core.enums import DBMS
2929
from lib.core.exception import sqlmapValueException
3030
from lib.core.replication import Replication
31+
from lib.core.settings import BLANK
3132
from lib.core.settings import BUFFERED_LOG_SIZE
3233
from lib.core.settings import NULL
3334
from lib.core.settings import TRIM_STDOUT_DUMP_SIZE
@@ -377,7 +378,7 @@ def dbTableValues(self, tableValues):
377378

378379
for value in tableValues[column]['values']:
379380
try:
380-
if not value or re.search("^[\ *]*$", value): #NULL
381+
if not value or value == " ": # NULL
381382
continue
382383

383384
int(value)
@@ -390,7 +391,7 @@ def dbTableValues(self, tableValues):
390391

391392
for value in tableValues[column]['values']:
392393
try:
393-
if not value or re.search("^[\ *]*$", value): #NULL
394+
if not value or value == " ": # NULL
394395
continue
395396

396397
float(value)
@@ -455,9 +456,7 @@ def dbTableValues(self, tableValues):
455456
value = u''
456457
else:
457458
value = getUnicode(info["values"][i])
458-
459-
if re.search("^[\ *]*$", value):
460-
value = NULL
459+
value = {" ": NULL, "": BLANK}.get(value, value)
461460

462461
values.append(value)
463462
maxlength = int(info["length"])

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@
253253
# string representation for NULL value
254254
NULL = "NULL"
255255

256+
# string representation for blank ('') value
257+
BLANK = "<blank>"
258+
256259
# string representation for current database
257260
CURRENT_DB = "CD"
258261

plugins/generic/enumeration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@
5555
from lib.core.exception import sqlmapUnsupportedFeatureException
5656
from lib.core.exception import sqlmapUserQuitException
5757
from lib.core.session import setOs
58+
from lib.core.settings import BLANK
5859
from lib.core.settings import CONCAT_ROW_DELIMITER
5960
from lib.core.settings import CONCAT_VALUE_DELIMITER
6061
from lib.core.settings import CURRENT_DB
6162
from lib.core.settings import MAX_INT
63+
from lib.core.settings import NULL
6264
from lib.core.settings import SQL_STATEMENTS
6365
from lib.core.shell import autoCompletion
6466
from lib.core.threads import getCurrentThreadData
@@ -1635,7 +1637,7 @@ def dumpTable(self, foundData=None):
16351637
else:
16361638
colEntry = entry[index] if index < len(entry) else u''
16371639

1638-
colEntryLen = len(getUnicode(colEntry))
1640+
colEntryLen = len({" ": NULL, "": BLANK}.get(getUnicode(colEntry), getUnicode(colEntry)))
16391641
maxLen = max(colLen, colEntryLen)
16401642

16411643
if maxLen > kb.data.dumpedTable[column]["length"]:

0 commit comments

Comments
 (0)