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

Skip to content

Commit 03732d2

Browse files
committed
Minor fix
1 parent b26ecfe commit 03732d2

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/controller/checks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,9 @@ def checkNullConnection():
11141114
infoMsg = "testing NULL connection to the target URL"
11151115
logger.info(infoMsg)
11161116

1117+
pushValue(kb.pageCompress)
1118+
kb.pageCompress = False
1119+
11171120
try:
11181121
page, headers, _ = Request.getPage(method=HTTPMETHOD.HEAD)
11191122

@@ -1144,6 +1147,8 @@ def checkNullConnection():
11441147
errMsg = getUnicode(errMsg)
11451148
raise SqlmapConnectionException(errMsg)
11461149

1150+
kb.pageCompress = popValue()
1151+
11471152
return kb.nullConnection is not None
11481153

11491154
def checkConnection(suppressOutput=False):

lib/request/connect.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from lib.core.common import getRequestHeader
3131
from lib.core.common import getUnicode
3232
from lib.core.common import logHTTPTraffic
33+
from lib.core.common import pushValue
34+
from lib.core.common import popValue
3335
from lib.core.common import randomizeParameterValue
3436
from lib.core.common import randomInt
3537
from lib.core.common import randomStr
@@ -311,7 +313,7 @@ def getPage(**kwargs):
311313
headers[HTTP_HEADER.PROXY_AUTHORIZATION] = kb.proxyAuthHeader
312314

313315
headers[HTTP_HEADER.ACCEPT] = HTTP_ACCEPT_HEADER_VALUE
314-
headers[HTTP_HEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE if method != HTTPMETHOD.HEAD and kb.pageCompress else "identity"
316+
headers[HTTP_HEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE if kb.pageCompress else "identity"
315317
headers[HTTP_HEADER.HOST] = host or getHostHeader(url)
316318

317319
if post is not None and HTTP_HEADER.CONTENT_TYPE not in headers:
@@ -813,6 +815,9 @@ def _randomizeParameter(paramString, randomParameter):
813815
if kb.nullConnection and not content and not response and not timeBasedCompare:
814816
noteResponseTime = False
815817

818+
pushValue(kb.pageCompress)
819+
kb.pageCompress = False
820+
816821
if kb.nullConnection == NULLCONNECTION.HEAD:
817822
method = HTTPMETHOD.HEAD
818823
elif kb.nullConnection == NULLCONNECTION.RANGE:
@@ -829,6 +834,8 @@ def _randomizeParameter(paramString, randomParameter):
829834
elif kb.nullConnection == NULLCONNECTION.RANGE and HTTP_HEADER.CONTENT_RANGE in headers:
830835
pageLength = int(headers[HTTP_HEADER.CONTENT_RANGE][headers[HTTP_HEADER.CONTENT_RANGE].find('/') + 1:])
831836

837+
kb.pageCompress = popValue()
838+
832839
if not pageLength:
833840
try:
834841
page, headers, code = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, referer=referer, host=host, silent=silent, method=method, auxHeaders=auxHeaders, response=response, raise404=raise404, ignoreTimeout=timeBasedCompare)

0 commit comments

Comments
 (0)