mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-06 22:23:14 +03:00
minor optimization (only way to prematurely stop SAX parser)
This commit is contained in:
parent
30cd877c4a
commit
3a5f0760f6
|
@ -20,6 +20,9 @@ class sqlmapConnectionException(Exception):
|
||||||
class sqlmapDataException(Exception):
|
class sqlmapDataException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class sqlmapEndSAXParsing(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
class sqlmapFilePathException(Exception):
|
class sqlmapFilePathException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ from lib.core.common import parseXmlFile
|
||||||
from lib.core.common import sanitizeStr
|
from lib.core.common import sanitizeStr
|
||||||
from lib.core.data import kb
|
from lib.core.data import kb
|
||||||
from lib.core.data import paths
|
from lib.core.data import paths
|
||||||
|
from lib.core.exception import sqlmapEndSAXParsing
|
||||||
from lib.core.threads import getCurrentThreadData
|
from lib.core.threads import getCurrentThreadData
|
||||||
|
|
||||||
class htmlHandler(ContentHandler):
|
class htmlHandler(ContentHandler):
|
||||||
|
@ -47,6 +48,7 @@ class htmlHandler(ContentHandler):
|
||||||
self.__match = None
|
self.__match = None
|
||||||
threadData = getCurrentThreadData()
|
threadData = getCurrentThreadData()
|
||||||
threadData.lastErrorPage = (threadData.lastRequestUID, self.__page)
|
threadData.lastErrorPage = (threadData.lastRequestUID, self.__page)
|
||||||
|
raise sqlmapEndSAXParsing
|
||||||
|
|
||||||
def htmlParser(page):
|
def htmlParser(page):
|
||||||
"""
|
"""
|
||||||
|
@ -58,7 +60,11 @@ def htmlParser(page):
|
||||||
checkFile(xmlfile)
|
checkFile(xmlfile)
|
||||||
page = sanitizeStr(page)
|
page = sanitizeStr(page)
|
||||||
handler = htmlHandler(page)
|
handler = htmlHandler(page)
|
||||||
|
|
||||||
|
try:
|
||||||
parseXmlFile(xmlfile, handler)
|
parseXmlFile(xmlfile, handler)
|
||||||
|
except sqlmapEndSAXParsing:
|
||||||
|
pass
|
||||||
|
|
||||||
if handler.dbms and handler.dbms not in kb.htmlFp:
|
if handler.dbms and handler.dbms not in kb.htmlFp:
|
||||||
kb.lastParserStatus = handler.dbms
|
kb.lastParserStatus = handler.dbms
|
||||||
|
|
Loading…
Reference in New Issue
Block a user