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

Skip to content

Commit 7c06dbf

Browse files
committed
bug fix (AttributeError: 'unicode' object has no attribute 'sort')
1 parent c1f2534 commit 7c06dbf

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

lib/core/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,3 +1833,8 @@ def initTechnique(technique=None):
18331833
warnMsg = "there is no injection data available for technique "
18341834
warnMsg += "'%s'" % enumValueToNameLookup(PAYLOAD.TECHNIQUE, technique)
18351835
logger.warn(warnMsg)
1836+
1837+
def arrayizeValue(value):
1838+
if not isinstance(value, list):
1839+
value = [value]
1840+
return value

plugins/dbms/mssqlserver/enumeration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
from lib.core.agent import agent
11+
from lib.core.common import arrayizeValue
1112
from lib.core.common import getRange
1213
from lib.core.common import isNumPosStrValue
1314
from lib.core.data import conf
@@ -63,7 +64,7 @@ def getTables(self):
6364
value = inject.getValue(query, blind=False, error=False)
6465

6566
if value:
66-
kb.data.cachedTables[db] = value
67+
kb.data.cachedTables[db] = arrayizeValue(value)
6768

6869
if not kb.data.cachedTables and not conf.direct:
6970
for db in dbs:

plugins/generic/enumeration.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import time
1212

1313
from lib.core.agent import agent
14+
from lib.core.common import arrayizeValue
1415
from lib.core.common import dataToStdout
1516
from lib.core.common import getRange
1617
from lib.core.common import getCompiledRegex
@@ -158,7 +159,7 @@ def getUsers(self):
158159
value = inject.getValue(query, blind=False, error=False)
159160

160161
if value:
161-
kb.data.cachedUsers = value
162+
kb.data.cachedUsers = arrayizeValue(value)
162163

163164
if not kb.data.cachedUsers and not conf.direct:
164165
infoMsg = "fetching number of database users"
@@ -684,10 +685,7 @@ def getDbs(self):
684685
value = inject.getValue(query, blind=False, error=False)
685686

686687
if value:
687-
if isinstance(value, basestring):
688-
kb.data.cachedDbs = [value]
689-
else:
690-
kb.data.cachedDbs = value
688+
kb.data.cachedDbs = arrayizeValue(value)
691689

692690
if not kb.data.cachedDbs and not conf.direct:
693691
infoMsg = "fetching number of databases"

0 commit comments

Comments
 (0)