mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-10 10:43:44 +03:00
Dealing with basesting (one baby step closer to Py3 salvation)
This commit is contained in:
parent
915bc1fc99
commit
afe497a954
|
@ -105,6 +105,7 @@ from lib.request.inject import checkBooleanExpression
|
||||||
from lib.request.templates import getPageTemplate
|
from lib.request.templates import getPageTemplate
|
||||||
from lib.techniques.union.test import unionTest
|
from lib.techniques.union.test import unionTest
|
||||||
from lib.techniques.union.use import configUnion
|
from lib.techniques.union.use import configUnion
|
||||||
|
from thirdparty import six
|
||||||
from thirdparty.six.moves import http_client as _http_client
|
from thirdparty.six.moves import http_client as _http_client
|
||||||
|
|
||||||
def checkSqlInjection(place, parameter, value):
|
def checkSqlInjection(place, parameter, value):
|
||||||
|
@ -692,7 +693,7 @@ def checkSqlInjection(place, parameter, value):
|
||||||
# Test for UNION query SQL injection
|
# Test for UNION query SQL injection
|
||||||
reqPayload, vector = unionTest(comment, place, parameter, value, prefix, suffix)
|
reqPayload, vector = unionTest(comment, place, parameter, value, prefix, suffix)
|
||||||
|
|
||||||
if isinstance(reqPayload, basestring):
|
if isinstance(reqPayload, six.string_types):
|
||||||
infoMsg = "%s parameter '%s' is '%s' injectable" % (paramType, parameter, title)
|
infoMsg = "%s parameter '%s' is '%s' injectable" % (paramType, parameter, title)
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,7 @@ from lib.core.settings import VERSION_STRING
|
||||||
from lib.core.settings import WEBSCARAB_SPLITTER
|
from lib.core.settings import WEBSCARAB_SPLITTER
|
||||||
from lib.core.threads import getCurrentThreadData
|
from lib.core.threads import getCurrentThreadData
|
||||||
from lib.utils.sqlalchemy import _sqlalchemy
|
from lib.utils.sqlalchemy import _sqlalchemy
|
||||||
|
from thirdparty import six
|
||||||
from thirdparty.clientform.clientform import ParseResponse
|
from thirdparty.clientform.clientform import ParseResponse
|
||||||
from thirdparty.clientform.clientform import ParseError
|
from thirdparty.clientform.clientform import ParseError
|
||||||
from thirdparty.colorama.initialise import init as coloramainit
|
from thirdparty.colorama.initialise import init as coloramainit
|
||||||
|
@ -355,7 +356,7 @@ class Backend:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def setVersion(version):
|
def setVersion(version):
|
||||||
if isinstance(version, basestring):
|
if isinstance(version, six.string_types):
|
||||||
kb.dbmsVersion = [version]
|
kb.dbmsVersion = [version]
|
||||||
|
|
||||||
return kb.dbmsVersion
|
return kb.dbmsVersion
|
||||||
|
@ -364,7 +365,7 @@ class Backend:
|
||||||
def setVersionList(versionsList):
|
def setVersionList(versionsList):
|
||||||
if isinstance(versionsList, list):
|
if isinstance(versionsList, list):
|
||||||
kb.dbmsVersion = versionsList
|
kb.dbmsVersion = versionsList
|
||||||
elif isinstance(versionsList, basestring):
|
elif isinstance(versionsList, six.string_types):
|
||||||
Backend.setVersion(versionsList)
|
Backend.setVersion(versionsList)
|
||||||
else:
|
else:
|
||||||
logger.error("invalid format of versionsList")
|
logger.error("invalid format of versionsList")
|
||||||
|
@ -387,7 +388,7 @@ class Backend:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Little precaution, in theory this condition should always be false
|
# Little precaution, in theory this condition should always be false
|
||||||
elif kb.os is not None and isinstance(os, basestring) and kb.os.lower() != os.lower():
|
elif kb.os is not None and isinstance(os, six.string_types) and kb.os.lower() != os.lower():
|
||||||
msg = "sqlmap previously fingerprinted back-end DBMS "
|
msg = "sqlmap previously fingerprinted back-end DBMS "
|
||||||
msg += "operating system %s. However now it has " % kb.os
|
msg += "operating system %s. However now it has " % kb.os
|
||||||
msg += "been fingerprinted to be %s. " % os
|
msg += "been fingerprinted to be %s. " % os
|
||||||
|
@ -406,7 +407,7 @@ class Backend:
|
||||||
warnMsg = "invalid value"
|
warnMsg = "invalid value"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
elif kb.os is None and isinstance(os, basestring):
|
elif kb.os is None and isinstance(os, six.string_types):
|
||||||
kb.os = os.capitalize()
|
kb.os = os.capitalize()
|
||||||
|
|
||||||
return kb.os
|
return kb.os
|
||||||
|
@ -416,7 +417,7 @@ class Backend:
|
||||||
if version is None:
|
if version is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
elif kb.osVersion is None and isinstance(version, basestring):
|
elif kb.osVersion is None and isinstance(version, six.string_types):
|
||||||
kb.osVersion = version
|
kb.osVersion = version
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -436,7 +437,7 @@ class Backend:
|
||||||
while True:
|
while True:
|
||||||
choice = readInput(msg, default='1')
|
choice = readInput(msg, default='1')
|
||||||
|
|
||||||
if isinstance(choice, basestring) and choice.isdigit() and int(choice) in (1, 2):
|
if hasattr(choice, "isdigit") and choice.isdigit() and int(choice) in (1, 2):
|
||||||
kb.arch = 32 if int(choice) == 1 else 64
|
kb.arch = 32 if int(choice) == 1 else 64
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -640,7 +641,7 @@ def paramToDict(place, parameters=None):
|
||||||
if isinstance(value, (list, tuple, set, dict)):
|
if isinstance(value, (list, tuple, set, dict)):
|
||||||
if value:
|
if value:
|
||||||
walk(head, value)
|
walk(head, value)
|
||||||
elif isinstance(value, (bool, int, float, basestring)):
|
elif isinstance(value, (bool, int, float, six.string_types)):
|
||||||
original = current[key]
|
original = current[key]
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
current[key] = "%s%s" % (getUnicode(value).lower(), BOUNDED_INJECTION_MARKER)
|
current[key] = "%s%s" % (getUnicode(value).lower(), BOUNDED_INJECTION_MARKER)
|
||||||
|
@ -884,7 +885,7 @@ def setColor(message, color=None, bold=False, level=None):
|
||||||
if bold or color:
|
if bold or color:
|
||||||
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)
|
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)
|
||||||
elif level:
|
elif level:
|
||||||
level = getattr(logging, level, None) if isinstance(level, basestring) else level
|
level = getattr(logging, level, None) if isinstance(level, six.string_types) else level
|
||||||
retVal = LOGGER_HANDLER.colorize(message, level)
|
retVal = LOGGER_HANDLER.colorize(message, level)
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
@ -935,7 +936,7 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
|
||||||
if multiThreadMode:
|
if multiThreadMode:
|
||||||
logging._releaseLock()
|
logging._releaseLock()
|
||||||
|
|
||||||
kb.prependFlag = isinstance(data, basestring) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')
|
kb.prependFlag = isinstance(data, six.string_types) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')
|
||||||
|
|
||||||
def dataToTrafficFile(data):
|
def dataToTrafficFile(data):
|
||||||
if not conf.trafficFile:
|
if not conf.trafficFile:
|
||||||
|
@ -1068,7 +1069,7 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
|
||||||
finally:
|
finally:
|
||||||
logging._releaseLock()
|
logging._releaseLock()
|
||||||
|
|
||||||
if retVal and default and isinstance(default, basestring) and len(default) == 1:
|
if retVal and default and isinstance(default, six.string_types) and len(default) == 1:
|
||||||
retVal = retVal.strip()
|
retVal = retVal.strip()
|
||||||
|
|
||||||
if boolean:
|
if boolean:
|
||||||
|
@ -1663,7 +1664,7 @@ def parseUnionPage(page):
|
||||||
else:
|
else:
|
||||||
data = page
|
data = page
|
||||||
|
|
||||||
if len(data) == 1 and isinstance(data[0], basestring):
|
if len(data) == 1 and isinstance(data[0], six.string_types):
|
||||||
data = data[0]
|
data = data[0]
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
@ -1861,7 +1862,7 @@ def safeStringFormat(format_, params):
|
||||||
else:
|
else:
|
||||||
retVal = re.sub(r"(\A|[^A-Za-z0-9])(%d)([^A-Za-z0-9]|\Z)", r"\g<1>%s\g<3>", format_)
|
retVal = re.sub(r"(\A|[^A-Za-z0-9])(%d)([^A-Za-z0-9]|\Z)", r"\g<1>%s\g<3>", format_)
|
||||||
|
|
||||||
if isinstance(params, basestring):
|
if isinstance(params, six.string_types):
|
||||||
retVal = retVal.replace("%s", params, 1)
|
retVal = retVal.replace("%s", params, 1)
|
||||||
elif not isListLike(params):
|
elif not isListLike(params):
|
||||||
retVal = retVal.replace("%s", getUnicode(params), 1)
|
retVal = retVal.replace("%s", getUnicode(params), 1)
|
||||||
|
@ -2383,9 +2384,9 @@ def getUnicode(value, encoding=None, noneToNull=False):
|
||||||
if noneToNull and value is None:
|
if noneToNull and value is None:
|
||||||
return NULL
|
return NULL
|
||||||
|
|
||||||
if isinstance(value, unicode):
|
if isinstance(value, six.text_type):
|
||||||
return value
|
return value
|
||||||
elif isinstance(value, basestring):
|
elif isinstance(value, six.binary_type):
|
||||||
# Heuristics (if encoding not explicitly specified)
|
# Heuristics (if encoding not explicitly specified)
|
||||||
candidates = filter(None, (encoding, kb.get("pageEncoding") if kb.get("originalPage") else None, conf.get("encoding"), UNICODE_ENCODING, sys.getfilesystemencoding()))
|
candidates = filter(None, (encoding, kb.get("pageEncoding") if kb.get("originalPage") else None, conf.get("encoding"), UNICODE_ENCODING, sys.getfilesystemencoding()))
|
||||||
if all(_ in value for _ in ('<', '>')):
|
if all(_ in value for _ in ('<', '>')):
|
||||||
|
@ -2397,16 +2398,16 @@ def getUnicode(value, encoding=None, noneToNull=False):
|
||||||
|
|
||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
try:
|
try:
|
||||||
return unicode(value, candidate)
|
return six.text_type(value, candidate)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
return unicode(value, encoding or (kb.get("pageEncoding") if kb.get("originalPage") else None) or UNICODE_ENCODING)
|
return six.text_type(value, encoding or (kb.get("pageEncoding") if kb.get("originalPage") else None) or UNICODE_ENCODING)
|
||||||
except UnicodeDecodeError as ex:
|
except UnicodeDecodeError as ex:
|
||||||
try:
|
try:
|
||||||
return unicode(value, UNICODE_ENCODING)
|
return six.text_type(value, UNICODE_ENCODING)
|
||||||
except:
|
except:
|
||||||
value = value[:ex.start] + "".join(INVALID_UNICODE_CHAR_FORMAT % ord(_) for _ in value[ex.start:ex.end]) + value[ex.end:]
|
value = value[:ex.start] + "".join(INVALID_UNICODE_CHAR_FORMAT % ord(_) for _ in value[ex.start:ex.end]) + value[ex.end:]
|
||||||
elif isListLike(value):
|
elif isListLike(value):
|
||||||
|
@ -2414,9 +2415,9 @@ def getUnicode(value, encoding=None, noneToNull=False):
|
||||||
return value
|
return value
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
return unicode(value)
|
return six.text_type(value)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
return unicode(str(value), errors="ignore") # encoding ignored for non-basestring instances
|
return six.text_type(str(value), errors="ignore") # encoding ignored for non-basestring instances
|
||||||
|
|
||||||
def longestCommonPrefix(*sequences):
|
def longestCommonPrefix(*sequences):
|
||||||
"""
|
"""
|
||||||
|
@ -2568,7 +2569,7 @@ def extractErrorMessage(page):
|
||||||
|
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
if isinstance(page, basestring):
|
if isinstance(page, six.string_types):
|
||||||
for regex in ERROR_PARSING_REGEXES:
|
for regex in ERROR_PARSING_REGEXES:
|
||||||
match = re.search(regex, page, re.IGNORECASE)
|
match = re.search(regex, page, re.IGNORECASE)
|
||||||
|
|
||||||
|
@ -2867,7 +2868,7 @@ def isNumPosStrValue(value):
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return (value and isinstance(value, basestring) and value.isdigit() and int(value) > 0) or (isinstance(value, int) and value > 0)
|
return (hasattr(value, "isdigit") and value.isdigit() and int(value) > 0) or (isinstance(value, int) and value > 0)
|
||||||
|
|
||||||
@cachedmethod
|
@cachedmethod
|
||||||
def aliasToDbmsEnum(dbms):
|
def aliasToDbmsEnum(dbms):
|
||||||
|
@ -3015,7 +3016,7 @@ def isDBMSVersionAtLeast(version):
|
||||||
|
|
||||||
value = filterStringValue(value, '[0-9.><=]')
|
value = filterStringValue(value, '[0-9.><=]')
|
||||||
|
|
||||||
if value and isinstance(value, basestring):
|
if value and isinstance(value, six.string_types):
|
||||||
if value.startswith(">="):
|
if value.startswith(">="):
|
||||||
value = float(value.replace(">=", ""))
|
value = float(value.replace(">=", ""))
|
||||||
elif value.startswith(">"):
|
elif value.startswith(">"):
|
||||||
|
@ -3145,7 +3146,7 @@ def saveConfig(conf, filename):
|
||||||
elif datatype == OPTION_TYPE.STRING:
|
elif datatype == OPTION_TYPE.STRING:
|
||||||
value = ""
|
value = ""
|
||||||
|
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, six.string_types):
|
||||||
value = value.replace("\n", "\n ")
|
value = value.replace("\n", "\n ")
|
||||||
|
|
||||||
config.set(family, option, value)
|
config.set(family, option, value)
|
||||||
|
@ -3176,7 +3177,7 @@ def initTechnique(technique=None):
|
||||||
for key, value in kb.injection.conf.items():
|
for key, value in kb.injection.conf.items():
|
||||||
if value and (not hasattr(conf, key) or (hasattr(conf, key) and not getattr(conf, key))):
|
if value and (not hasattr(conf, key) or (hasattr(conf, key) and not getattr(conf, key))):
|
||||||
setattr(conf, key, value)
|
setattr(conf, key, value)
|
||||||
debugMsg = "resuming configuration option '%s' (%s)" % (key, ("'%s'" % value) if isinstance(value, basestring) else value)
|
debugMsg = "resuming configuration option '%s' (%s)" % (key, ("'%s'" % value) if isinstance(value, six.string_types) else value)
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
if value and key == "optimize":
|
if value and key == "optimize":
|
||||||
|
@ -3586,8 +3587,8 @@ def intersect(containerA, containerB, lowerCase=False):
|
||||||
containerB = arrayizeValue(containerB)
|
containerB = arrayizeValue(containerB)
|
||||||
|
|
||||||
if lowerCase:
|
if lowerCase:
|
||||||
containerA = [val.lower() if isinstance(val, basestring) else val for val in containerA]
|
containerA = [val.lower() if hasattr(val, "lower") else val for val in containerA]
|
||||||
containerB = [val.lower() if isinstance(val, basestring) else val for val in containerB]
|
containerB = [val.lower() if hasattr(val, "lower") else val for val in containerB]
|
||||||
|
|
||||||
retVal = [val for val in containerA if val in containerB]
|
retVal = [val for val in containerA if val in containerB]
|
||||||
|
|
||||||
|
@ -3730,7 +3731,7 @@ def safeSQLIdentificatorNaming(name, isTable=False):
|
||||||
|
|
||||||
retVal = name
|
retVal = name
|
||||||
|
|
||||||
if isinstance(name, basestring):
|
if isinstance(name, six.string_types):
|
||||||
retVal = getUnicode(name)
|
retVal = getUnicode(name)
|
||||||
_ = isTable and Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE)
|
_ = isTable and Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE)
|
||||||
|
|
||||||
|
@ -3769,7 +3770,7 @@ def unsafeSQLIdentificatorNaming(name):
|
||||||
|
|
||||||
retVal = name
|
retVal = name
|
||||||
|
|
||||||
if isinstance(name, basestring):
|
if isinstance(name, six.string_types):
|
||||||
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS):
|
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS):
|
||||||
retVal = name.replace("`", "")
|
retVal = name.replace("`", "")
|
||||||
elif Backend.getIdentifiedDbms() in (DBMS.PGSQL, DBMS.DB2, DBMS.SQLITE, DBMS.INFORMIX, DBMS.HSQLDB):
|
elif Backend.getIdentifiedDbms() in (DBMS.PGSQL, DBMS.DB2, DBMS.SQLITE, DBMS.INFORMIX, DBMS.HSQLDB):
|
||||||
|
@ -3800,7 +3801,7 @@ def isNoneValue(value):
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, six.string_types):
|
||||||
return value in ("None", "")
|
return value in ("None", "")
|
||||||
elif isListLike(value):
|
elif isListLike(value):
|
||||||
return all(isNoneValue(_) for _ in value)
|
return all(isNoneValue(_) for _ in value)
|
||||||
|
@ -3819,7 +3820,7 @@ def isNullValue(value):
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return isinstance(value, basestring) and value.upper() == NULL
|
return hasattr(value, "upper") and value.upper() == NULL
|
||||||
|
|
||||||
def expandMnemonics(mnemonics, parser, args):
|
def expandMnemonics(mnemonics, parser, args):
|
||||||
"""
|
"""
|
||||||
|
@ -3921,7 +3922,7 @@ def safeCSValue(value):
|
||||||
|
|
||||||
retVal = value
|
retVal = value
|
||||||
|
|
||||||
if retVal and isinstance(retVal, basestring):
|
if retVal and isinstance(retVal, six.string_types):
|
||||||
if not (retVal[0] == retVal[-1] == '"'):
|
if not (retVal[0] == retVal[-1] == '"'):
|
||||||
if any(_ in retVal for _ in (conf.get("csvDel", defaults.csvDel), '"', '\n')):
|
if any(_ in retVal for _ in (conf.get("csvDel", defaults.csvDel), '"', '\n')):
|
||||||
retVal = '"%s"' % retVal.replace('"', '""')
|
retVal = '"%s"' % retVal.replace('"', '""')
|
||||||
|
@ -4375,7 +4376,7 @@ def decodeHexValue(value, raw=False):
|
||||||
|
|
||||||
def _(value):
|
def _(value):
|
||||||
retVal = value
|
retVal = value
|
||||||
if value and isinstance(value, basestring):
|
if value and isinstance(value, six.string_types):
|
||||||
if len(value) % 2 != 0:
|
if len(value) % 2 != 0:
|
||||||
retVal = "%s?" % hexdecode(value[:-1]) if len(value) > 1 else value
|
retVal = "%s?" % hexdecode(value[:-1]) if len(value) > 1 else value
|
||||||
singleTimeWarnMessage("there was a problem decoding value '%s' from expected hexadecimal form" % value)
|
singleTimeWarnMessage("there was a problem decoding value '%s' from expected hexadecimal form" % value)
|
||||||
|
@ -4423,7 +4424,7 @@ def extractExpectedValue(value, expected):
|
||||||
elif expected == EXPECTED.BOOL:
|
elif expected == EXPECTED.BOOL:
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
value = bool(value)
|
value = bool(value)
|
||||||
elif isinstance(value, basestring):
|
elif isinstance(value, six.string_types):
|
||||||
value = value.strip().lower()
|
value = value.strip().lower()
|
||||||
if value in ("true", "false"):
|
if value in ("true", "false"):
|
||||||
value = value == "true"
|
value = value == "true"
|
||||||
|
@ -4436,7 +4437,7 @@ def extractExpectedValue(value, expected):
|
||||||
else:
|
else:
|
||||||
value = None
|
value = None
|
||||||
elif expected == EXPECTED.INT:
|
elif expected == EXPECTED.INT:
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, six.string_types):
|
||||||
value = int(value) if value.isdigit() else None
|
value = int(value) if value.isdigit() else None
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
@ -4447,7 +4448,7 @@ def hashDBWrite(key, value, serialize=False):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if conf.hashDB:
|
if conf.hashDB:
|
||||||
_ = '|'.join((str(_) if not isinstance(_, basestring) else _) for _ in (conf.hostname, conf.path.strip('/') if conf.path is not None else conf.port, key, HASHDB_MILESTONE_VALUE))
|
_ = '|'.join((str(_) if not isinstance(_, six.string_types) else _) for _ in (conf.hostname, conf.path.strip('/') if conf.path is not None else conf.port, key, HASHDB_MILESTONE_VALUE))
|
||||||
conf.hashDB.write(_, value, serialize)
|
conf.hashDB.write(_, value, serialize)
|
||||||
|
|
||||||
def hashDBRetrieve(key, unserialize=False, checkConf=False):
|
def hashDBRetrieve(key, unserialize=False, checkConf=False):
|
||||||
|
@ -4458,10 +4459,10 @@ def hashDBRetrieve(key, unserialize=False, checkConf=False):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
if conf.hashDB:
|
if conf.hashDB:
|
||||||
_ = '|'.join((str(_) if not isinstance(_, basestring) else _) for _ in (conf.hostname, conf.path.strip('/') if conf.path is not None else conf.port, key, HASHDB_MILESTONE_VALUE))
|
_ = '|'.join((str(_) if not isinstance(_, six.string_types) else _) for _ in (conf.hostname, conf.path.strip('/') if conf.path is not None else conf.port, key, HASHDB_MILESTONE_VALUE))
|
||||||
retVal = conf.hashDB.retrieve(_, unserialize) if kb.resumeValues and not (checkConf and any((conf.flushSession, conf.freshQueries))) else None
|
retVal = conf.hashDB.retrieve(_, unserialize) if kb.resumeValues and not (checkConf and any((conf.flushSession, conf.freshQueries))) else None
|
||||||
|
|
||||||
if not kb.inferenceMode and not kb.fileReadMode and isinstance(retVal, basestring) and any(_ in retVal for _ in (PARTIAL_VALUE_MARKER, PARTIAL_HEX_VALUE_MARKER)):
|
if not kb.inferenceMode and not kb.fileReadMode and isinstance(retVal, six.string_types) and any(_ in retVal for _ in (PARTIAL_VALUE_MARKER, PARTIAL_HEX_VALUE_MARKER)):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
@ -4697,7 +4698,7 @@ def parseRequestFile(reqFile, checkParams=True):
|
||||||
reqResList = re.finditer(BURP_REQUEST_REGEX, content, re.I | re.S)
|
reqResList = re.finditer(BURP_REQUEST_REGEX, content, re.I | re.S)
|
||||||
|
|
||||||
for match in reqResList:
|
for match in reqResList:
|
||||||
request = match if isinstance(match, basestring) else match.group(1)
|
request = match if isinstance(match, six.string_types) else match.group(1)
|
||||||
request = re.sub(r"\A[^\w]+", "", request)
|
request = re.sub(r"\A[^\w]+", "", request)
|
||||||
schemePort = re.search(r"(http[\w]*)\:\/\/.*?\:([\d]+).+?={10,}", request, re.I | re.S)
|
schemePort = re.search(r"(http[\w]*)\:\/\/.*?\:([\d]+).+?={10,}", request, re.I | re.S)
|
||||||
|
|
||||||
|
@ -4789,7 +4790,7 @@ def parseRequestFile(reqFile, checkParams=True):
|
||||||
data = data.rstrip("\r\n") if data else data
|
data = data.rstrip("\r\n") if data else data
|
||||||
|
|
||||||
if getPostReq and (params or cookie or not checkParams):
|
if getPostReq and (params or cookie or not checkParams):
|
||||||
if not port and isinstance(scheme, basestring) and scheme.lower() == "https":
|
if not port and hasattr(scheme, "lower") and scheme.lower() == "https":
|
||||||
port = "443"
|
port = "443"
|
||||||
elif not scheme and port == "443":
|
elif not scheme and port == "443":
|
||||||
scheme = "https"
|
scheme = "https"
|
||||||
|
@ -4836,9 +4837,9 @@ def getSafeExString(ex, encoding=None):
|
||||||
retVal = ex.message
|
retVal = ex.message
|
||||||
elif getattr(ex, "msg", None):
|
elif getattr(ex, "msg", None):
|
||||||
retVal = ex.msg
|
retVal = ex.msg
|
||||||
elif isinstance(ex, (list, tuple)) and len(ex) > 1 and isinstance(ex[1], basestring):
|
elif isinstance(ex, (list, tuple)) and len(ex) > 1 and isinstance(ex[1], six.string_types):
|
||||||
retVal = ex[1]
|
retVal = ex[1]
|
||||||
elif isinstance(ex, (list, tuple)) and len(ex) > 0 and isinstance(ex[0], basestring):
|
elif isinstance(ex, (list, tuple)) and len(ex) > 0 and isinstance(ex[0], six.string_types):
|
||||||
retVal = ex[0]
|
retVal = ex[0]
|
||||||
|
|
||||||
if retVal is None:
|
if retVal is None:
|
||||||
|
|
|
@ -17,6 +17,7 @@ import sys
|
||||||
|
|
||||||
from lib.core.settings import IS_WIN
|
from lib.core.settings import IS_WIN
|
||||||
from lib.core.settings import UNICODE_ENCODING
|
from lib.core.settings import UNICODE_ENCODING
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
def base64decode(value):
|
def base64decode(value):
|
||||||
"""
|
"""
|
||||||
|
@ -145,7 +146,7 @@ def htmlunescape(value):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = value
|
retVal = value
|
||||||
if value and isinstance(value, basestring):
|
if value and isinstance(value, six.string_types):
|
||||||
codes = (("<", '<'), (">", '>'), (""", '"'), (" ", ' '), ("&", '&'), ("'", "'"))
|
codes = (("<", '<'), (">", '>'), (""", '"'), (" ", ' '), ("&", '&'), ("'", "'"))
|
||||||
retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal)
|
retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -133,7 +133,7 @@ class Dump(object):
|
||||||
if "\n" in _:
|
if "\n" in _:
|
||||||
self._write("%s:\n---\n%s\n---" % (header, _))
|
self._write("%s:\n---\n%s\n---" % (header, _))
|
||||||
else:
|
else:
|
||||||
self._write("%s: %s" % (header, ("'%s'" % _) if isinstance(data, basestring) else _))
|
self._write("%s: %s" % (header, ("'%s'" % _) if isinstance(data, six.string_types) else _))
|
||||||
else:
|
else:
|
||||||
self._write("%s:\tNone" % header)
|
self._write("%s:\tNone" % header)
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class Dump(object):
|
||||||
try:
|
try:
|
||||||
elements = set(elements)
|
elements = set(elements)
|
||||||
elements = list(elements)
|
elements = list(elements)
|
||||||
elements.sort(key=lambda _: _.lower() if isinstance(_, basestring) else _)
|
elements.sort(key=lambda _: _.lower() if hasattr(_, "lower") else _)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class Dump(object):
|
||||||
self._write("%s [%d]:" % (header, len(elements)))
|
self._write("%s [%d]:" % (header, len(elements)))
|
||||||
|
|
||||||
for element in elements:
|
for element in elements:
|
||||||
if isinstance(element, basestring):
|
if isinstance(element, six.string_types):
|
||||||
self._write("[*] %s" % element)
|
self._write("[*] %s" % element)
|
||||||
elif isListLike(element):
|
elif isListLike(element):
|
||||||
self._write("[*] " + ", ".join(getUnicode(e) for e in element))
|
self._write("[*] " + ", ".join(getUnicode(e) for e in element))
|
||||||
|
@ -193,7 +193,7 @@ class Dump(object):
|
||||||
userSettings = userSettings[0]
|
userSettings = userSettings[0]
|
||||||
|
|
||||||
users = userSettings.keys()
|
users = userSettings.keys()
|
||||||
users.sort(key=lambda _: _.lower() if isinstance(_, basestring) else _)
|
users.sort(key=lambda _: _.lower() if hasattr(_, "lower") else _)
|
||||||
|
|
||||||
if conf.api:
|
if conf.api:
|
||||||
self._write(userSettings, content_type=content_type)
|
self._write(userSettings, content_type=content_type)
|
||||||
|
@ -287,7 +287,7 @@ class Dump(object):
|
||||||
colType = None
|
colType = None
|
||||||
|
|
||||||
colList = columns.keys()
|
colList = columns.keys()
|
||||||
colList.sort(key=lambda _: _.lower() if isinstance(_, basestring) else _)
|
colList.sort(key=lambda _: _.lower() if hasattr(_, "lower") else _)
|
||||||
|
|
||||||
for column in colList:
|
for column in colList:
|
||||||
colType = columns[column]
|
colType = columns[column]
|
||||||
|
@ -379,7 +379,7 @@ class Dump(object):
|
||||||
if count is None:
|
if count is None:
|
||||||
count = "Unknown"
|
count = "Unknown"
|
||||||
|
|
||||||
tables.sort(key=lambda _: _.lower() if isinstance(_, basestring) else _)
|
tables.sort(key=lambda _: _.lower() if hasattr(_, "lower") else _)
|
||||||
|
|
||||||
for table in tables:
|
for table in tables:
|
||||||
blank1 = " " * (maxlength1 - len(normalizeUnicode(table) or unicode(table)))
|
blank1 = " " * (maxlength1 - len(normalizeUnicode(table) or unicode(table)))
|
||||||
|
|
|
@ -147,6 +147,7 @@ from lib.utils.crawler import crawl
|
||||||
from lib.utils.deps import checkDependencies
|
from lib.utils.deps import checkDependencies
|
||||||
from lib.utils.search import search
|
from lib.utils.search import search
|
||||||
from lib.utils.purge import purge
|
from lib.utils.purge import purge
|
||||||
|
from thirdparty import six
|
||||||
from thirdparty.keepalive import keepalive
|
from thirdparty.keepalive import keepalive
|
||||||
from thirdparty.multipart import multipartpost
|
from thirdparty.multipart import multipartpost
|
||||||
from thirdparty.six.moves import http_client as _http_client
|
from thirdparty.six.moves import http_client as _http_client
|
||||||
|
@ -658,7 +659,7 @@ def _setTechnique():
|
||||||
validTechniques = sorted(getPublicTypeMembers(PAYLOAD.TECHNIQUE), key=lambda x: x[1])
|
validTechniques = sorted(getPublicTypeMembers(PAYLOAD.TECHNIQUE), key=lambda x: x[1])
|
||||||
validLetters = [_[0][0].upper() for _ in validTechniques]
|
validLetters = [_[0][0].upper() for _ in validTechniques]
|
||||||
|
|
||||||
if conf.tech and isinstance(conf.tech, basestring):
|
if conf.tech and isinstance(conf.tech, six.string_types):
|
||||||
_ = []
|
_ = []
|
||||||
|
|
||||||
for letter in conf.tech.upper():
|
for letter in conf.tech.upper():
|
||||||
|
@ -1737,7 +1738,7 @@ def _cleanupOptions():
|
||||||
if conf.csvDel:
|
if conf.csvDel:
|
||||||
conf.csvDel = decodeStringEscape(conf.csvDel)
|
conf.csvDel = decodeStringEscape(conf.csvDel)
|
||||||
|
|
||||||
if conf.torPort and isinstance(conf.torPort, basestring) and conf.torPort.isdigit():
|
if conf.torPort and hasattr(conf.torPort, "isdigit") and conf.torPort.isdigit():
|
||||||
conf.torPort = int(conf.torPort)
|
conf.torPort = int(conf.torPort)
|
||||||
|
|
||||||
if conf.torType:
|
if conf.torType:
|
||||||
|
@ -2576,7 +2577,7 @@ def _basicOptionValidation():
|
||||||
errMsg = "option '--crack' should be used as a standalone"
|
errMsg = "option '--crack' should be used as a standalone"
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
if isinstance(conf.uCols, basestring):
|
if isinstance(conf.uCols, six.string_types):
|
||||||
if not conf.uCols.isdigit() and ("-" not in conf.uCols or len(conf.uCols.split("-")) != 2):
|
if not conf.uCols.isdigit() and ("-" not in conf.uCols or len(conf.uCols.split("-")) != 2):
|
||||||
errMsg = "value for option '--union-cols' must be a range with hyphon "
|
errMsg = "value for option '--union-cols' must be a range with hyphon "
|
||||||
errMsg += "(e.g. 1-10) or integer value (e.g. 5)"
|
errMsg += "(e.g. 1-10) or integer value (e.g. 5)"
|
||||||
|
|
|
@ -17,7 +17,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||||
from lib.core.enums import OS
|
from lib.core.enums import OS
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.3.3.67"
|
VERSION = "1.3.3.68"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -24,8 +24,8 @@ def cleanupVals(text, tag):
|
||||||
if tag in ("clause", "where"):
|
if tag in ("clause", "where"):
|
||||||
text = text.split(',')
|
text = text.split(',')
|
||||||
|
|
||||||
if isinstance(text, basestring):
|
if hasattr(text, "isdigit") and text.isdigit():
|
||||||
text = int(text) if text.isdigit() else text
|
text = int(text)
|
||||||
|
|
||||||
elif isinstance(text, list):
|
elif isinstance(text, list):
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
@ -257,12 +257,12 @@ def decodePage(page, contentEncoding, contentType):
|
||||||
if not page or (conf.nullConnection and len(page) < 2):
|
if not page or (conf.nullConnection and len(page) < 2):
|
||||||
return getUnicode(page)
|
return getUnicode(page)
|
||||||
|
|
||||||
if isinstance(contentEncoding, basestring) and contentEncoding:
|
if hasattr(contentEncoding, "lower"):
|
||||||
contentEncoding = contentEncoding.lower()
|
contentEncoding = contentEncoding.lower()
|
||||||
else:
|
else:
|
||||||
contentEncoding = ""
|
contentEncoding = ""
|
||||||
|
|
||||||
if isinstance(contentType, basestring) and contentType:
|
if hasattr(contentType, "lower"):
|
||||||
contentType = contentType.lower()
|
contentType = contentType.lower()
|
||||||
else:
|
else:
|
||||||
contentType = ""
|
contentType = ""
|
||||||
|
|
|
@ -118,6 +118,7 @@ from lib.request.basic import processResponse
|
||||||
from lib.request.direct import direct
|
from lib.request.direct import direct
|
||||||
from lib.request.comparison import comparison
|
from lib.request.comparison import comparison
|
||||||
from lib.request.methodrequest import MethodRequest
|
from lib.request.methodrequest import MethodRequest
|
||||||
|
from thirdparty import six
|
||||||
from thirdparty.odict import OrderedDict
|
from thirdparty.odict import OrderedDict
|
||||||
from thirdparty.six.moves import http_client as _http_client
|
from thirdparty.six.moves import http_client as _http_client
|
||||||
from thirdparty.six.moves import urllib as _urllib
|
from thirdparty.six.moves import urllib as _urllib
|
||||||
|
@ -432,7 +433,7 @@ class Connect(object):
|
||||||
responseHeaders = _(ws.getheaders())
|
responseHeaders = _(ws.getheaders())
|
||||||
responseHeaders.headers = ["%s: %s\r\n" % (_[0].capitalize(), _[1]) for _ in responseHeaders.items()]
|
responseHeaders.headers = ["%s: %s\r\n" % (_[0].capitalize(), _[1]) for _ in responseHeaders.items()]
|
||||||
|
|
||||||
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if isinstance(key, basestring) else key), getUnicode(value)) for (key, value) in responseHeaders.items()])
|
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if hasattr(key, "capitalize") else key), getUnicode(value)) for (key, value) in responseHeaders.items()])
|
||||||
requestMsg += "\r\n%s" % requestHeaders
|
requestMsg += "\r\n%s" % requestHeaders
|
||||||
|
|
||||||
if post is not None:
|
if post is not None:
|
||||||
|
@ -453,7 +454,7 @@ class Connect(object):
|
||||||
else:
|
else:
|
||||||
return None, None, None
|
return None, None, None
|
||||||
|
|
||||||
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if isinstance(key, basestring) else key), getUnicode(value)) for (key, value) in req.header_items()])
|
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if hasattr(key, "capitalize") else key), getUnicode(value)) for (key, value) in req.header_items()])
|
||||||
|
|
||||||
if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj:
|
if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj:
|
||||||
conf.cj._policy._now = conf.cj._now = int(time.time())
|
conf.cj._policy._now = conf.cj._now = int(time.time())
|
||||||
|
@ -745,7 +746,7 @@ class Connect(object):
|
||||||
raise SqlmapConnectionException(warnMsg)
|
raise SqlmapConnectionException(warnMsg)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if isinstance(page, basestring) and not isinstance(page, unicode):
|
if isinstance(six.binary_type):
|
||||||
if HTTP_HEADER.CONTENT_TYPE in (responseHeaders or {}) and not re.search(TEXT_CONTENT_TYPE_REGEX, responseHeaders[HTTP_HEADER.CONTENT_TYPE]):
|
if HTTP_HEADER.CONTENT_TYPE in (responseHeaders or {}) and not re.search(TEXT_CONTENT_TYPE_REGEX, responseHeaders[HTTP_HEADER.CONTENT_TYPE]):
|
||||||
page = unicode(page, errors="ignore")
|
page = unicode(page, errors="ignore")
|
||||||
else:
|
else:
|
||||||
|
@ -858,7 +859,7 @@ class Connect(object):
|
||||||
errMsg += "function '%s' ('%s')" % (function.func_name, getSafeExString(ex))
|
errMsg += "function '%s' ('%s')" % (function.func_name, getSafeExString(ex))
|
||||||
raise SqlmapGenericException(errMsg)
|
raise SqlmapGenericException(errMsg)
|
||||||
|
|
||||||
if not isinstance(payload, basestring):
|
if not isinstance(payload, six.string_types):
|
||||||
errMsg = "tamper function '%s' returns " % function.func_name
|
errMsg = "tamper function '%s' returns " % function.func_name
|
||||||
errMsg += "invalid payload type ('%s')" % type(payload)
|
errMsg += "invalid payload type ('%s')" % type(payload)
|
||||||
raise SqlmapValueException(errMsg)
|
raise SqlmapValueException(errMsg)
|
||||||
|
@ -1156,7 +1157,7 @@ class Connect(object):
|
||||||
|
|
||||||
for name, value in variables.items():
|
for name, value in variables.items():
|
||||||
if name != "__builtins__" and originals.get(name, "") != value:
|
if name != "__builtins__" and originals.get(name, "") != value:
|
||||||
if isinstance(value, (basestring, int)):
|
if isinstance(value, (int, six.string_types)):
|
||||||
found = False
|
found = False
|
||||||
value = getUnicode(value, UNICODE_ENCODING)
|
value = getUnicode(value, UNICODE_ENCODING)
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ from lib.techniques.dns.test import dnsTest
|
||||||
from lib.techniques.dns.use import dnsUse
|
from lib.techniques.dns.use import dnsUse
|
||||||
from lib.techniques.error.use import errorUse
|
from lib.techniques.error.use import errorUse
|
||||||
from lib.techniques.union.use import unionUse
|
from lib.techniques.union.use import unionUse
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
def _goDns(payload, expression):
|
def _goDns(payload, expression):
|
||||||
value = None
|
value = None
|
||||||
|
@ -334,7 +335,7 @@ def _goUnion(expression, unpack=True, dump=False):
|
||||||
|
|
||||||
output = unionUse(expression, unpack=unpack, dump=dump)
|
output = unionUse(expression, unpack=unpack, dump=dump)
|
||||||
|
|
||||||
if isinstance(output, basestring):
|
if isinstance(output, six.string_types):
|
||||||
output = parseUnionPage(output)
|
output = parseUnionPage(output)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
|
@ -95,7 +95,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
|
||||||
redirectMsg += "[#%d] (%d %s):\r\n" % (threadData.lastRequestUID, code, getUnicode(msg))
|
redirectMsg += "[#%d] (%d %s):\r\n" % (threadData.lastRequestUID, code, getUnicode(msg))
|
||||||
|
|
||||||
if headers:
|
if headers:
|
||||||
logHeaders = "\r\n".join("%s: %s" % (getUnicode(key.capitalize() if isinstance(key, basestring) else key), getUnicode(value)) for (key, value) in headers.items())
|
logHeaders = "\r\n".join("%s: %s" % (getUnicode(key.capitalize() if hasattr(key, "capitalize") else key), getUnicode(value)) for (key, value) in headers.items())
|
||||||
else:
|
else:
|
||||||
logHeaders = ""
|
logHeaders = ""
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ from lib.core.subprocessng import blockingWriteToFD
|
||||||
from lib.core.subprocessng import Popen as execute
|
from lib.core.subprocessng import Popen as execute
|
||||||
from lib.core.subprocessng import send_all
|
from lib.core.subprocessng import send_all
|
||||||
from lib.core.subprocessng import recv_some
|
from lib.core.subprocessng import recv_some
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
if IS_WIN:
|
if IS_WIN:
|
||||||
import msvcrt
|
import msvcrt
|
||||||
|
@ -186,7 +187,7 @@ class Metasploit:
|
||||||
# choose which encoder to use. When called from --os-pwn the encoder
|
# choose which encoder to use. When called from --os-pwn the encoder
|
||||||
# is always x86/alpha_mixed - used for sys_bineval() and
|
# is always x86/alpha_mixed - used for sys_bineval() and
|
||||||
# shellcodeexec
|
# shellcodeexec
|
||||||
if isinstance(encode, basestring):
|
if isinstance(encode, six.string_types):
|
||||||
return encode
|
return encode
|
||||||
|
|
||||||
elif encode:
|
elif encode:
|
||||||
|
|
|
@ -300,7 +300,7 @@ class UDF:
|
||||||
while True:
|
while True:
|
||||||
retType = readInput(msg, default=defaultType)
|
retType = readInput(msg, default=defaultType)
|
||||||
|
|
||||||
if isinstance(retType, basestring) and retType.isdigit():
|
if hasattr(retType, "isdigit") and retType.isdigit():
|
||||||
logger.warn("you need to specify the data-type of the return value")
|
logger.warn("you need to specify the data-type of the return value")
|
||||||
else:
|
else:
|
||||||
self.udfs[udfName]["return"] = retType
|
self.udfs[udfName]["return"] = retType
|
||||||
|
@ -338,7 +338,7 @@ class UDF:
|
||||||
|
|
||||||
if choice == 'Q':
|
if choice == 'Q':
|
||||||
break
|
break
|
||||||
elif isinstance(choice, basestring) and choice.isdigit() and int(choice) > 0 and int(choice) <= len(udfList):
|
elif hasattr(choice, "isdigit") and choice.isdigit() and int(choice) > 0 and int(choice) <= len(udfList):
|
||||||
choice = int(choice)
|
choice = int(choice)
|
||||||
break
|
break
|
||||||
elif isinstance(choice, int) and choice > 0 and choice <= len(udfList):
|
elif isinstance(choice, int) and choice > 0 and choice <= len(udfList):
|
||||||
|
|
|
@ -117,20 +117,20 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
firstChar = len(partialValue)
|
firstChar = len(partialValue)
|
||||||
elif re.search(r"(?i)\b(LENGTH|LEN)\(", expression):
|
elif re.search(r"(?i)\b(LENGTH|LEN)\(", expression):
|
||||||
firstChar = 0
|
firstChar = 0
|
||||||
elif (kb.fileReadMode or dump) and conf.firstChar is not None and (isinstance(conf.firstChar, int) or (isinstance(conf.firstChar, basestring) and conf.firstChar.isdigit())):
|
elif (kb.fileReadMode or dump) and conf.firstChar is not None and (isinstance(conf.firstChar, int) or (hasattr(conf.firstChar, "isdigit") and conf.firstChar.isdigit())):
|
||||||
firstChar = int(conf.firstChar) - 1
|
firstChar = int(conf.firstChar) - 1
|
||||||
if kb.fileReadMode:
|
if kb.fileReadMode:
|
||||||
firstChar <<= 1
|
firstChar <<= 1
|
||||||
elif isinstance(firstChar, basestring) and firstChar.isdigit() or isinstance(firstChar, int):
|
elif hasattr(firstChar, "isdigit") and firstChar.isdigit() or isinstance(firstChar, int):
|
||||||
firstChar = int(firstChar) - 1
|
firstChar = int(firstChar) - 1
|
||||||
else:
|
else:
|
||||||
firstChar = 0
|
firstChar = 0
|
||||||
|
|
||||||
if re.search(r"(?i)\b(LENGTH|LEN)\(", expression):
|
if re.search(r"(?i)\b(LENGTH|LEN)\(", expression):
|
||||||
lastChar = 0
|
lastChar = 0
|
||||||
elif dump and conf.lastChar is not None and (isinstance(conf.lastChar, int) or (isinstance(conf.lastChar, basestring) and conf.lastChar.isdigit())):
|
elif dump and conf.lastChar is not None and (isinstance(conf.lastChar, int) or (hasattr(conf.lastChar, "isdigit") and conf.lastChar.isdigit())):
|
||||||
lastChar = int(conf.lastChar)
|
lastChar = int(conf.lastChar)
|
||||||
elif isinstance(lastChar, basestring) and lastChar.isdigit() or isinstance(lastChar, int):
|
elif hasattr(lastChar, "isdigit") and lastChar.isdigit() or isinstance(lastChar, int):
|
||||||
lastChar = int(lastChar)
|
lastChar = int(lastChar)
|
||||||
else:
|
else:
|
||||||
lastChar = 0
|
lastChar = 0
|
||||||
|
@ -143,7 +143,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
else:
|
else:
|
||||||
expressionUnescaped = unescaper.escape(expression)
|
expressionUnescaped = unescaper.escape(expression)
|
||||||
|
|
||||||
if isinstance(length, basestring) and length.isdigit() or isinstance(length, int):
|
if hasattr(length, "isdigit") and length.isdigit() or isinstance(length, int):
|
||||||
length = int(length)
|
length = int(length)
|
||||||
else:
|
else:
|
||||||
length = None
|
length = None
|
||||||
|
|
|
@ -57,6 +57,7 @@ from lib.core.threads import runThreads
|
||||||
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.utils.progress import ProgressBar
|
from lib.utils.progress import ProgressBar
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||||
offset = 1
|
offset = 1
|
||||||
|
@ -201,7 +202,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||||
|
|
||||||
retVal = decodeHexValue(retVal) if conf.hexConvert else retVal
|
retVal = decodeHexValue(retVal) if conf.hexConvert else retVal
|
||||||
|
|
||||||
if isinstance(retVal, basestring):
|
if isinstance(retVal, six.string_types):
|
||||||
retVal = htmlunescape(retVal).replace("<br>", "\n")
|
retVal = htmlunescape(retVal).replace("<br>", "\n")
|
||||||
|
|
||||||
retVal = _errorReplaceChars(retVal)
|
retVal = _errorReplaceChars(retVal)
|
||||||
|
@ -277,7 +278,7 @@ def _formatPartialContent(value):
|
||||||
Prepares (possibly hex-encoded) partial content for safe console output
|
Prepares (possibly hex-encoded) partial content for safe console output
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if value and isinstance(value, basestring):
|
if value and isinstance(value, six.string_types):
|
||||||
try:
|
try:
|
||||||
value = hexdecode(value)
|
value = hexdecode(value)
|
||||||
except:
|
except:
|
||||||
|
@ -447,7 +448,7 @@ def errorUse(expression, dump=False):
|
||||||
value = _errorFields(expression, expressionFields, expressionFieldsList)
|
value = _errorFields(expression, expressionFields, expressionFieldsList)
|
||||||
|
|
||||||
if value and isListLike(value):
|
if value and isListLike(value):
|
||||||
if len(value) == 1 and isinstance(value[0], basestring):
|
if len(value) == 1 and isinstance(value[0], six.string_types):
|
||||||
value = unArrayizeValue(value)
|
value = unArrayizeValue(value)
|
||||||
elif len(value) > 1 and stopLimit == 1:
|
elif len(value) > 1 and stopLimit == 1:
|
||||||
value = [value]
|
value = [value]
|
||||||
|
|
|
@ -59,6 +59,7 @@ from lib.core.threads import runThreads
|
||||||
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.utils.progress import ProgressBar
|
from lib.utils.progress import ProgressBar
|
||||||
|
from thirdparty import six
|
||||||
from thirdparty.odict import OrderedDict
|
from thirdparty.odict import OrderedDict
|
||||||
|
|
||||||
def _oneShotUnionUse(expression, unpack=True, limited=False):
|
def _oneShotUnionUse(expression, unpack=True, limited=False):
|
||||||
|
@ -163,7 +164,7 @@ def _oneShotUnionUse(expression, unpack=True, limited=False):
|
||||||
|
|
||||||
def configUnion(char=None, columns=None):
|
def configUnion(char=None, columns=None):
|
||||||
def _configUnionChar(char):
|
def _configUnionChar(char):
|
||||||
if not isinstance(char, basestring):
|
if not isinstance(char, six.string_types):
|
||||||
return
|
return
|
||||||
|
|
||||||
kb.uChar = char
|
kb.uChar = char
|
||||||
|
@ -172,7 +173,7 @@ def configUnion(char=None, columns=None):
|
||||||
kb.uChar = char.replace("[CHAR]", conf.uChar if conf.uChar.isdigit() else "'%s'" % conf.uChar.strip("'"))
|
kb.uChar = char.replace("[CHAR]", conf.uChar if conf.uChar.isdigit() else "'%s'" % conf.uChar.strip("'"))
|
||||||
|
|
||||||
def _configUnionCols(columns):
|
def _configUnionCols(columns):
|
||||||
if not isinstance(columns, basestring):
|
if not isinstance(columns, six.string_types):
|
||||||
return
|
return
|
||||||
|
|
||||||
columns = columns.replace(" ", "")
|
columns = columns.replace(" ", "")
|
||||||
|
@ -261,7 +262,7 @@ def unionUse(expression, unpack=True, dump=False):
|
||||||
infoMsg += "%d %s" % (stopLimit, "entries" if stopLimit > 1 else "entry")
|
infoMsg += "%d %s" % (stopLimit, "entries" if stopLimit > 1 else "entry")
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
elif count and (not isinstance(count, basestring) or not count.isdigit()):
|
elif count and (not isinstance(count, six.string_types) or not count.isdigit()):
|
||||||
warnMsg = "it was not possible to count the number "
|
warnMsg = "it was not possible to count the number "
|
||||||
warnMsg += "of entries for the SQL query provided. "
|
warnMsg += "of entries for the SQL query provided. "
|
||||||
warnMsg += "sqlmap will assume that it returns only "
|
warnMsg += "sqlmap will assume that it returns only "
|
||||||
|
@ -373,7 +374,7 @@ def unionUse(expression, unpack=True, dump=False):
|
||||||
del threadData.shared.buffered[0]
|
del threadData.shared.buffered[0]
|
||||||
|
|
||||||
if conf.verbose == 1 and not (threadData.resumed and kb.suppressResumeInfo) and not threadData.shared.showEta:
|
if conf.verbose == 1 and not (threadData.resumed and kb.suppressResumeInfo) and not threadData.shared.showEta:
|
||||||
_ = ','.join("'%s'" % _ for _ in (flattenValue(arrayizeValue(items)) if not isinstance(items, basestring) else [items]))
|
_ = ','.join("'%s'" % _ for _ in (flattenValue(arrayizeValue(items)) if not isinstance(items, six.string_types) else [items]))
|
||||||
status = "[%s] [INFO] %s: %s" % (time.strftime("%X"), "resumed" if threadData.resumed else "retrieved", _ if kb.safeCharEncode else safecharencode(_))
|
status = "[%s] [INFO] %s: %s" % (time.strftime("%X"), "resumed" if threadData.resumed else "retrieved", _ if kb.safeCharEncode else safecharencode(_))
|
||||||
|
|
||||||
if len(status) > width:
|
if len(status) > width:
|
||||||
|
|
|
@ -86,6 +86,7 @@ from lib.core.settings import NULL
|
||||||
from lib.core.settings import UNICODE_ENCODING
|
from lib.core.settings import UNICODE_ENCODING
|
||||||
from lib.core.settings import ROTATING_CHARS
|
from lib.core.settings import ROTATING_CHARS
|
||||||
from lib.core.wordlist import Wordlist
|
from lib.core.wordlist import Wordlist
|
||||||
|
from thirdparty import six
|
||||||
from thirdparty.colorama.initialise import init as coloramainit
|
from thirdparty.colorama.initialise import init as coloramainit
|
||||||
from thirdparty.pydes.pyDes import des
|
from thirdparty.pydes.pyDes import des
|
||||||
from thirdparty.pydes.pyDes import CBC
|
from thirdparty.pydes.pyDes import CBC
|
||||||
|
@ -695,7 +696,7 @@ def hashRecognition(value):
|
||||||
|
|
||||||
isOracle, isMySQL = Backend.isDbms(DBMS.ORACLE), Backend.isDbms(DBMS.MYSQL)
|
isOracle, isMySQL = Backend.isDbms(DBMS.ORACLE), Backend.isDbms(DBMS.MYSQL)
|
||||||
|
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, six.string_types):
|
||||||
for name, regex in getPublicTypeMembers(HASH):
|
for name, regex in getPublicTypeMembers(HASH):
|
||||||
# Hashes for Oracle and old MySQL look the same hence these checks
|
# Hashes for Oracle and old MySQL look the same hence these checks
|
||||||
if isOracle and regex == HASH.MYSQL_OLD or isMySQL and regex == HASH.ORACLE_OLD:
|
if isOracle and regex == HASH.MYSQL_OLD or isMySQL and regex == HASH.ORACLE_OLD:
|
||||||
|
@ -726,7 +727,7 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
if not isinstance(word, basestring):
|
if not isinstance(word, six.string_types):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if suffix:
|
if suffix:
|
||||||
|
@ -801,7 +802,7 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
if not isinstance(word, basestring):
|
if not isinstance(word, six.string_types):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if suffix:
|
if suffix:
|
||||||
|
|
|
@ -46,7 +46,7 @@ def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
|
||||||
query = agent.whereQuery(query)
|
query = agent.whereQuery(query)
|
||||||
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS) if blind else inject.getValue(query, blind=False, time=False, expected=EXPECTED.INT)
|
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS) if blind else inject.getValue(query, blind=False, time=False, expected=EXPECTED.INT)
|
||||||
|
|
||||||
if isinstance(count, basestring) and count.isdigit():
|
if hasattr(count, "isdigit") and count.isdigit():
|
||||||
count = int(count)
|
count = int(count)
|
||||||
|
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
|
|
@ -21,6 +21,7 @@ from lib.core.settings import CURRENT_DB
|
||||||
from lib.utils.brute import columnExists
|
from lib.utils.brute import columnExists
|
||||||
from lib.utils.pivotdumptable import pivotDumpTable
|
from lib.utils.pivotdumptable import pivotDumpTable
|
||||||
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
class Enumeration(GenericEnumeration):
|
class Enumeration(GenericEnumeration):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -71,7 +72,7 @@ class Enumeration(GenericEnumeration):
|
||||||
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
|
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
|
||||||
|
|
||||||
infoMsg = "fetching tables for database"
|
infoMsg = "fetching tables for database"
|
||||||
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))
|
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, six.string_types) else db[0] for db in sorted(dbs)))
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
rootQuery = queries[DBMS.MAXDB].tables
|
rootQuery = queries[DBMS.MAXDB].tables
|
||||||
|
|
|
@ -28,8 +28,8 @@ from lib.core.enums import PAYLOAD
|
||||||
from lib.core.exception import SqlmapNoneDataException
|
from lib.core.exception import SqlmapNoneDataException
|
||||||
from lib.core.settings import CURRENT_DB
|
from lib.core.settings import CURRENT_DB
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
|
|
||||||
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
class Enumeration(GenericEnumeration):
|
class Enumeration(GenericEnumeration):
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args):
|
||||||
|
@ -83,7 +83,7 @@ class Enumeration(GenericEnumeration):
|
||||||
dbs = [_ for _ in dbs if _]
|
dbs = [_ for _ in dbs if _]
|
||||||
|
|
||||||
infoMsg = "fetching tables for database"
|
infoMsg = "fetching tables for database"
|
||||||
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))
|
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, six.string_types) else db[0] for db in sorted(dbs)))
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
rootQuery = queries[DBMS.MSSQL].tables
|
rootQuery = queries[DBMS.MSSQL].tables
|
||||||
|
@ -219,7 +219,7 @@ class Enumeration(GenericEnumeration):
|
||||||
values = inject.getValue(query, blind=False, time=False)
|
values = inject.getValue(query, blind=False, time=False)
|
||||||
|
|
||||||
if not isNoneValue(values):
|
if not isNoneValue(values):
|
||||||
if isinstance(values, basestring):
|
if isinstance(values, six.string_types):
|
||||||
values = [values]
|
values = [values]
|
||||||
|
|
||||||
for foundTbl in values:
|
for foundTbl in values:
|
||||||
|
@ -353,7 +353,7 @@ class Enumeration(GenericEnumeration):
|
||||||
values = inject.getValue(query, blind=False, time=False)
|
values = inject.getValue(query, blind=False, time=False)
|
||||||
|
|
||||||
if not isNoneValue(values):
|
if not isNoneValue(values):
|
||||||
if isinstance(values, basestring):
|
if isinstance(values, six.string_types):
|
||||||
values = [values]
|
values = [values]
|
||||||
|
|
||||||
for foundTbl in values:
|
for foundTbl in values:
|
||||||
|
|
|
@ -26,6 +26,7 @@ from lib.core.settings import CURRENT_DB
|
||||||
from lib.utils.brute import columnExists
|
from lib.utils.brute import columnExists
|
||||||
from lib.utils.pivotdumptable import pivotDumpTable
|
from lib.utils.pivotdumptable import pivotDumpTable
|
||||||
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
class Enumeration(GenericEnumeration):
|
class Enumeration(GenericEnumeration):
|
||||||
def getUsers(self):
|
def getUsers(self):
|
||||||
|
@ -128,7 +129,7 @@ class Enumeration(GenericEnumeration):
|
||||||
dbs = [_ for _ in dbs if _]
|
dbs = [_ for _ in dbs if _]
|
||||||
|
|
||||||
infoMsg = "fetching tables for database"
|
infoMsg = "fetching tables for database"
|
||||||
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))
|
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, six.string_types) else db[0] for db in sorted(dbs)))
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
|
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
|
||||||
|
@ -279,7 +280,7 @@ class Enumeration(GenericEnumeration):
|
||||||
columns = {}
|
columns = {}
|
||||||
|
|
||||||
for name, type_ in filterPairValues(zip(retVal[0]["%s.name" % kb.aliasName], retVal[0]["%s.usertype" % kb.aliasName])):
|
for name, type_ in filterPairValues(zip(retVal[0]["%s.name" % kb.aliasName], retVal[0]["%s.usertype" % kb.aliasName])):
|
||||||
columns[name] = SYBASE_TYPES.get(int(type_) if isinstance(type_, basestring) and type_.isdigit() else type_, type_)
|
columns[name] = SYBASE_TYPES.get(int(type_) if hasattr(type_, "isdigit") and type_.isdigit() else type_, type_)
|
||||||
|
|
||||||
table[safeSQLIdentificatorNaming(tbl, True)] = columns
|
table[safeSQLIdentificatorNaming(tbl, True)] = columns
|
||||||
kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)] = table
|
kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)] = table
|
||||||
|
|
|
@ -605,7 +605,7 @@ class Databases:
|
||||||
|
|
||||||
if values is None:
|
if values is None:
|
||||||
values = inject.getValue(query, blind=False, time=False)
|
values = inject.getValue(query, blind=False, time=False)
|
||||||
if values and isinstance(values[0], basestring):
|
if values and isinstance(values[0], six.string_types):
|
||||||
values = [values]
|
values = [values]
|
||||||
|
|
||||||
if Backend.isDbms(DBMS.MSSQL) and isNoneValue(values):
|
if Backend.isDbms(DBMS.MSSQL) and isNoneValue(values):
|
||||||
|
@ -658,7 +658,7 @@ class Databases:
|
||||||
if len(columnData) == 1:
|
if len(columnData) == 1:
|
||||||
columns[name] = None
|
columns[name] = None
|
||||||
else:
|
else:
|
||||||
key = int(columnData[1]) if isinstance(columnData[1], basestring) and columnData[1].isdigit() else columnData[1]
|
key = int(columnData[1]) if isinstance(columnData[1], six.string_types) and columnData[1].isdigit() else columnData[1]
|
||||||
if Backend.isDbms(DBMS.FIREBIRD):
|
if Backend.isDbms(DBMS.FIREBIRD):
|
||||||
columnData[1] = FIREBIRD_TYPES.get(key, columnData[1])
|
columnData[1] = FIREBIRD_TYPES.get(key, columnData[1])
|
||||||
elif Backend.isDbms(DBMS.INFORMIX):
|
elif Backend.isDbms(DBMS.INFORMIX):
|
||||||
|
@ -829,7 +829,7 @@ class Databases:
|
||||||
|
|
||||||
colType = unArrayizeValue(inject.getValue(query, union=False, error=False))
|
colType = unArrayizeValue(inject.getValue(query, union=False, error=False))
|
||||||
|
|
||||||
key = int(colType) if isinstance(colType, basestring) and colType.isdigit() else colType
|
key = int(colType) if hasattr(colType, "isdigit") and colType.isdigit() else colType
|
||||||
if Backend.isDbms(DBMS.FIREBIRD):
|
if Backend.isDbms(DBMS.FIREBIRD):
|
||||||
colType = FIREBIRD_TYPES.get(key, colType)
|
colType = FIREBIRD_TYPES.get(key, colType)
|
||||||
elif Backend.isDbms(DBMS.INFORMIX):
|
elif Backend.isDbms(DBMS.INFORMIX):
|
||||||
|
|
|
@ -45,6 +45,7 @@ from lib.core.settings import NULL
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
from lib.utils.hash import attackDumpedTable
|
from lib.utils.hash import attackDumpedTable
|
||||||
from lib.utils.pivotdumptable import pivotDumpTable
|
from lib.utils.pivotdumptable import pivotDumpTable
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
class Entries:
|
class Entries:
|
||||||
"""
|
"""
|
||||||
|
@ -244,7 +245,7 @@ class Entries:
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
if not isNoneValue(entries):
|
if not isNoneValue(entries):
|
||||||
if isinstance(entries, basestring):
|
if isinstance(entries, six.string_types):
|
||||||
entries = [entries]
|
entries = [entries]
|
||||||
elif not isListLike(entries):
|
elif not isListLike(entries):
|
||||||
entries = []
|
entries = []
|
||||||
|
@ -259,7 +260,7 @@ class Entries:
|
||||||
if entry is None or len(entry) == 0:
|
if entry is None or len(entry) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if isinstance(entry, basestring):
|
if isinstance(entry, six.string_types):
|
||||||
colEntry = entry
|
colEntry = entry
|
||||||
else:
|
else:
|
||||||
colEntry = unArrayizeValue(entry[index]) if index < len(entry) else u''
|
colEntry = unArrayizeValue(entry[index]) if index < len(entry) else u''
|
||||||
|
|
|
@ -35,6 +35,7 @@ from lib.core.settings import METADB_SUFFIX
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
from lib.utils.brute import columnExists
|
from lib.utils.brute import columnExists
|
||||||
from lib.utils.brute import tableExists
|
from lib.utils.brute import tableExists
|
||||||
|
from thirdparty import six
|
||||||
|
|
||||||
class Search:
|
class Search:
|
||||||
"""
|
"""
|
||||||
|
@ -204,7 +205,7 @@ class Search:
|
||||||
if values and Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.FIREBIRD):
|
if values and Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.FIREBIRD):
|
||||||
newValues = []
|
newValues = []
|
||||||
|
|
||||||
if isinstance(values, basestring):
|
if isinstance(values, six.string_types):
|
||||||
values = [values]
|
values = [values]
|
||||||
for value in values:
|
for value in values:
|
||||||
dbName = "SQLite" if Backend.isDbms(DBMS.SQLITE) else "Firebird"
|
dbName = "SQLite" if Backend.isDbms(DBMS.SQLITE) else "Firebird"
|
||||||
|
|
4
thirdparty/clientform/clientform.py
vendored
4
thirdparty/clientform/clientform.py
vendored
|
@ -95,11 +95,11 @@ else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from thirdparty.six.moves import cStringIO as _cStringIO
|
from thirdparty.six.moves import cStringIO as _cStringIO
|
||||||
from thirdparty.six.moves import http_client as _html_entities
|
from thirdparty.six.moves import html_entities as _html_entities
|
||||||
from thirdparty.six.moves import urllib as _urllib
|
from thirdparty.six.moves import urllib as _urllib
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from six.moves import cStringIO as _cStringIO
|
from six.moves import cStringIO as _cStringIO
|
||||||
from six.moves import urllib as _html_entities
|
from six.moves import html_entities as _html_entities
|
||||||
from six.moves import urllib as _urllib
|
from six.moves import urllib as _urllib
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user