mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
improved redirection mechanism
This commit is contained in:
@@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import urllib2
|
||||
import urlparse
|
||||
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
@@ -52,6 +53,10 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
|
||||
elif "uri" in headers:
|
||||
result.redurl = headers.getheaders("uri")[0].split("?")[0]
|
||||
|
||||
if hasattr(result, 'redurl'):
|
||||
if result.redurl.startswith('.') or result.redurl.startswith('/'):
|
||||
result.redurl = urlparse.urljoin(conf.url, result.redurl)
|
||||
|
||||
if "set-cookie" in headers:
|
||||
result.setcookie = headers["set-cookie"].split("; path")[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user