mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
Display HTTP request in -v>=3 even if connection failed
This commit is contained in:
parent
5bb8e154eb
commit
fea2414759
|
@ -106,7 +106,6 @@ class Connect:
|
|||
conn = multipartOpener.open(url, multipart)
|
||||
page = conn.read()
|
||||
responseHeaders = conn.info()
|
||||
|
||||
page = decodePage(page, responseHeaders.get("Content-Encoding"), responseHeaders.get("Content-Type"))
|
||||
|
||||
return page
|
||||
|
@ -129,35 +128,11 @@ class Connect:
|
|||
# Perform HTTP request
|
||||
headers = forgeHeaders(cookie, ua)
|
||||
req = urllib2.Request(url, post, headers)
|
||||
conn = urllib2.urlopen(req)
|
||||
|
||||
if hasattr(conn, "redurl") and hasattr(conn, "redcode") and not conf.redirectHandled:
|
||||
msg = "sqlmap got a %d redirect to " % conn.redcode
|
||||
msg += "%s - What target address do you " % conn.redurl
|
||||
msg += "want to use from now on? %s " % conf.url
|
||||
msg += "(default) or provide another target address based "
|
||||
msg += "also on the redirection got from the application\n"
|
||||
|
||||
while True:
|
||||
choice = readInput(msg, default="1")
|
||||
|
||||
if not choice or choice == "1":
|
||||
pass
|
||||
else:
|
||||
conf.url = choice
|
||||
return Connect.__getPageProxy(**kwargs)
|
||||
|
||||
break
|
||||
|
||||
conf.redirectHandled = True
|
||||
|
||||
# Reset the number of connection retries
|
||||
conf.retriesCount = 0
|
||||
|
||||
if not req.has_header("Accept-Encoding"):
|
||||
requestHeaders += "\nAccept-Encoding: identity"
|
||||
requestHeaders += "Accept-Encoding: identity\n"
|
||||
|
||||
requestHeaders = "\n".join(["%s: %s" % (header, value) for header, value in req.header_items()])
|
||||
requestHeaders += "\n".join(["%s: %s" % (header, value) for header, value in req.header_items()])
|
||||
|
||||
if not conf.dropSetCookie and conf.cj:
|
||||
for _, cookie in enumerate(conf.cj):
|
||||
|
@ -184,12 +159,36 @@ class Connect:
|
|||
|
||||
logger.log(9, requestMsg)
|
||||
|
||||
conn = urllib2.urlopen(req)
|
||||
|
||||
if hasattr(conn, "redurl") and hasattr(conn, "redcode") and not conf.redirectHandled:
|
||||
msg = "sqlmap got a %d redirect to " % conn.redcode
|
||||
msg += "%s - What target address do you " % conn.redurl
|
||||
msg += "want to use from now on? %s " % conf.url
|
||||
msg += "(default) or provide another target address based "
|
||||
msg += "also on the redirection got from the application\n"
|
||||
|
||||
while True:
|
||||
choice = readInput(msg, default="1")
|
||||
|
||||
if not choice or choice == "1":
|
||||
pass
|
||||
else:
|
||||
conf.url = choice
|
||||
return Connect.__getPageProxy(**kwargs)
|
||||
|
||||
break
|
||||
|
||||
conf.redirectHandled = True
|
||||
|
||||
# Reset the number of connection retries
|
||||
conf.retriesCount = 0
|
||||
|
||||
# Get HTTP response
|
||||
page = conn.read()
|
||||
code = conn.code
|
||||
status = conn.msg
|
||||
responseHeaders = conn.info()
|
||||
|
||||
page = decodePage(page, responseHeaders.get("Content-Encoding"), responseHeaders.get("Content-Type"))
|
||||
|
||||
except urllib2.HTTPError, e:
|
||||
|
|
Loading…
Reference in New Issue
Block a user