Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f4186c

Browse files
committed
Removing duplicate user password hashes
1 parent 9989d26 commit 3f4186c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

plugins/generic/enumeration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def getPasswordHashes(self):
283283
if retVal:
284284
for user, password in filterPairValues(zip(retVal[0]["%s.name" % randStr], retVal[0]["%s.password" % randStr])):
285285
# password = "0x%s" % strToHex(password)
286-
if not kb.data.cachedUsersPasswords.has_key(user):
286+
if user not in kb.data.cachedUsersPasswords:
287287
kb.data.cachedUsersPasswords[user] = [password]
288288
else:
289289
kb.data.cachedUsersPasswords[user].append(password)
@@ -326,7 +326,7 @@ def getPasswordHashes(self):
326326
for user, password in filterPairValues(zip(retVal[0]["%s.name" % randStr], retVal[0]["%s.password" % randStr])):
327327
password = "0x%s" % strToHex(password)
328328

329-
if not kb.data.cachedUsersPasswords.has_key(user):
329+
if user not in kb.data.cachedUsersPasswords:
330330
kb.data.cachedUsersPasswords[user] = [password]
331331
else:
332332
kb.data.cachedUsersPasswords[user].append(password)
@@ -390,6 +390,10 @@ def getPasswordHashes(self):
390390
errMsg += "user has no read privileges over the relevant "
391391
errMsg += "system database table)"
392392
raise sqlmapNoneDataException, errMsg
393+
else:
394+
for user in kb.data.cachedUsersPasswords:
395+
kb.data.cachedUsersPasswords[user] = list(set(kb.data.cachedUsersPasswords[user]))
396+
393397

394398
message = "do you want to perform a dictionary-based attack "
395399
message += "against retrieved password hashes? [Y/n/q]"

0 commit comments

Comments
 (0)