Skip to content

Commit 90b145e

Browse files
committed
Fixes #4895
1 parent b185b5e commit 90b145e

File tree

3 files changed

+27
-43
lines changed

3 files changed

+27
-43
lines changed

lib/controller/checks.py

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,44 +1340,6 @@ def checkStability():
13401340

13411341
return kb.pageStable
13421342

1343-
def checkString():
1344-
if not conf.string:
1345-
return True
1346-
1347-
infoMsg = "testing if the provided string is within the "
1348-
infoMsg += "target URL page content"
1349-
logger.info(infoMsg)
1350-
1351-
page, headers, _ = Request.queryPage(content=True)
1352-
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
1353-
1354-
if conf.string not in rawResponse:
1355-
warnMsg = "you provided '%s' as the string to " % conf.string
1356-
warnMsg += "match, but such a string is not within the target "
1357-
warnMsg += "URL raw response, sqlmap will carry on anyway"
1358-
logger.warn(warnMsg)
1359-
1360-
return True
1361-
1362-
def checkRegexp():
1363-
if not conf.regexp:
1364-
return True
1365-
1366-
infoMsg = "testing if the provided regular expression matches within "
1367-
infoMsg += "the target URL page content"
1368-
logger.info(infoMsg)
1369-
1370-
page, headers, _ = Request.queryPage(content=True)
1371-
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
1372-
1373-
if not re.search(conf.regexp, rawResponse, re.I | re.M):
1374-
warnMsg = "you provided '%s' as the regular expression " % conf.regexp
1375-
warnMsg += "which does not have any match within the target URL raw response. sqlmap "
1376-
warnMsg += "will carry on anyway"
1377-
logger.warn(warnMsg)
1378-
1379-
return True
1380-
13811343
@stackedmethod
13821344
def checkWaf():
13831345
"""
@@ -1542,7 +1504,31 @@ def checkConnection(suppressOutput=False):
15421504

15431505
try:
15441506
kb.originalPageTime = time.time()
1545-
Request.queryPage(content=True, noteResponseTime=False)
1507+
page, headers, _ = Request.queryPage(content=True, noteResponseTime=False)
1508+
1509+
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
1510+
1511+
if conf.string:
1512+
infoMsg = "testing if the provided string is within the "
1513+
infoMsg += "target URL page content"
1514+
logger.info(infoMsg)
1515+
1516+
if conf.string not in rawResponse:
1517+
warnMsg = "you provided '%s' as the string to " % conf.string
1518+
warnMsg += "match, but such a string is not within the target "
1519+
warnMsg += "URL raw response, sqlmap will carry on anyway"
1520+
logger.warn(warnMsg)
1521+
1522+
if conf.regexp:
1523+
infoMsg = "testing if the provided regular expression matches within "
1524+
infoMsg += "the target URL page content"
1525+
logger.info(infoMsg)
1526+
1527+
if not re.search(conf.regexp, rawResponse, re.I | re.M):
1528+
warnMsg = "you provided '%s' as the regular expression " % conf.regexp
1529+
warnMsg += "which does not have any match within the target URL raw response. sqlmap "
1530+
warnMsg += "will carry on anyway"
1531+
logger.warn(warnMsg)
15461532

15471533
kb.errorIsNone = False
15481534

lib/controller/controller.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
from lib.controller.checks import checkDynParam
1717
from lib.controller.checks import checkInternet
1818
from lib.controller.checks import checkNullConnection
19-
from lib.controller.checks import checkRegexp
2019
from lib.controller.checks import checkSqlInjection
2120
from lib.controller.checks import checkStability
22-
from lib.controller.checks import checkString
2321
from lib.controller.checks import checkWaf
2422
from lib.controller.checks import heuristicCheckSqlInjection
2523
from lib.core.agent import agent
@@ -434,7 +432,7 @@ def start():
434432

435433
setupTargetEnv()
436434

437-
if not checkConnection(suppressOutput=conf.forms) or not checkString() or not checkRegexp():
435+
if not checkConnection(suppressOutput=conf.forms):
438436
continue
439437

440438
if conf.rParam and kb.originalPage:

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.5.11.10"
23+
VERSION = "1.5.12.0"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

0 commit comments

Comments
 (0)