mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-30 03:19:04 +00:00
Some more preparing for 2to3 (keys() is iter in 3)
This commit is contained in:
@@ -615,7 +615,7 @@ def checkSqlInjection(place, parameter, value):
|
||||
page, headers, _ = Request.queryPage(reqPayload, place, content=True, raise404=False)
|
||||
output = extractRegexResult(check, page, re.DOTALL | re.IGNORECASE)
|
||||
output = output or extractRegexResult(check, threadData.lastHTTPError[2] if wasLastResponseHTTPError() else None, re.DOTALL | re.IGNORECASE)
|
||||
output = output or extractRegexResult(check, listToStrValue((headers[key] for key in headers.keys() if key.lower() != URI_HTTP_HEADER.lower()) if headers else None), re.DOTALL | re.IGNORECASE)
|
||||
output = output or extractRegexResult(check, listToStrValue((headers[key] for key in headers if key.lower() != URI_HTTP_HEADER.lower()) if headers else None), re.DOTALL | re.IGNORECASE)
|
||||
output = output or extractRegexResult(check, threadData.lastRedirectMsg[1] if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == threadData.lastRequestUID else None, re.DOTALL | re.IGNORECASE)
|
||||
|
||||
if output:
|
||||
|
||||
@@ -90,7 +90,7 @@ def _selectInjection():
|
||||
if point not in points:
|
||||
points[point] = injection
|
||||
else:
|
||||
for key in points[point].keys():
|
||||
for key in points[point]:
|
||||
if key != 'data':
|
||||
points[point][key] = points[point][key] or injection[key]
|
||||
points[point]['data'].update(injection['data'])
|
||||
@@ -244,7 +244,7 @@ def _saveToResultsFile():
|
||||
if key not in results:
|
||||
results[key] = []
|
||||
|
||||
results[key].extend(injection.data.keys())
|
||||
results[key].extend(list(injection.data.keys()))
|
||||
|
||||
try:
|
||||
for key, value in results.items():
|
||||
@@ -427,7 +427,7 @@ def start():
|
||||
checkStability()
|
||||
|
||||
# Do a little prioritization reorder of a testable parameter list
|
||||
parameters = conf.parameters.keys()
|
||||
parameters = list(conf.parameters.keys())
|
||||
|
||||
# Order of testing list (first to last)
|
||||
orderList = (PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER, PLACE.URI, PLACE.POST, PLACE.GET)
|
||||
|
||||
@@ -688,7 +688,7 @@ def paramToDict(place, parameters=None):
|
||||
debugMsg += "is not inside the %s" % place
|
||||
logger.debug(debugMsg)
|
||||
|
||||
elif len(conf.testParameter) != len(testableParameters.keys()):
|
||||
elif len(conf.testParameter) != len(testableParameters):
|
||||
for parameter in conf.testParameter:
|
||||
if parameter not in testableParameters:
|
||||
debugMsg = "provided parameter '%s' " % parameter
|
||||
@@ -1560,7 +1560,7 @@ def expandAsteriskForColumns(expression):
|
||||
columnsDict = conf.dbmsHandler.getColumns(onlyColNames=True)
|
||||
|
||||
if columnsDict and conf.db in columnsDict and conf.tbl in columnsDict[conf.db]:
|
||||
columns = columnsDict[conf.db][conf.tbl].keys()
|
||||
columns = list(columnsDict[conf.db][conf.tbl].keys())
|
||||
columns.sort()
|
||||
columnsStr = ", ".join(column for column in columns)
|
||||
expression = expression.replace('*', columnsStr, 1)
|
||||
@@ -2064,7 +2064,7 @@ def getSQLSnippet(dbms, sfile, **variables):
|
||||
retVal = re.sub(r"#.+", "", retVal)
|
||||
retVal = re.sub(r";\s+", "; ", retVal).strip("\r\n")
|
||||
|
||||
for _ in variables.keys():
|
||||
for _ in variables:
|
||||
retVal = re.sub(r"%%%s%%" % _, variables[_].replace('\\', r'\\'), retVal)
|
||||
|
||||
for _ in re.findall(r"%RANDSTR\d+%", retVal, re.I):
|
||||
@@ -2223,7 +2223,7 @@ def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, un
|
||||
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
return retVal if not unique else retVal.keys()
|
||||
return retVal if not unique else list(retVal.keys())
|
||||
|
||||
def goGoodSamaritan(prevValue, originalCharset):
|
||||
"""
|
||||
@@ -3056,7 +3056,7 @@ def saveConfig(conf, filename):
|
||||
config = UnicodeRawConfigParser()
|
||||
userOpts = {}
|
||||
|
||||
for family in optDict.keys():
|
||||
for family in optDict:
|
||||
userOpts[family] = []
|
||||
|
||||
for option, value in conf.items():
|
||||
@@ -3795,7 +3795,7 @@ def expandMnemonics(mnemonics, parser, args):
|
||||
logger.debug(debugMsg)
|
||||
else:
|
||||
found = sorted(options.keys(), key=lambda x: len(x))[0]
|
||||
warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to any of: %s). " % (name, ", ".join("'%s'" % key for key in options.keys()))
|
||||
warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to any of: %s). " % (name, ", ".join("'%s'" % key for key in options))
|
||||
warnMsg += "Resolved to shortest of those ('%s')" % found
|
||||
logger.warn(warnMsg)
|
||||
|
||||
|
||||
@@ -1640,7 +1640,7 @@ def _cleanupOptions():
|
||||
map(lambda _: conf.__setitem__(_, True), WIZARD.ALL)
|
||||
|
||||
if conf.noCast:
|
||||
for _ in DUMP_REPLACEMENTS.keys():
|
||||
for _ in list(DUMP_REPLACEMENTS.keys()):
|
||||
del DUMP_REPLACEMENTS[_]
|
||||
|
||||
if conf.dumpFormat:
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.1.65"
|
||||
VERSION = "1.3.1.66"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
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)
|
||||
|
||||
@@ -35,7 +35,7 @@ class FingerprintHandler(ContentHandler):
|
||||
if key == "dbmsVersion":
|
||||
self._info[key] = value
|
||||
else:
|
||||
if key not in self._info.keys():
|
||||
if key not in self._info:
|
||||
self._info[key] = set()
|
||||
|
||||
for _ in value.split("|"):
|
||||
|
||||
@@ -57,7 +57,7 @@ def forgeHeaders(items=None, base=None):
|
||||
|
||||
items = items or {}
|
||||
|
||||
for _ in items.keys():
|
||||
for _ in list(items.keys()):
|
||||
if items[_] is None:
|
||||
del items[_]
|
||||
|
||||
|
||||
@@ -817,7 +817,7 @@ class Connect(object):
|
||||
|
||||
if conf.httpHeaders:
|
||||
headers = OrderedDict(conf.httpHeaders)
|
||||
contentType = max(headers[_] if _.upper() == HTTP_HEADER.CONTENT_TYPE.upper() else None for _ in headers.keys())
|
||||
contentType = max(headers[_] if _.upper() == HTTP_HEADER.CONTENT_TYPE.upper() else None for _ in headers)
|
||||
|
||||
if (kb.postHint or conf.skipUrlEncode) and postUrlEncode:
|
||||
postUrlEncode = False
|
||||
@@ -1125,7 +1125,7 @@ class Connect(object):
|
||||
originals.update(variables)
|
||||
evaluateCode(conf.evalCode, variables)
|
||||
|
||||
for variable in variables.keys():
|
||||
for variable in list(variables.keys()):
|
||||
if variable.endswith(EVALCODE_KEYWORD_SUFFIX):
|
||||
value = variables[variable]
|
||||
del variables[variable]
|
||||
|
||||
@@ -699,7 +699,7 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
|
||||
except ImportError:
|
||||
if adapter.lower() not in server_names:
|
||||
errMsg = "Adapter '%s' is unknown. " % adapter
|
||||
errMsg += "List of supported adapters: %s" % ', '.join(sorted(server_names.keys()))
|
||||
errMsg += "List of supported adapters: %s" % ', '.join(sorted(list(server_names.keys())))
|
||||
else:
|
||||
errMsg = "Server support for adapter '%s' is not installed on this system " % adapter
|
||||
errMsg += "(Note: you can try to install it with 'sudo apt-get install python-%s' or 'sudo pip install %s')" % (adapter, adapter)
|
||||
|
||||
@@ -601,7 +601,7 @@ def attackCachedUsersPasswords():
|
||||
for (_, hash_, password) in results:
|
||||
lut[hash_.lower()] = password
|
||||
|
||||
for user in kb.data.cachedUsersPasswords.keys():
|
||||
for user in kb.data.cachedUsersPasswords:
|
||||
for i in xrange(len(kb.data.cachedUsersPasswords[user])):
|
||||
if (kb.data.cachedUsersPasswords[user][i] or "").strip():
|
||||
value = kb.data.cachedUsersPasswords[user][i].lower().split()[0]
|
||||
@@ -611,7 +611,7 @@ def attackCachedUsersPasswords():
|
||||
def attackDumpedTable():
|
||||
if kb.data.dumpedTable:
|
||||
table = kb.data.dumpedTable
|
||||
columns = table.keys()
|
||||
columns = list(table.keys())
|
||||
count = table["__infos__"]["count"]
|
||||
|
||||
if not count:
|
||||
|
||||
Reference in New Issue
Block a user