|
21 | 21 | from lib.core.common import calculateDeltaSeconds |
22 | 22 | from lib.core.common import clearConsoleLine |
23 | 23 | from lib.core.common import cpuThrottle |
| 24 | +from lib.core.common import extractRegexResult |
24 | 25 | from lib.core.common import getCurrentThreadData |
25 | 26 | from lib.core.common import getFilteredPageContent |
26 | 27 | from lib.core.common import unicodeToSafeHTMLValue |
|
43 | 44 | from lib.core.exception import sqlmapConnectionException |
44 | 45 | from lib.core.exception import sqlmapSyntaxException |
45 | 46 | from lib.core.settings import HTTP_SILENT_TIMEOUT |
| 47 | +from lib.core.settings import META_REFRESH_REGEX |
46 | 48 | from lib.core.settings import MIN_TIME_RESPONSES |
47 | 49 | from lib.core.settings import URI_HTTP_HEADER |
48 | 50 | from lib.core.threads import getCurrentThreadData |
@@ -96,6 +98,7 @@ def getPage(**kwargs): |
96 | 98 | auxHeaders = kwargs.get('auxHeaders', None) |
97 | 99 | response = kwargs.get('response', False) |
98 | 100 | ignoreTimeout = kwargs.get('ignoreTimeout', False) |
| 101 | + refreshing = kwargs.get('refreshing', False) |
99 | 102 |
|
100 | 103 | page = "" |
101 | 104 | cookieStr = "" |
@@ -131,6 +134,13 @@ def getPage(**kwargs): |
131 | 134 |
|
132 | 135 | return page |
133 | 136 |
|
| 137 | + elif refreshing: |
| 138 | + # Reference(s): |
| 139 | + # http://vancouver-webpages.com/META/metatags.detail.html |
| 140 | + # http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm |
| 141 | + get = None |
| 142 | + post = None |
| 143 | + |
134 | 144 | else: |
135 | 145 | if conf.parameters.has_key(PLACE.GET) and not get: |
136 | 146 | get = conf.parameters[PLACE.GET] |
@@ -253,6 +263,24 @@ def getPage(**kwargs): |
253 | 263 | page = decodePage(page, responseHeaders.get(HTTPHEADER.CONTENT_ENCODING), responseHeaders.get(HTTPHEADER.CONTENT_TYPE)) |
254 | 264 | status = getUnicode(conn.msg) |
255 | 265 |
|
| 266 | + if extractRegexResult(META_REFRESH_REGEX, page, re.DOTALL | re.IGNORECASE) and not refreshing: |
| 267 | + url = extractRegexResult(META_REFRESH_REGEX, page, re.DOTALL | re.IGNORECASE) |
| 268 | + |
| 269 | + if url.lower().startswith('http://'): |
| 270 | + kwargs['url'] = url |
| 271 | + else: |
| 272 | + kwargs['url'] = conf.url[:conf.url.rfind('/')+1] + url |
| 273 | + |
| 274 | + kwargs['refreshing'] = True |
| 275 | + |
| 276 | + debugMsg = "got HTML meta refresh header" |
| 277 | + logger.debug(debugMsg) |
| 278 | + |
| 279 | + try: |
| 280 | + return Connect.__getPageProxy(**kwargs) |
| 281 | + except sqlmapSyntaxException: |
| 282 | + pass |
| 283 | + |
256 | 284 | # Explicit closing of connection object |
257 | 285 | if not conf.keepAlive: |
258 | 286 | try: |
|
0 commit comments