Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4278bbc

Browse files
committed
Patch for sporadic --parse-errors in generic SQL errors (e.g. CrateDB)
1 parent db126af commit 4278bbc

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

lib/core/common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,12 @@ def extractErrorMessage(page):
27032703
retVal = candidate
27042704
break
27052705

2706+
if not retVal and wasLastResponseDBMSError():
2707+
match = re.search(r"[^\n]*SQL[^\n:]*:[^\n]*", page, re.IGNORECASE)
2708+
2709+
if match:
2710+
retVal = match.group(0)
2711+
27062712
return retVal
27072713

27082714
def findLocalPort(ports):

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.2.5"
21+
VERSION = "1.4.2.6"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/parse/html.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ def htmlParser(page):
7373
handler = HTMLHandler(page)
7474
key = hash(page)
7575

76+
# generic SQL warning/error messages
77+
if re.search(r"SQL (warning|error|syntax)", page, re.I):
78+
handler._markAsErrorPage()
79+
7680
if key in kb.cache.parsedDbms:
7781
retVal = kb.cache.parsedDbms[key]
7882
if retVal:
@@ -89,8 +93,4 @@ def htmlParser(page):
8993

9094
kb.cache.parsedDbms[key] = handler.dbms
9195

92-
# generic SQL warning/error messages
93-
if re.search(r"SQL (warning|error|syntax)", page, re.I):
94-
handler._markAsErrorPage()
95-
9696
return handler.dbms

0 commit comments

Comments
 (0)