mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-01 22:33:48 +03:00
Patch related to the #3524
This commit is contained in:
parent
9387a005e3
commit
e64cc86fc4
|
@ -1507,44 +1507,55 @@ def checkNullConnection():
|
||||||
if conf.data:
|
if conf.data:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
infoMsg = "testing NULL connection to the target URL"
|
_ = hashDBRetrieve(HASHDB_KEYS.CHECK_NULL_CONNECTION_RESULT, True)
|
||||||
logger.info(infoMsg)
|
if _ is not None:
|
||||||
|
kb.nullConnection = _
|
||||||
|
|
||||||
pushValue(kb.pageCompress)
|
if _:
|
||||||
kb.pageCompress = False
|
dbgMsg = "resuming NULL connection method '%s'" % _
|
||||||
|
logger.debug(dbgMsg)
|
||||||
|
|
||||||
try:
|
else:
|
||||||
page, headers, _ = Request.getPage(method=HTTPMETHOD.HEAD, raise404=False)
|
infoMsg = "testing NULL connection to the target URL"
|
||||||
|
logger.info(infoMsg)
|
||||||
|
|
||||||
if not page and HTTP_HEADER.CONTENT_LENGTH in (headers or {}):
|
pushValue(kb.pageCompress)
|
||||||
kb.nullConnection = NULLCONNECTION.HEAD
|
kb.pageCompress = False
|
||||||
|
|
||||||
infoMsg = "NULL connection is supported with HEAD method ('Content-Length')"
|
try:
|
||||||
logger.info(infoMsg)
|
page, headers, _ = Request.getPage(method=HTTPMETHOD.HEAD, raise404=False)
|
||||||
else:
|
|
||||||
page, headers, _ = Request.getPage(auxHeaders={HTTP_HEADER.RANGE: "bytes=-1"})
|
|
||||||
|
|
||||||
if page and len(page) == 1 and HTTP_HEADER.CONTENT_RANGE in (headers or {}):
|
if not page and HTTP_HEADER.CONTENT_LENGTH in (headers or {}):
|
||||||
kb.nullConnection = NULLCONNECTION.RANGE
|
kb.nullConnection = NULLCONNECTION.HEAD
|
||||||
|
|
||||||
infoMsg = "NULL connection is supported with GET method ('Range')"
|
infoMsg = "NULL connection is supported with HEAD method ('Content-Length')"
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
else:
|
else:
|
||||||
_, headers, _ = Request.getPage(skipRead=True)
|
page, headers, _ = Request.getPage(auxHeaders={HTTP_HEADER.RANGE: "bytes=-1"})
|
||||||
|
|
||||||
if HTTP_HEADER.CONTENT_LENGTH in (headers or {}):
|
if page and len(page) == 1 and HTTP_HEADER.CONTENT_RANGE in (headers or {}):
|
||||||
kb.nullConnection = NULLCONNECTION.SKIP_READ
|
kb.nullConnection = NULLCONNECTION.RANGE
|
||||||
|
|
||||||
infoMsg = "NULL connection is supported with 'skip-read' method"
|
infoMsg = "NULL connection is supported with GET method ('Range')"
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
else:
|
||||||
|
_, headers, _ = Request.getPage(skipRead=True)
|
||||||
|
|
||||||
except SqlmapConnectionException:
|
if HTTP_HEADER.CONTENT_LENGTH in (headers or {}):
|
||||||
pass
|
kb.nullConnection = NULLCONNECTION.SKIP_READ
|
||||||
|
|
||||||
finally:
|
infoMsg = "NULL connection is supported with 'skip-read' method"
|
||||||
kb.pageCompress = popValue()
|
logger.info(infoMsg)
|
||||||
|
|
||||||
return kb.nullConnection is not None
|
except SqlmapConnectionException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
finally:
|
||||||
|
kb.pageCompress = popValue()
|
||||||
|
kb.nullConnection = False if kb.nullConnection is None else kb.nullConnection
|
||||||
|
hashDBWrite(HASHDB_KEYS.CHECK_NULL_CONNECTION_RESULT, kb.nullConnection, True)
|
||||||
|
|
||||||
|
return kb.nullConnection in getPublicTypeMembers(NULLCONNECTION, True)
|
||||||
|
|
||||||
def checkConnection(suppressOutput=False):
|
def checkConnection(suppressOutput=False):
|
||||||
threadData = getCurrentThreadData()
|
threadData = getCurrentThreadData()
|
||||||
|
|
|
@ -231,6 +231,7 @@ class HASHDB_KEYS:
|
||||||
DBMS = "DBMS"
|
DBMS = "DBMS"
|
||||||
DBMS_FORK = "DBMS_FORK"
|
DBMS_FORK = "DBMS_FORK"
|
||||||
CHECK_WAF_RESULT = "CHECK_WAF_RESULT"
|
CHECK_WAF_RESULT = "CHECK_WAF_RESULT"
|
||||||
|
CHECK_NULL_CONNECTION_RESULT = "CHECK_NULL_CONNECTION_RESULT"
|
||||||
CONF_TMP_PATH = "CONF_TMP_PATH"
|
CONF_TMP_PATH = "CONF_TMP_PATH"
|
||||||
KB_ABS_FILE_PATHS = "KB_ABS_FILE_PATHS"
|
KB_ABS_FILE_PATHS = "KB_ABS_FILE_PATHS"
|
||||||
KB_BRUTE_COLUMNS = "KB_BRUTE_COLUMNS"
|
KB_BRUTE_COLUMNS = "KB_BRUTE_COLUMNS"
|
||||||
|
|
|
@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||||
from lib.core.enums import OS
|
from lib.core.enums import OS
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.3.3.46"
|
VERSION = "1.3.3.47"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user