Skip to content

Commit 1740f63

Browse files
committed
Fixes #5536
1 parent e0ec2fc commit 1740f63

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

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.7.9.3"
23+
VERSION = "1.7.10.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)

lib/request/connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ class _(dict):
641641
responseHeaders = conn.info()
642642
responseHeaders[URI_HTTP_HEADER] = conn.geturl() if hasattr(conn, "geturl") else url
643643

644-
if hasattr(conn, "redurl"):
644+
if getattr(conn, "redurl", None) is not None:
645645
responseHeaders[HTTP_HEADER.LOCATION] = conn.redurl
646646

647647
responseHeaders = patchHeaders(responseHeaders)

lib/request/redirecthandler.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import io
9+
import re
910
import time
1011
import types
1112

@@ -71,6 +72,7 @@ def _redirect_request(self, req, fp, code, msg, headers, newurl):
7172
def http_error_302(self, req, fp, code, msg, headers):
7273
start = time.time()
7374
content = None
75+
forceRedirect = False
7476
redurl = self._get_header_redirect(headers) if not conf.ignoreRedirects else None
7577

7678
try:
@@ -111,12 +113,18 @@ def http_error_302(self, req, fp, code, msg, headers):
111113
redurl = _urllib.parse.urljoin(req.get_full_url(), redurl)
112114

113115
self._infinite_loop_check(req)
114-
self._ask_redirect_choice(code, redurl, req.get_method())
116+
if conf.scope:
117+
if not re.search(conf.scope, redurl, re.I):
118+
redurl = None
119+
else:
120+
forceRedirect = True
121+
else:
122+
self._ask_redirect_choice(code, redurl, req.get_method())
115123
except ValueError:
116124
redurl = None
117125
result = fp
118126

119-
if redurl and kb.choices.redirect == REDIRECTION.YES:
127+
if redurl and (kb.choices.redirect == REDIRECTION.YES or forceRedirect):
120128
parseResponse(content, headers)
121129

122130
req.headers[HTTP_HEADER.HOST] = getHostHeader(redurl)

0 commit comments

Comments
 (0)