minor refactoring/cosmetics

This commit is contained in:
Miroslav Stampar 2010-12-24 11:06:57 +00:00
parent 23dc408901
commit aab14fa2d3
4 changed files with 8 additions and 4 deletions

View File

@ -46,6 +46,7 @@ from lib.core.exception import sqlmapSiteTooDynamic
from lib.core.exception import sqlmapUserQuitException from lib.core.exception import sqlmapUserQuitException
from lib.core.session import setString from lib.core.session import setString
from lib.core.session import setRegexp from lib.core.session import setRegexp
from lib.core.settings import DYNAMICITY_MARK_LENGTH
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.request.templates import getPageTemplate from lib.request.templates import getPageTemplate
@ -519,7 +520,7 @@ def checkDynamicContent(firstPage, secondPage):
block = blocks[i] block = blocks[i]
(_, _, length) = block (_, _, length) = block
if length <= conf.dynMarkLength: if length <= DYNAMICITY_MARK_LENGTH:
blocks.remove(block) blocks.remove(block)
else: else:
@ -543,7 +544,7 @@ def checkDynamicContent(firstPage, secondPage):
prefix = trimAlphaNum(prefix) prefix = trimAlphaNum(prefix)
suffix = trimAlphaNum(suffix) suffix = trimAlphaNum(suffix)
kb.dynamicMarkings.append((re.escape(prefix[-conf.dynMarkLength/2:]) if prefix else None, re.escape(suffix[:conf.dynMarkLength/2]) if suffix else None)) kb.dynamicMarkings.append((re.escape(prefix[-DYNAMICITY_MARK_LENGTH/2:]) if prefix else None, re.escape(suffix[:DYNAMICITY_MARK_LENGTH/2]) if suffix else None))
if len(kb.dynamicMarkings) > 0: if len(kb.dynamicMarkings) > 0:
infoMsg = "dynamic content marked for removal (%d region%s)" % (len(kb.dynamicMarkings), 's' if len(kb.dynamicMarkings) > 1 else '') infoMsg = "dynamic content marked for removal (%d region%s)" % (len(kb.dynamicMarkings), 's' if len(kb.dynamicMarkings) > 1 else '')

View File

@ -1091,7 +1091,6 @@ def __setConfAttributes():
conf.dbmsConnector = None conf.dbmsConnector = None
conf.dbmsHandler = None conf.dbmsHandler = None
conf.dumpPath = None conf.dumpPath = None
conf.dynMarkLength = 32
conf.httpHeaders = [] conf.httpHeaders = []
conf.hostname = None conf.hostname = None
conf.loggedToOut = None conf.loggedToOut = None

View File

@ -71,6 +71,9 @@ UNKNOWN_DBMS_VERSION = "Unknown"
LOWER_RATIO_BOUND = 0.02 LOWER_RATIO_BOUND = 0.02
UPPER_RATIO_BOUND = 0.98 UPPER_RATIO_BOUND = 0.98
# dynamicity mark length used in dynamicity removal engine
DYNAMICITY_MARK_LENGTH = 32
# System variables # System variables
IS_WIN = subprocess.mswindows IS_WIN = subprocess.mswindows
# The name of the operating system dependent module imported. The following # The name of the operating system dependent module imported. The following

View File

@ -18,7 +18,8 @@ from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.settings import CONSTANT_RATIO from lib.core.settings import CONSTANT_RATIO
from lib.core.settings import DIFF_TOLERANCE from lib.core.settings import DIFF_TOLERANCE
from lib.core.settings import LOWER_RATIO_BOUND, UPPER_RATIO_BOUND from lib.core.settings import LOWER_RATIO_BOUND
from lib.core.settings import UPPER_RATIO_BOUND
def comparison(page, headers=None, getSeqMatcher=False, pageLength=None): def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
if page is None and pageLength is None: if page is None and pageLength is None: