mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-26 09:29:02 +00:00
added null connection check
This commit is contained in:
@@ -437,6 +437,29 @@ def checkRegexp():
|
||||
|
||||
return False
|
||||
|
||||
def checkNullConnection():
|
||||
infoMsg = "testing NULL connection to the target url"
|
||||
logger.info(infoMsg)
|
||||
|
||||
try:
|
||||
page, headers = Request.getPage(method="HEAD")
|
||||
if not page and 'Content-Length' in headers:
|
||||
kb.nullConnection = "HEAD"
|
||||
else:
|
||||
page, headers = Request.getPage(auxHeaders={"Range":"bytes=-1"})
|
||||
if page and len(page) == 1 and 'Content-Range' in headers:
|
||||
kb.nullConnection = "Range"
|
||||
|
||||
except sqlmapConnectionException, errMsg:
|
||||
errMsg = getUnicode(errMsg)
|
||||
raise sqlmapConnectionException, errMsg
|
||||
|
||||
if kb.nullConnection:
|
||||
infoMsg = "method '%s' seems to be working" % kb.nullConnection
|
||||
logger.info(infoMsg)
|
||||
|
||||
return kb.nullConnection is not None
|
||||
|
||||
def checkConnection():
|
||||
try:
|
||||
socket.gethostbyname(conf.hostname)
|
||||
|
||||
@@ -29,6 +29,7 @@ from lib.controller.checks import checkStability
|
||||
from lib.controller.checks import checkString
|
||||
from lib.controller.checks import checkRegexp
|
||||
from lib.controller.checks import checkConnection
|
||||
from lib.controller.checks import checkNullConnection
|
||||
from lib.core.common import getUnicode
|
||||
from lib.core.common import paramToDict
|
||||
from lib.core.common import parseTargetUrl
|
||||
@@ -165,6 +166,8 @@ def start():
|
||||
if not checkConnection() or not checkString() or not checkRegexp():
|
||||
continue
|
||||
|
||||
checkNullConnection()
|
||||
|
||||
if not conf.dropSetCookie:
|
||||
for _, cookie in enumerate(conf.cj):
|
||||
cookie = getUnicode(cookie)
|
||||
|
||||
Reference in New Issue
Block a user