adding some user input for "refreshing" cases (like redirect ones)

This commit is contained in:
Miroslav Stampar 2011-05-27 22:42:23 +00:00
parent cf69809c3c
commit c11ea35d53
2 changed files with 26 additions and 15 deletions

View File

@ -1317,6 +1317,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
kb.absFilePaths = set()
kb.adjustTimeDelay = False
kb.alwaysRedirect = None
kb.alwaysRefresh = None
kb.arch = None
kb.authHeader = None
kb.bannerFp = advancedDict()

View File

@ -260,7 +260,7 @@ class Connect:
msg += "from now on (or stay on the original page)? [Y/n]"
choice = readInput(msg, default="Y")
kb.alwaysRedirect = choice in ("n", "N")
kb.alwaysRedirect = choice not in ("n", "N")
kwargs['url'] = conn.redurl if kb.alwaysRedirect else conf.url
kwargs['redirecting'] = True
@ -281,6 +281,19 @@ class Connect:
if extractRegexResult(META_REFRESH_REGEX, page, re.DOTALL | re.IGNORECASE) and not refreshing:
url = extractRegexResult(META_REFRESH_REGEX, page, re.DOTALL | re.IGNORECASE)
debugMsg = "got HTML meta refresh header"
logger.debug(debugMsg)
if kb.alwaysRefresh is None:
msg = "sqlmap got a refresh request "
msg += "(redirect like response common to login pages). "
msg += "do you want to apply the refresh "
msg += "from now on (or stay on the original page)? [Y/n]"
choice = readInput(msg, default="Y")
kb.alwaysRefresh = choice not in ("n", "N")
if kb.alwaysRefresh:
if url.lower().startswith('http://'):
kwargs['url'] = url
else:
@ -291,9 +304,6 @@ class Connect:
kwargs['get'] = None
kwargs['post'] = None
debugMsg = "got HTML meta refresh header"
logger.debug(debugMsg)
try:
return Connect.__getPageProxy(**kwargs)
except sqlmapSyntaxException: