mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-23 15:54:24 +03:00
minor update
This commit is contained in:
parent
d551423379
commit
0d0e2a2228
|
@ -26,6 +26,8 @@ from lib.core.data import conf
|
||||||
from lib.core.data import kb
|
from lib.core.data import kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.data import paths
|
from lib.core.data import paths
|
||||||
|
from lib.core.enums import HTTPMETHOD
|
||||||
|
from lib.core.enums import NULLCONNECTION
|
||||||
from lib.core.exception import sqlmapConnectionException
|
from lib.core.exception import sqlmapConnectionException
|
||||||
from lib.core.exception import sqlmapGenericException
|
from lib.core.exception import sqlmapGenericException
|
||||||
from lib.core.exception import sqlmapNoneDataException
|
from lib.core.exception import sqlmapNoneDataException
|
||||||
|
@ -368,16 +370,16 @@ def checkNullConnection():
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
page, headers = Request.getPage(method="HEAD")
|
page, headers = Request.getPage(method=HTTPMETHOD.HEAD)
|
||||||
if not page and 'Content-Length' in headers:
|
if not page and 'Content-Length' in headers:
|
||||||
kb.nullConnection = "HEAD"
|
kb.nullConnection = NULLCONNECTION.HEAD
|
||||||
|
|
||||||
infoMsg = "NULL connection is supported with HEAD header"
|
infoMsg = "NULL connection is supported with HEAD header"
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
else:
|
else:
|
||||||
page, headers = Request.getPage(auxHeaders={"Range":"bytes=-1"})
|
page, headers = Request.getPage(auxHeaders={"Range":"bytes=-1"})
|
||||||
if page and len(page) == 1 and 'Content-Range' in headers:
|
if page and len(page) == 1 and 'Content-Range' in headers:
|
||||||
kb.nullConnection = "Range"
|
kb.nullConnection = NULLCONNECTION.RANGE
|
||||||
|
|
||||||
infoMsg = "NULL connection is supported with GET header "
|
infoMsg = "NULL connection is supported with GET header "
|
||||||
infoMsg += "'%s'" % kb.nullConnection
|
infoMsg += "'%s'" % kb.nullConnection
|
||||||
|
|
|
@ -37,4 +37,8 @@ class PLACE:
|
||||||
class HTTPMETHOD:
|
class HTTPMETHOD:
|
||||||
GET = "GET"
|
GET = "GET"
|
||||||
POST = "POST"
|
POST = "POST"
|
||||||
HEAD = "HEAD"
|
HEAD = "HEAD"
|
||||||
|
|
||||||
|
class NULLCONNECTION:
|
||||||
|
HEAD = "HEAD"
|
||||||
|
RANGE = "Range"
|
||||||
|
|
|
@ -27,6 +27,7 @@ from lib.core.data import kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.common import sanitizeAsciiString
|
from lib.core.common import sanitizeAsciiString
|
||||||
from lib.core.enums import HTTPMETHOD
|
from lib.core.enums import HTTPMETHOD
|
||||||
|
from lib.core.enums import NULLCONNECTION
|
||||||
from lib.core.enums import PLACE
|
from lib.core.enums import PLACE
|
||||||
from lib.core.exception import sqlmapConnectionException
|
from lib.core.exception import sqlmapConnectionException
|
||||||
from lib.request.basic import decodePage
|
from lib.request.basic import decodePage
|
||||||
|
@ -354,9 +355,9 @@ class Connect:
|
||||||
Connect.getPage(url=conf.safUrl, cookie=cookie, direct=True, silent=True, ua=ua)
|
Connect.getPage(url=conf.safUrl, cookie=cookie, direct=True, silent=True, ua=ua)
|
||||||
|
|
||||||
if not content and not response and kb.nullConnection:
|
if not content and not response and kb.nullConnection:
|
||||||
if kb.nullConnection == "HEAD":
|
if kb.nullConnection == NULLCONNECTION.HEAD:
|
||||||
method = HTTPMETHOD.HEAD
|
method = HTTPMETHOD.HEAD
|
||||||
elif kb.nullConnection == "Range":
|
elif kb.nullConnection == NULLCONNECTION.RANGE:
|
||||||
if not auxHeaders:
|
if not auxHeaders:
|
||||||
auxHeaders = {}
|
auxHeaders = {}
|
||||||
|
|
||||||
|
@ -364,9 +365,9 @@ class Connect:
|
||||||
|
|
||||||
_, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders, raise404=raise404)
|
_, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders, raise404=raise404)
|
||||||
|
|
||||||
if kb.nullConnection == "HEAD" and 'Content-Length' in headers:
|
if kb.nullConnection == NULLCONNECTION.HEAD and 'Content-Length' in headers:
|
||||||
pageLength = int(headers['Content-Length'])
|
pageLength = int(headers['Content-Length'])
|
||||||
elif kb.nullConnection == "Range" and 'Content-Range' in headers:
|
elif kb.nullConnection == NULLCONNECTION.RANGE and 'Content-Range' in headers:
|
||||||
pageLength = int(headers['Content-Range'][headers['Content-Range'].find('/') + 1:])
|
pageLength = int(headers['Content-Range'][headers['Content-Range'].find('/') + 1:])
|
||||||
|
|
||||||
if not pageLength:
|
if not pageLength:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user