mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-10 09:49:06 +00:00
few fixes and minor cosmetics
This commit is contained in:
@@ -21,7 +21,7 @@ from lib.core.convert import urlencode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import queries
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.enums import PLACE
|
||||
|
||||
@@ -1925,9 +1925,7 @@ def pushValue(value):
|
||||
Push value to the stack (thread dependent)
|
||||
"""
|
||||
|
||||
# TODO: quick fix
|
||||
#getCurrentThreadData().valueStack.append(copy.deepcopy(value))
|
||||
getCurrentThreadData().valueStack.append(value)
|
||||
getCurrentThreadData().valueStack.append(copy.deepcopy(value))
|
||||
|
||||
def popValue():
|
||||
"""
|
||||
|
||||
@@ -7,21 +7,21 @@ Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.settings import LOGGER
|
||||
|
||||
# sqlmap paths
|
||||
paths = advancedDict()
|
||||
paths = AttribDict()
|
||||
|
||||
# object to store original command line options
|
||||
cmdLineOptions = advancedDict()
|
||||
cmdLineOptions = AttribDict()
|
||||
|
||||
# object to share within function and classes command
|
||||
# line options and settings
|
||||
conf = advancedDict()
|
||||
conf = AttribDict()
|
||||
|
||||
# object to share within function and classes results
|
||||
kb = advancedDict()
|
||||
kb = AttribDict()
|
||||
|
||||
# object with each database management system specific queries
|
||||
queries = {}
|
||||
|
||||
@@ -7,9 +7,12 @@ Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import copy
|
||||
import types
|
||||
|
||||
from lib.core.exception import sqlmapDataException
|
||||
|
||||
class advancedDict(dict):
|
||||
class AttribDict(dict):
|
||||
"""
|
||||
This class defines the sqlmap object, inheriting from Python data
|
||||
type dictionary.
|
||||
@@ -46,7 +49,7 @@ class advancedDict(dict):
|
||||
"""
|
||||
|
||||
# This test allows attributes to be set in the __init__ method
|
||||
if not self.__dict__.has_key('_advancedDict__initialised'):
|
||||
if not self.__dict__.has_key('_AttribDict__initialised'):
|
||||
return dict.__setattr__(self, item, value)
|
||||
|
||||
# Any normal attributes are handled normally
|
||||
@@ -62,9 +65,20 @@ class advancedDict(dict):
|
||||
def __setstate__(self, dict):
|
||||
self.__dict__ = dict
|
||||
|
||||
class injectionDict(advancedDict):
|
||||
def __deepcopy__(self, memo):
|
||||
retVal = self.__class__()
|
||||
memo[id(self)] = retVal
|
||||
for attr in dir(self):
|
||||
if not attr.startswith('_'):
|
||||
value = getattr(self, attr)
|
||||
if not isinstance(value, (types.BuiltinFunctionType, types.BuiltinFunctionType, types.FunctionType, types.MethodType)):
|
||||
setattr(retVal, attr, copy.deepcopy(value, memo))
|
||||
|
||||
return retVal
|
||||
|
||||
class InjectionDict(AttribDict):
|
||||
def __init__(self):
|
||||
advancedDict.__init__(self)
|
||||
AttribDict.__init__(self)
|
||||
|
||||
self.place = None
|
||||
self.parameter = None
|
||||
@@ -75,11 +89,11 @@ class injectionDict(advancedDict):
|
||||
|
||||
# data is a dict with various stype, each which is a dict with
|
||||
# all the information specific for that stype
|
||||
self.data = advancedDict()
|
||||
self.data = AttribDict()
|
||||
|
||||
# conf is a dict which stores current snapshot of important
|
||||
# options used during detection
|
||||
self.conf = advancedDict()
|
||||
self.conf = AttribDict()
|
||||
|
||||
self.dbms = None
|
||||
self.dbms_version = None
|
||||
|
||||
@@ -7,7 +7,7 @@ Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.datatype import AttribDict
|
||||
|
||||
_defaults = {
|
||||
"timeSec": 5,
|
||||
@@ -25,4 +25,4 @@ _defaults = {
|
||||
"tech": "BEUST"
|
||||
}
|
||||
|
||||
defaults = advancedDict(_defaults)
|
||||
defaults = AttribDict(_defaults)
|
||||
|
||||
@@ -55,8 +55,8 @@ from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import paths
|
||||
from lib.core.data import queries
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.datatype import injectionDict
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.datatype import InjectionDict
|
||||
from lib.core.defaults import defaults
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import HTTPHEADER
|
||||
@@ -963,7 +963,7 @@ def __setPrefixSuffix():
|
||||
if conf.prefix is not None and conf.suffix is not None:
|
||||
# Create a custom boundary object for user's supplied prefix
|
||||
# and suffix
|
||||
boundary = advancedDict()
|
||||
boundary = AttribDict()
|
||||
|
||||
boundary.level = 1
|
||||
boundary.clause = [ 0 ]
|
||||
@@ -1381,18 +1381,18 @@ def __setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.alwaysRefresh = None
|
||||
kb.arch = None
|
||||
kb.authHeader = None
|
||||
kb.bannerFp = advancedDict()
|
||||
kb.bannerFp = AttribDict()
|
||||
|
||||
kb.brute = advancedDict({'tables':[], 'columns':[]})
|
||||
kb.brute = AttribDict({'tables':[], 'columns':[]})
|
||||
kb.bruteMode = False
|
||||
|
||||
kb.cache = advancedDict()
|
||||
kb.cache = AttribDict()
|
||||
kb.cache.content = {}
|
||||
kb.cache.regex = {}
|
||||
kb.cache.stdev = {}
|
||||
|
||||
kb.commonOutputs = None
|
||||
kb.data = advancedDict()
|
||||
kb.data = AttribDict()
|
||||
kb.dataOutputFlag = False
|
||||
|
||||
# Active back-end DBMS fingerprint
|
||||
@@ -1415,10 +1415,10 @@ def __setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.hintValue = None
|
||||
kb.htmlFp = []
|
||||
kb.ignoreTimeout = False
|
||||
kb.injection = injectionDict()
|
||||
kb.injection = InjectionDict()
|
||||
kb.injections = []
|
||||
|
||||
kb.locks = advancedDict()
|
||||
kb.locks = AttribDict()
|
||||
kb.locks.cacheLock = threading.Lock()
|
||||
kb.locks.logLock = threading.Lock()
|
||||
kb.locks.ioLock = threading.Lock()
|
||||
@@ -1459,7 +1459,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.uChar = "NULL"
|
||||
kb.xpCmdshellAvailable = False
|
||||
|
||||
kb.misc = advancedDict()
|
||||
kb.misc = AttribDict()
|
||||
kb.misc.delimiter = randomStr(length=6, lowercase=True)
|
||||
kb.misc.start = ":%s:" % randomStr(length=3, lowercase=True)
|
||||
kb.misc.stop = ":%s:" % randomStr(length=3, lowercase=True)
|
||||
@@ -1795,7 +1795,7 @@ def __resolveCrossReferences():
|
||||
lib.core.threads.readInput = readInput
|
||||
lib.core.common.getPageTemplate = getPageTemplate
|
||||
|
||||
def init(inputOptions=advancedDict(), overrideOptions=False):
|
||||
def init(inputOptions=AttribDict(), overrideOptions=False):
|
||||
"""
|
||||
Set attributes into both configuration and knowledge base singletons
|
||||
based upon command line and configuration file options.
|
||||
|
||||
@@ -20,7 +20,7 @@ from lib.core.convert import base64unpickle
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.datatype import injectionDict
|
||||
from lib.core.datatype import InjectionDict
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import OS
|
||||
from lib.core.enums import PAYLOAD
|
||||
|
||||
@@ -15,7 +15,7 @@ from thread import error as threadError
|
||||
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapConnectionException
|
||||
from lib.core.exception import sqlmapThreadException
|
||||
@@ -23,7 +23,7 @@ from lib.core.exception import sqlmapValueException
|
||||
from lib.core.settings import MAX_NUMBER_OF_THREADS
|
||||
from lib.core.settings import PYVERSION
|
||||
|
||||
shared = advancedDict()
|
||||
shared = AttribDict()
|
||||
|
||||
class _ThreadData(threading.local):
|
||||
"""
|
||||
|
||||
@@ -8,10 +8,10 @@ See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.common import Backend
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.settings import EXCLUDE_UNESCAPE
|
||||
|
||||
class Unescaper(advancedDict):
|
||||
class Unescaper(AttribDict):
|
||||
def unescape(self, expression, quote=True, dbms=None):
|
||||
if expression is None:
|
||||
return expression
|
||||
|
||||
Reference in New Issue
Block a user