mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 05:01:30 +00:00
code refactoring and some fixes
This commit is contained in:
@@ -89,16 +89,16 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
||||
|
||||
# If the url is stable and we did not set yet the match ratio and the
|
||||
# current injected value changes the url page content
|
||||
if conf.matchRatio is None:
|
||||
if kb.matchRatio is None:
|
||||
if conf.thold:
|
||||
conf.matchRatio = conf.thold
|
||||
kb.matchRatio = conf.thold
|
||||
|
||||
elif kb.pageStable and ratio > 0.6 and ratio < 0.99:
|
||||
conf.matchRatio = ratio
|
||||
logger.debug("setting match ratio for current parameter to %.3f" % conf.matchRatio)
|
||||
kb.matchRatio = ratio
|
||||
logger.debug("setting match ratio for current parameter to %.3f" % kb.matchRatio)
|
||||
|
||||
elif not kb.pageStable or ( kb.pageStable and ratio < 0.6 ):
|
||||
conf.matchRatio = CONSTANT_RATIO
|
||||
kb.matchRatio = CONSTANT_RATIO
|
||||
logger.debug("setting match ratio for current parameter to default value 0.900")
|
||||
|
||||
# If it has been requested to return the ratio and not a comparison
|
||||
@@ -109,11 +109,11 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
||||
elif ratio == 1:
|
||||
return True
|
||||
|
||||
elif conf.matchRatio is None:
|
||||
elif kb.matchRatio is None:
|
||||
return None
|
||||
|
||||
else:
|
||||
if conf.matchRatio == CONSTANT_RATIO or conf.thold:
|
||||
return ratio > conf.matchRatio
|
||||
if kb.matchRatio == CONSTANT_RATIO or conf.thold:
|
||||
return ratio > kb.matchRatio
|
||||
else:
|
||||
return (ratio - conf.matchRatio) > DIFF_TOLERANCE
|
||||
return (ratio - kb.matchRatio) > DIFF_TOLERANCE
|
||||
|
||||
@@ -17,6 +17,7 @@ from lib.core.common import dataToSessionFile
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import expandAsteriskForColumns
|
||||
from lib.core.common import getPublicTypeMembers
|
||||
from lib.core.common import initTechnique
|
||||
from lib.core.common import isTechniqueAvailable
|
||||
from lib.core.common import parseUnionPage
|
||||
from lib.core.common import popValue
|
||||
@@ -37,7 +38,6 @@ from lib.core.settings import MIN_TIME_RESPONSES
|
||||
from lib.core.unescaper import unescaper
|
||||
from lib.request.connect import Connect as Request
|
||||
from lib.request.direct import direct
|
||||
from lib.request.templates import getPageTemplate
|
||||
from lib.techniques.inband.union.use import unionUse
|
||||
from lib.techniques.blind.inference import bisection
|
||||
from lib.techniques.error.use import errorUse
|
||||
@@ -99,7 +99,11 @@ def __goInferenceFields(expression, expressionFields, expressionFieldsList, payl
|
||||
return outputs
|
||||
|
||||
def __goBooleanProxy(expression, resumeValue=True):
|
||||
kb.pageTemplate = getPageTemplate(kb.injection.data[kb.technique].templatePayload, kb.injection.place)
|
||||
"""
|
||||
Retrieve the output of a boolean based SQL query
|
||||
"""
|
||||
|
||||
initTechnique(kb.technique)
|
||||
|
||||
vector = kb.injection.data[kb.technique].vector
|
||||
vector = vector.replace("[INFERENCE]", expression)
|
||||
@@ -125,7 +129,8 @@ def __goInferenceProxy(expression, fromUser=False, expected=None, batch=False, r
|
||||
parameter through a bisection algorithm.
|
||||
"""
|
||||
|
||||
kb.pageTemplate = getPageTemplate(kb.injection.data[kb.technique].templatePayload, kb.injection.place)
|
||||
initTechnique(kb.technique)
|
||||
|
||||
vector = agent.cleanupPayload(kb.injection.data[kb.technique].vector)
|
||||
query = agent.prefixQuery(vector)
|
||||
query = agent.suffixQuery(query)
|
||||
|
||||
@@ -7,6 +7,8 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import lib.core.common
|
||||
|
||||
from lib.core.data import kb
|
||||
from lib.request.connect import Connect as Request
|
||||
|
||||
@@ -20,3 +22,5 @@ def getPageTemplate(payload, place):
|
||||
retVal = kb.pageTemplates[(payload, place)]
|
||||
|
||||
return retVal
|
||||
|
||||
lib.core.common.getPageTemplate = getPageTemplate
|
||||
Reference in New Issue
Block a user