mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
improvement of redirecting code
This commit is contained in:
parent
e183437f0b
commit
1061c06617
|
@ -153,7 +153,7 @@ class Connect:
|
||||||
# url splitted with space char while urlencoding it in the later phase
|
# url splitted with space char while urlencoding it in the later phase
|
||||||
url = url.replace(" ", "%20")
|
url = url.replace(" ", "%20")
|
||||||
|
|
||||||
page = ""
|
page = None
|
||||||
cookieStr = ""
|
cookieStr = ""
|
||||||
requestMsg = "HTTP request [#%d]:\n%s " % (threadData.lastRequestUID, method or (HTTPMETHOD.POST if post else HTTPMETHOD.GET))
|
requestMsg = "HTTP request [#%d]:\n%s " % (threadData.lastRequestUID, method or (HTTPMETHOD.POST if post else HTTPMETHOD.GET))
|
||||||
requestMsg += "%s" % urlparse.urlsplit(url)[2] or "/"
|
requestMsg += "%s" % urlparse.urlsplit(url)[2] or "/"
|
||||||
|
@ -304,21 +304,25 @@ class Connect:
|
||||||
if kb.alwaysRedirect is None:
|
if kb.alwaysRedirect is None:
|
||||||
msg = "sqlmap got a %d redirect to " % conn.redcode
|
msg = "sqlmap got a %d redirect to " % conn.redcode
|
||||||
msg += "'%s'. Do you want to follow redirects " % conn.redurl
|
msg += "'%s'. Do you want to follow redirects " % conn.redurl
|
||||||
msg += "from now on (or stay on the original page)? [Y/n]"
|
msg += "from now on (or stay on the original page otherwise)? [Y/n]"
|
||||||
choice = readInput(msg, default="Y")
|
choice = readInput(msg, default="Y")
|
||||||
|
|
||||||
kb.alwaysRedirect = choice not in ("n", "N")
|
kb.alwaysRedirect = choice not in ("n", "N")
|
||||||
|
|
||||||
kwargs['url'] = conn.redurl if kb.alwaysRedirect else conf.url
|
if kb.alwaysRedirect:
|
||||||
kwargs['redirecting'] = conn.redcode
|
kwargs['url'] = conn.redurl
|
||||||
return Connect.__getPageProxy(**kwargs)
|
kwargs['redirecting'] = conn.redcode
|
||||||
|
return Connect.__getPageProxy(**kwargs)
|
||||||
|
else:
|
||||||
|
redirecting = conn.redcode
|
||||||
|
page = threadData.lastRedirectMsg[1]
|
||||||
|
|
||||||
# Return response object
|
# Return response object
|
||||||
if response:
|
if response:
|
||||||
return conn, None, None
|
return conn, None, None
|
||||||
|
|
||||||
# Get HTTP response
|
# Get HTTP response
|
||||||
page = conn.read()
|
page = conn.read() if page is None else page
|
||||||
code = redirecting or conn.code
|
code = redirecting or conn.code
|
||||||
responseHeaders = conn.info()
|
responseHeaders = conn.info()
|
||||||
responseHeaders[URI_HTTP_HEADER] = conn.geturl()
|
responseHeaders[URI_HTTP_HEADER] = conn.geturl()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user