covering __pivotDumpTable for keyboard and connection exceptions too

This commit is contained in:
Miroslav Stampar 2011-04-15 14:21:13 +00:00
parent 3b6f9945ae
commit c16b74ce1a

View File

@ -1184,40 +1184,52 @@ class Enumeration:
pivotValue = " " pivotValue = " "
breakRetrieval = False breakRetrieval = False
for i in xrange(int(count)): try:
if breakRetrieval: for i in xrange(int(count)):
break if breakRetrieval:
break
for column in colList: for column in colList:
if column not in lengths: if column not in lengths:
lengths[column] = 0 lengths[column] = 0
if column not in entries: if column not in entries:
entries[column] = [] entries[column] = []
if column == colList[0]: if column == colList[0]:
# Correction for pivotValues with unrecognized chars # Correction for pivotValues with unrecognized chars
if pivotValue and '?' in pivotValue and pivotValue[0] != '?': if pivotValue and '?' in pivotValue and pivotValue[0] != '?':
pivotValue = pivotValue.split('?')[0] pivotValue = pivotValue.split('?')[0]
pivotValue = pivotValue[:-1] + chr(ord(pivotValue[-1]) + 1) pivotValue = pivotValue[:-1] + chr(ord(pivotValue[-1]) + 1)
query = dumpNode.query % (column, table, column, pivotValue) query = dumpNode.query % (column, table, column, pivotValue)
else:
query = dumpNode.query2 % (column, table, colList[0], pivotValue)
if blind:
value = inject.getValue(query, inband=False, error=False)
else:
value = inject.getValue(query, blind=False)
if column == colList[0]:
if not value:
breakRetrieval = True
break
else: else:
pivotValue = safechardecode(value) query = dumpNode.query2 % (column, table, colList[0], pivotValue)
lengths[column] = max(lengths[column], len(value) if value else 0) if blind:
entries[column].append(value) value = inject.getValue(query, inband=False, error=False)
else:
value = inject.getValue(query, blind=False)
if column == colList[0]:
if not value:
breakRetrieval = True
break
else:
pivotValue = safechardecode(value)
lengths[column] = max(lengths[column], len(value) if value else 0)
entries[column].append(value)
except KeyboardInterrupt:
warnMsg = "user aborted during enumeration. sqlmap "
warnMsg += "will display partial output"
logger.warn(warnMsg)
except sqlmapConnectionException, e:
errMsg = "connection exception detected. sqlmap "
errMsg += "will display partial output"
errMsg += "'%s'" % e
logger.critical(errMsg)
return entries, lengths return entries, lengths