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

Skip to content

Commit 5e358b5

Browse files
committed
few fixes related to bug report by Shadow Folder (AttributeError: 'list' object has no attribute 'isdigit')
1 parent d5b4b79 commit 5e358b5

6 files changed

Lines changed: 16 additions & 11 deletions

File tree

lib/takeover/udf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
from lib.core.data import kb
1919
from lib.core.data import logger
2020
from lib.core.data import queries
21-
from lib.core.enums import CHARSET_TYPE
2221
from lib.core.enums import DBMS
22+
from lib.core.enums import CHARSET_TYPE
23+
from lib.core.enums import EXPECTED
2324
from lib.core.enums import OS
2425
from lib.core.enums import PAYLOAD
2526
from lib.core.exception import sqlmapFilePathException
@@ -54,7 +55,7 @@ def __checkExistUdf(self, udf):
5455
logger.info("checking if UDF '%s' already exist" % udf)
5556

5657
query = agent.forgeCaseStatement(queries[Backend.getIdentifiedDbms()].check_udf.query % (udf, udf))
57-
exists = inject.getValue(query, resumeValue=False, charsetType=CHARSET_TYPE.DIGITS)
58+
exists = inject.getValue(query, resumeValue=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
5859

5960
if exists == "1":
6061
return True

lib/utils/resume.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
from lib.core.data import kb
2323
from lib.core.data import logger
2424
from lib.core.data import queries
25-
from lib.core.enums import CHARSET_TYPE
2625
from lib.core.enums import DBMS
26+
from lib.core.enums import CHARSET_TYPE
27+
from lib.core.enums import EXPECTED
2728
from lib.core.unescaper import unescaper
2829
from lib.techniques.blind.inference import bisection
2930

@@ -70,7 +71,7 @@ def queryOutputLength(expression, payload):
7071

7172
start = time.time()
7273
lengthExprUnescaped = unescaper.unescape(lengthExpr)
73-
count, length = bisection(payload, lengthExprUnescaped, charsetType=CHARSET_TYPE.DIGITS)
74+
count, length = bisection(payload, lengthExprUnescaped, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
7475

7576
debugMsg = "performed %d queries in %d seconds" % (count, calculateDeltaSeconds(start))
7677
logger.debug(debugMsg)

plugins/dbms/mssqlserver/filesystem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from lib.core.data import conf
2020
from lib.core.data import logger
2121
from lib.core.enums import CHARSET_TYPE
22+
from lib.core.enums import EXPECTED
2223
from lib.core.enums import PAYLOAD
2324
from lib.core.exception import sqlmapNoneDataException
2425
from lib.core.exception import sqlmapUnsupportedFeatureException
@@ -97,7 +98,7 @@ def stackedReadFile(self, rFile):
9798

9899
if not result:
99100
result = []
100-
count = inject.getValue("SELECT COUNT(*) FROM %s" % (hexTbl), resumeValue=False, charsetType=CHARSET_TYPE.DIGITS)
101+
count = inject.getValue("SELECT COUNT(*) FROM %s" % (hexTbl), resumeValue=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
101102

102103
if not isNumPosStrValue(count):
103104
errMsg = "unable to retrieve the content of the "

plugins/dbms/mysql/filesystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
from lib.core.common import isNumPosStrValue
1111
from lib.core.common import randomStr
1212
from lib.core.common import singleTimeWarnMessage
13-
from lib.core.common import unArrayizeValue
1413
from lib.core.data import conf
1514
from lib.core.data import kb
1615
from lib.core.data import logger
1716
from lib.core.enums import CHARSET_TYPE
17+
from lib.core.enums import EXPECTED
1818
from lib.core.enums import PLACE
1919
from lib.core.exception import sqlmapNoneDataException
2020
from lib.request import inject
@@ -52,7 +52,7 @@ def stackedReadFile(self, rFile):
5252
logger.debug(debugMsg)
5353
inject.goStacked("LOAD DATA INFILE '%s' INTO TABLE %s FIELDS TERMINATED BY '%s' (%s)" % (tmpFile, self.fileTblName, randomStr(10), self.tblField))
5454

55-
length = unArrayizeValue(inject.getValue("SELECT LENGTH(%s) FROM %s" % (self.tblField, self.fileTblName), unique=False, resumeValue=False, charsetType=CHARSET_TYPE.DIGITS))
55+
length = inject.getValue("SELECT LENGTH(%s) FROM %s" % (self.tblField, self.fileTblName), unique=False, resumeValue=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
5656

5757
if not isNumPosStrValue(length):
5858
errMsg = "unable to retrieve the content of the "

plugins/dbms/oracle/enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def getRoles(self, query2=False):
123123
count = inject.getValue(query, inband=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
124124

125125
if not isNumPosStrValue(count):
126-
if not count.isdigit() and not query2:
126+
if count != 0 and not query2:
127127
infoMsg = "trying with table USER_SYS_PRIVS"
128128
logger.info(infoMsg)
129129

plugins/generic/filesystem.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
from lib.core.agent import agent
1515
from lib.core.common import dataToOutFile
1616
from lib.core.common import Backend
17+
from lib.core.common import isNumPosStrValue
1718
from lib.core.common import isTechniqueAvailable
1819
from lib.core.common import randomStr
1920
from lib.core.common import readInput
2021
from lib.core.data import conf
2122
from lib.core.data import logger
22-
from lib.core.enums import CHARSET_TYPE
2323
from lib.core.enums import DBMS
24+
from lib.core.enums import CHARSET_TYPE
25+
from lib.core.enums import EXPECTED
2426
from lib.core.enums import PAYLOAD
2527
from lib.core.exception import sqlmapUndefinedMethod
2628
from lib.request import inject
@@ -110,9 +112,9 @@ def __checkWrittenFile(self, wFile, dFile, fileType):
110112
wFileSize = os.path.getsize(wFile)
111113

112114
logger.debug("checking if the %s file has been written" % fileType)
113-
dFileSize = inject.getValue(lengthQuery, resumeValue=False, charsetType=CHARSET_TYPE.DIGITS)
115+
dFileSize = inject.getValue(lengthQuery, resumeValue=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
114116

115-
if dFileSize and dFileSize.isdigit():
117+
if isNumPosStrValue(dFileSize):
116118
infoMsg = "the file has been successfully written and "
117119
infoMsg += "its size is %s bytes" % dFileSize
118120

0 commit comments

Comments
 (0)