important improvement

This commit is contained in:
Miroslav Stampar 2010-12-26 13:20:52 +00:00
parent fcd01b3018
commit 569e060aab
5 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -18,6 +18,7 @@ class ThreadData():
def __init__(self):
self.lastErrorPage = None
self.lastHTTPError = None
self.lastQueryDuration = 0
self.lastRequestUID = 0
self.valueStack = []

View File

@ -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

View File

@ -235,6 +235,8 @@ class Connect:
code = e.code
status = e.msg
threadData.lastHTTPError = (threadData.lastRequestUID, code)
try:
page = e.read()
responseHeaders = e.info()