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

Skip to content

Commit 749e25a

Browse files
committed
Implementation of --passwords for Sybase
1 parent 1b90c1d commit 749e25a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

plugins/generic/enumeration.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from lib.core.common import randomStr
2424
from lib.core.common import readInput
2525
from lib.core.common import safeStringFormat
26+
from lib.core.common import strToHex
2627
from lib.core.convert import urlencode
2728
from lib.core.convert import utf8decode
2829
from lib.core.data import conf
@@ -283,7 +284,15 @@ def getPasswordHashes(self):
283284

284285
for index in indexRange:
285286
if kb.dbms == "Sybase":
286-
query = rootQuery.blind.query % (user, (kb.data.cachedUsersPasswords[-1] if kb.data.cachedUsersPasswords else " "))
287+
if index > 0:
288+
warnMsg = "unable to retrieve other password "
289+
warnMsg += "hashes for user '%s'" % user
290+
logger.warn(warnMsg)
291+
break
292+
else:
293+
query = rootQuery.blind.query % user
294+
pushValue(conf.verbose)
295+
conf.verbose = 0
287296
elif kb.dbms == "Microsoft SQL Server":
288297
if kb.dbmsVersion[0] in ( "2005", "2008" ):
289298
query = rootQuery.blind.query2 % (user, index, user)
@@ -292,6 +301,11 @@ def getPasswordHashes(self):
292301
else:
293302
query = rootQuery.blind.query % (user, index)
294303
password = inject.getValue(query, inband=False)
304+
if kb.dbms == "Sybase":
305+
conf.verbose = popValue()
306+
password = "0x%s" % strToHex(password)
307+
infoMsg = "retrieved: %s" % password
308+
logger.info(infoMsg)
295309
password = parsePasswordHash(password)
296310
passwords.append(password)
297311

xml/queries.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
</users>
478478
<passwords>
479479
<inband query="SELECT name, password FROM master..syslogins" condition="name"/>
480-
<blind query="SELECT MIN(password) FROM master..syslogins WHERE name='%s' AND password > '%s'" count="SELECT LTRIM(STR(COUNT(password))) FROM master..syslogins WHERE name='%s'"/>
480+
<blind query="SELECT MIN(password) FROM master..syslogins WHERE name='%s'" count="SELECT LTRIM(STR(COUNT(password))) FROM master..syslogins WHERE name='%s'"/>
481481
</passwords>
482482
<privileges/>
483483
<roles/>

0 commit comments

Comments
 (0)