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

Skip to content

Commit f41460f

Browse files
committed
Better naming
1 parent 95b9223 commit f41460f

8 files changed

Lines changed: 23 additions & 23 deletions

File tree

lib/controller/checks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
from lib.core.common import showStaticWords
3737
from lib.core.common import singleTimeLogMessage
3838
from lib.core.common import singleTimeWarnMessage
39-
from lib.core.common import wasLastRequestDBMSError
40-
from lib.core.common import wasLastRequestHTTPError
39+
from lib.core.common import wasLastResponseDBMSError
40+
from lib.core.common import wasLastResponseHTTPError
4141
from lib.core.data import conf
4242
from lib.core.data import kb
4343
from lib.core.data import logger
@@ -695,7 +695,7 @@ def heuristicCheckSqlInjection(place, parameter):
695695
logger.debug(debugMsg)
696696
return None
697697

698-
if wasLastRequestDBMSError():
698+
if wasLastResponseDBMSError():
699699
debugMsg = "heuristic checking skipped "
700700
debugMsg += "because original page content "
701701
debugMsg += "contains DBMS error"
@@ -723,7 +723,7 @@ def heuristicCheckSqlInjection(place, parameter):
723723
page, _ = Request.queryPage(payload, place, content=True, raise404=False)
724724

725725
parseFilePaths(page)
726-
result = wasLastRequestDBMSError()
726+
result = wasLastResponseDBMSError()
727727

728728
infoMsg = "heuristic test shows that %s " % place
729729
infoMsg += "parameter '%s' might " % parameter
@@ -1083,14 +1083,14 @@ def checkConnection(suppressOutput=False):
10831083

10841084
kb.errorIsNone = False
10851085

1086-
if not kb.originalPage and wasLastRequestHTTPError():
1086+
if not kb.originalPage and wasLastResponseHTTPError():
10871087
errMsg = "unable to retrieve page content"
10881088
raise SqlmapConnectionException(errMsg)
1089-
elif wasLastRequestDBMSError():
1089+
elif wasLastResponseDBMSError():
10901090
warnMsg = "there is a DBMS error found in the HTTP response body "
10911091
warnMsg += "which could interfere with the results of the tests"
10921092
logger.warn(warnMsg)
1093-
elif wasLastRequestHTTPError():
1093+
elif wasLastResponseHTTPError():
10941094
warnMsg = "the web server responded with an HTTP error code (%d) " % getLastRequestHTTPError()
10951095
warnMsg += "which could interfere with the results of the tests"
10961096
logger.warn(warnMsg)

lib/core/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,23 +1878,23 @@ def popValue():
18781878

18791879
return getCurrentThreadData().valueStack.pop()
18801880

1881-
def wasLastRequestDBMSError():
1881+
def wasLastResponseDBMSError():
18821882
"""
18831883
Returns True if the last web request resulted in a (recognized) DBMS error page
18841884
"""
18851885

18861886
threadData = getCurrentThreadData()
18871887
return threadData.lastErrorPage and threadData.lastErrorPage[0] == threadData.lastRequestUID
18881888

1889-
def wasLastRequestHTTPError():
1889+
def wasLastResponseHTTPError():
18901890
"""
18911891
Returns True if the last web request resulted in an errornous HTTP code (like 500)
18921892
"""
18931893

18941894
threadData = getCurrentThreadData()
18951895
return threadData.lastHTTPError and threadData.lastHTTPError[0] == threadData.lastRequestUID
18961896

1897-
def wasLastRequestDelayed():
1897+
def wasLastResponseDelayed():
18981898
"""
18991899
Returns True if the last web request resulted in a time-delay
19001900
"""

lib/request/comparison.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from lib.core.common import getFilteredPageContent
1212
from lib.core.common import listToStrValue
1313
from lib.core.common import removeDynamicContent
14-
from lib.core.common import wasLastRequestDBMSError
15-
from lib.core.common import wasLastRequestHTTPError
14+
from lib.core.common import wasLastResponseDBMSError
15+
from lib.core.common import wasLastResponseHTTPError
1616
from lib.core.data import conf
1717
from lib.core.data import kb
1818
from lib.core.data import logger
@@ -77,7 +77,7 @@ def _comparison(page, headers, code, getRatioValue, pageLength):
7777

7878
if page:
7979
# In case of an DBMS error page return None
80-
if kb.errorIsNone and (wasLastRequestDBMSError() or wasLastRequestHTTPError()):
80+
if kb.errorIsNone and (wasLastResponseDBMSError() or wasLastResponseHTTPError()):
8181
return None
8282

8383
# Dynamic content lines to be excluded before comparison

