Skip to content

Commit c714ac6

Browse files
committed
added support for handling binary data values (no more garbish chars)
1 parent 4ad73f9 commit c714ac6

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/core/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,4 +2524,7 @@ def getSafeHexEncodedBinaryData(value):
25242524
retVal = value
25252525
if isinstance(value, basestring):
25262526
retVal = reduce(lambda x, y: x + (y if (y in string.printable or ord(y) > 255) else '\%x' % ord(y)), value, unicode())
2527+
elif isinstance(value, list):
2528+
for i in xrange(len(value)):
2529+
retVal[i] = getSafeHexEncodedBinaryData(value[i])
25272530
return retVal

lib/request/inject.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from lib.core.common import dataToSessionFile
1818
from lib.core.common import expandAsteriskForColumns
1919
from lib.core.common import getPublicTypeMembers
20+
from lib.core.common import getSafeHexEncodedBinaryData
2021
from lib.core.common import initTechnique
2122
from lib.core.common import isNumPosStrValue
2223
from lib.core.common import isTechniqueAvailable
@@ -387,7 +388,7 @@ def __goInband(expression, expected=None, sort=True, resumeValue=True, unpack=Tr
387388

388389
return data
389390

390-
def getValue(expression, blind=True, inband=True, error=True, time=True, fromUser=False, expected=None, batch=False, unpack=True, sort=True, resumeValue=True, charsetType=None, firstChar=None, lastChar=None, dump=False, suppressOutput=None, expectingNone=False):
391+
def getValue(expression, blind=True, inband=True, error=True, time=True, fromUser=False, expected=None, batch=False, unpack=True, sort=True, resumeValue=True, charsetType=None, firstChar=None, lastChar=None, dump=False, suppressOutput=None, expectingNone=False, safeHexEncode=True):
391392
"""
392393
Called each time sqlmap inject a SQL query on the SQL injection
393394
affected parameter. It can call a function to retrieve the output
@@ -493,6 +494,9 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse
493494
elif value == [None]:
494495
value = None
495496

497+
if safeHexEncode:
498+
value = getSafeHexEncodedBinaryData(value)
499+
496500
return value
497501

498502
def goStacked(expression, silent=False):

plugins/generic/enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def getPasswordHashes(self):
252252
retVal = self.__pivotDumpTable("(%s) AS %s" % (query, randStr), ['%s.name' % randStr,'%s.password' % randStr], blind=False)
253253
if retVal:
254254
for user, password in zip(retVal[0]["%s.name" % randStr], retVal[0]["%s.password" % randStr]):
255-
password = "0x%s" % strToHex(password)
255+
#password = "0x%s" % strToHex(password)
256256
if not kb.data.cachedUsersPasswords.has_key(user):
257257
kb.data.cachedUsersPasswords[user] = [password]
258258
else:

0 commit comments

Comments
 (0)