mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
minor cosmetics
This commit is contained in:
parent
3640dbf745
commit
3487429eac
|
@ -1519,11 +1519,12 @@ def extractErrorMessage(page):
|
|||
|
||||
retVal = None
|
||||
|
||||
for regex in (r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s+(?P<result>.+)<br\s*/?\s*>", r"<li>Error Type:<br>(?P<result>.+?)</li>"):
|
||||
match = re.search(regex, page, re.DOTALL | re.IGNORECASE)
|
||||
if match:
|
||||
retVal = htmlunescape(match.group("result"))
|
||||
break
|
||||
if isinstance(page, basestring):
|
||||
for regex in (r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s+(?P<result>.+)<br\s*/?\s*>", r"<li>Error Type:<br>(?P<result>.+?)</li>"):
|
||||
match = re.search(regex, page, re.DOTALL | re.IGNORECASE)
|
||||
if match:
|
||||
retVal = htmlunescape(match.group("result")).replace("<br>", "\n").strip()
|
||||
break
|
||||
|
||||
return retVal
|
||||
|
||||
|
|
|
@ -220,11 +220,6 @@ class Connect:
|
|||
responseHeaders = conn.info()
|
||||
page = decodePage(page, responseHeaders.get("Content-Encoding"), responseHeaders.get("Content-Type"))
|
||||
|
||||
if conf.parseErrors:
|
||||
msg = extractErrorMessage(page)
|
||||
if msg:
|
||||
logger.info("parsed error message: '%s'" % msg)
|
||||
|
||||
except urllib2.HTTPError, e:
|
||||
code = e.code
|
||||
status = e.msg
|
||||
|
@ -240,12 +235,6 @@ class Connect:
|
|||
try:
|
||||
page = e.read()
|
||||
responseHeaders = e.info()
|
||||
|
||||
if conf.parseErrors:
|
||||
msg = extractErrorMessage(page)
|
||||
if msg:
|
||||
logger.info("parsed error message: '%s'" % msg)
|
||||
|
||||
except socket.timeout:
|
||||
warnMsg = "connection timed out while trying "
|
||||
warnMsg += "to get error page information (%d)" % code
|
||||
|
@ -309,6 +298,11 @@ class Connect:
|
|||
|
||||
logger.log(7, responseMsg)
|
||||
|
||||
if conf.parseErrors:
|
||||
msg = extractErrorMessage(page)
|
||||
if msg:
|
||||
logger.info("parsed error message: '%s'" % msg)
|
||||
|
||||
return page, responseHeaders
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue
Block a user