lib/request/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from lib.core.common import removeReflectiveValues
3535
from lib.core.common import singleTimeWarnMessage
3636
from lib.core.common import stdev
37-
from lib.core.common import wasLastRequestDelayed
37+
from lib.core.common import wasLastResponseDelayed
3838
from lib.core.common import unicodeencode
3939
from lib.core.common import urlencode
4040
from lib.core.data import conf
@@ -827,7 +827,7 @@ def _randomizeParameter(paramString, randomParameter):
827827
kb.testQueryCount += 1
828828

829829
if timeBasedCompare:
830-
return wasLastRequestDelayed()
830+
return wasLastResponseDelayed()
831831
elif noteResponseTime:
832832
kb.responseTimes.append(threadData.lastQueryDuration)
833833

lib/takeover/xp_cmdshell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from lib.core.common import popValue
1919
from lib.core.common import randomStr
2020
from lib.core.common import readInput
21-
from lib.core.common import wasLastRequestDelayed
21+
from lib.core.common import wasLastResponseDelayed
2222
from lib.core.convert import hexencode
2323
from lib.core.data import conf
2424
from lib.core.data import kb
@@ -94,7 +94,7 @@ def _xpCmdshellCheck(self):
9494
cmd = "ping -n %d 127.0.0.1" % (conf.timeSec * 2)
9595
self.xpCmdshellExecCmd(cmd)
9696

97-
return wasLastRequestDelayed()
97+
return wasLastResponseDelayed()
9898

9999
def _xpCmdshellTest(self):
100100
threadData = getCurrentThreadData()

lib/techniques/union/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from lib.core.common import singleTimeLogMessage
2323
from lib.core.common import singleTimeWarnMessage
2424
from lib.core.common import stdev
25-
from lib.core.common import wasLastRequestDBMSError
25+
from lib.core.common import wasLastResponseDBMSError
2626
from lib.core.data import conf
2727
from lib.core.data import kb
2828
from lib.core.data import logger
@@ -223,7 +223,7 @@ def _unionPosition(comment, place, parameter, prefix, suffix, count, where=PAYLO
223223
logger.warn(warnMsg)
224224
vector = (position, count, comment, prefix, suffix, kb.uChar, PAYLOAD.WHERE.NEGATIVE, kb.unionDuplicates)
225225

226-
unionErrorCase = kb.errorIsNone and wasLastRequestDBMSError()
226+
unionErrorCase = kb.errorIsNone and wasLastResponseDBMSError()
227227

228228
if unionErrorCase and count > 1:
229229
warnMsg = "combined UNION/error-based SQL injection case found on "

lib/techniques/union/use.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from lib.core.common import singleTimeDebugMessage
3434
from lib.core.common import singleTimeWarnMessage
3535
from lib.core.common import unArrayizeValue
36-
from lib.core.common import wasLastRequestDBMSError
36+
from lib.core.common import wasLastResponseDBMSError
3737
from lib.core.convert import htmlunescape
3838
from lib.core.data import conf
3939
from lib.core.data import kb
@@ -94,7 +94,7 @@ def _(regex):
9494
retVal = getUnicode(retVal, kb.pageEncoding)
9595

9696
# Special case when DBMS is Microsoft SQL Server and error message is used as a result of union injection
97-
if Backend.isDbms(DBMS.MSSQL) and wasLastRequestDBMSError():
97+
if Backend.isDbms(DBMS.MSSQL) and wasLastResponseDBMSError():
9898
retVal = htmlunescape(retVal).replace("<br>", "\n")
9999

100100
hashDBWrite("%s%s" % (conf.hexConvert, expression), retVal)

plugins/dbms/access/fingerprint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from lib.core.common import getCurrentThreadData
1313
from lib.core.common import randomInt
1414
from lib.core.common import randomStr
15-
from lib.core.common import wasLastRequestDBMSError
15+
from lib.core.common import wasLastResponseDBMSError
1616
from lib.core.data import conf
1717
from lib.core.data import kb
1818
from lib.core.data import logger
@@ -95,7 +95,7 @@ def _getDatabaseDir(self):
9595
randStr = randomStr()
9696
inject.checkBooleanExpression("EXISTS(SELECT * FROM %s.%s WHERE %d=%d)" % (randStr, randStr, randInt, randInt))
9797

98-
if wasLastRequestDBMSError():
98+
if wasLastResponseDBMSError():
9999
threadData = getCurrentThreadData()
100100
match = re.search("Could not find file\s+'([^']+?)'", threadData.lastErrorPage[1])
101101

0 commit comments

Comments
 (0)