mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
important improvement
This commit is contained in:
parent
fcd01b3018
commit
569e060aab
|
@ -28,6 +28,7 @@ from lib.core.common import removeDynamicContent
|
|||
from lib.core.common import showStaticWords
|
||||
from lib.core.common import trimAlphaNum
|
||||
from lib.core.common import wasLastRequestDBMSError
|
||||
from lib.core.common import wasLastRequestHTTPError
|
||||
from lib.core.common import DynamicContentItem
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
|
@ -762,7 +763,7 @@ def checkConnection(suppressOutput=False):
|
|||
try:
|
||||
page, _ = Request.queryPage(content=True)
|
||||
kb.originalPage = kb.pageTemplate = page
|
||||
kb.errorIsNone = not wasLastRequestDBMSError()
|
||||
kb.errorIsNone = not wasLastRequestDBMSError() and not wasLastRequestHTTPError()
|
||||
except sqlmapConnectionException, errMsg:
|
||||
errMsg = getUnicode(errMsg)
|
||||
raise sqlmapConnectionException, errMsg
|
||||
|
|
|
@ -1560,6 +1560,14 @@ def wasLastRequestDBMSError():
|
|||
threadData = getCurrentThreadData()
|
||||
return threadData.lastErrorPage and threadData.lastErrorPage[0] == threadData.lastRequestUID
|
||||
|
||||
def wasLastRequestHTTPError():
|
||||
"""
|
||||
Returns True if the last web request resulted in an errornous HTTP code (like 500)
|
||||
"""
|
||||
|
||||
threadData = getCurrentThreadData()
|
||||
return threadData.lastHTTPError and threadData.lastHTTPError[0] == threadData.lastRequestUID
|
||||
|
||||
def wasLastRequestDelayed():
|
||||
"""
|
||||
Returns True if the last web request resulted in a time-delay
|
||||
|
|
|
@ -18,6 +18,7 @@ class ThreadData():
|
|||
|
||||
def __init__(self):
|
||||
self.lastErrorPage = None
|
||||
self.lastHTTPError = None
|
||||
self.lastQueryDuration = 0
|
||||
self.lastRequestUID = 0
|
||||
self.valueStack = []
|
||||
|
|
|
@ -13,6 +13,7 @@ from difflib import SequenceMatcher
|
|||
|
||||
from lib.core.common import removeDynamicContent
|
||||
from lib.core.common import wasLastRequestDBMSError
|
||||
from lib.core.common import wasLastRequestHTTPError
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
|
@ -58,7 +59,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
|||
return re.search(conf.regexp, page, re.I | re.M) is not None
|
||||
|
||||
# In case of an DBMS error page return None
|
||||
if kb.errorIsNone and wasLastRequestDBMSError():
|
||||
if kb.errorIsNone and (wasLastRequestDBMSError() or wasLastRequestHTTPError()):
|
||||
return None
|
||||
|
||||
# Dynamic content lines to be excluded before comparison
|
||||
|
|
|
@ -235,6 +235,8 @@ class Connect:
|
|||
code = e.code
|
||||
status = e.msg
|
||||
|
||||
threadData.lastHTTPError = (threadData.lastRequestUID, code)
|
||||
|
||||
try:
|
||||
page = e.read()
|
||||
responseHeaders = e.info()
|
||||
|
|
Loading…
Reference in New Issue
Block a user