From 7d313ac911ce9b58278fa80a3d626e59dc7b6edb Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 15 Mar 2012 19:47:59 +0000 Subject: [PATCH] few more fixes for proper redirecting mechanism --- lib/controller/checks.py | 6 ++++++ lib/request/redirecthandler.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 01d2a30c5..b1e7aa116 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -665,6 +665,9 @@ def checkDynParam(place, parameter, value): dynamicity might depend on another parameter. """ + if kb.redirectChoice: + return None + kb.matchRatio = None dynResult = None randInt = randomInt() @@ -746,6 +749,9 @@ def checkStability(): like for instance string matching (--string). """ + if kb.redirectChoice: + return None + infoMsg = "testing if the url is stable, wait a few seconds" logger.info(infoMsg) diff --git a/lib/request/redirecthandler.py b/lib/request/redirecthandler.py index 8b1932605..64f8ff6c0 100644 --- a/lib/request/redirecthandler.py +++ b/lib/request/redirecthandler.py @@ -38,7 +38,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler): return retVal def _ask_redirect_choice(self, redcode, redurl): - if kb.redirectChoice is None: + if kb.redirectChoice is None and kb.originalPage: msg = "sqlmap got a %d redirect to " % redcode msg += "'%s'. What do you want to do? " % redurl msg += "\n[1] Follow the redirection (default)" @@ -93,7 +93,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler): dbgMsg += "redirect response content (%s)" % msg logger.debug(dbgMsg) - if kb.redirectChoice == REDIRECTION.FOLLOW: + if kb.redirectChoice == REDIRECTION.FOLLOW or kb.originalPage is None: req.headers[HTTPHEADER.HOST] = getHostHeader(redurl) result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers) else: