diff --git a/lib/core/common.py b/lib/core/common.py
index b40bdcf5a..df76d5988 100644
--- a/lib/core/common.py
+++ b/lib/core/common.py
@@ -2642,7 +2642,9 @@ def extractErrorMessage(page):
"""
Returns reported error message from page if it founds one
- >>> extractErrorMessage(u'
Test\\nWarning: oci_parse() [function.oci-parse]: ORA-01756: quoted string not properly terminated
Only a test page
') == u'oci_parse() [function.oci-parse]: ORA-01756: quoted string not properly terminated'
+ >>> extractErrorMessage(u'Test\\nWarning: oci_parse() [function.oci-parse]: ORA-01756: quoted string not properly terminated
Only a test page
')
+ 'oci_parse() [function.oci-parse]: ORA-01756: quoted string not properly terminated'
+ >>> extractErrorMessage('Warning: This is only a dummy foobar test') is None
True
"""
@@ -2653,8 +2655,10 @@ def extractErrorMessage(page):
match = re.search(regex, page, re.IGNORECASE)
if match:
- retVal = htmlUnescape(match.group("result")).replace("
", "\n").strip()
- break
+ candidate = htmlUnescape(match.group("result")).replace("
", "\n").strip()
+ if re.search(r"\b([a-z]+ ){5}", candidate) is None: # check for legitimate (e.g. Warning:...) text
+ retVal = candidate
+ break
return retVal
diff --git a/lib/core/convert.py b/lib/core/convert.py
index 5a7332b6a..5ce6d41a2 100644
--- a/lib/core/convert.py
+++ b/lib/core/convert.py
@@ -80,15 +80,17 @@ def htmlUnescape(value):
"""
retVal = value
+
if value and isinstance(value, six.string_types):
replacements = (("<", '<'), (">", '>'), (""", '"'), (" ", ' '), ("&", '&'), ("'", "'"))
for code, value in replacements:
retVal = retVal.replace(code, value)
try:
- retVal = re.sub(r"([^ ;]+);", lambda match: _unichr(int(match.group(1), 16)), retVal)
+ retVal = getText(re.sub(r"([^ ;]+);", lambda match: _unichr(int(match.group(1), 16)), retVal))
except ValueError:
pass
+
return retVal
def singleTimeWarnMessage(message): # Cross-referenced function
diff --git a/lib/core/settings.py b/lib/core/settings.py
index a5cc4fbee..383e1d14d 100644
--- a/lib/core/settings.py
+++ b/lib/core/settings.py
@@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr
# sqlmap version (...)
-VERSION = "1.3.5.150"
+VERSION = "1.3.5.151"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)