Skip to content

Commit 8f13bda

Browse files
committed
Some more preparing for 2to3 (keys() is iter in 3)
1 parent 1adc66b commit 8f13bda

File tree

14 files changed

+37
-37
lines changed

14 files changed

+37
-37
lines changed

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def genCmpPayload():
615615
page, headers, _ = Request.queryPage(reqPayload, place, content=True, raise404=False)
616616
output = extractRegexResult(check, page, re.DOTALL | re.IGNORECASE)
617617
output = output or extractRegexResult(check, threadData.lastHTTPError[2] if wasLastResponseHTTPError() else None, re.DOTALL | re.IGNORECASE)
618-
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)
618+
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)
619619
output = output or extractRegexResult(check, threadData.lastRedirectMsg[1] if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == threadData.lastRequestUID else None, re.DOTALL | re.IGNORECASE)
620620

621621
if output:

lib/controller/controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _selectInjection():
9090
if point not in points:
9191
points[point] = injection
9292
else:
93-
for key in points[point].keys():
93+
for key in points[point]:
9494
if key != 'data':
9595
points[point][key] = points[point][key] or injection[key]
9696
points[point]['data'].update(injection['data'])
@@ -244,7 +244,7 @@ def _saveToResultsFile():
244244
if key not in results:
245245
results[key] = []
246246

247-
results[key].extend(injection.data.keys())
247+
results[key].extend(list(injection.data.keys()))
248248

249249
try:
250250
for key, value in results.items():
@@ -427,7 +427,7 @@ def start():
427427
checkStability()
428428

429429
# Do a little prioritization reorder of a testable parameter list
430-
parameters = conf.parameters.keys()
430+
parameters = list(conf.parameters.keys())
431431

432432
# Order of testing list (first to last)
433433
orderList = (PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER, PLACE.URI, PLACE.POST, PLACE.GET)

lib/core/common.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ def walk(head, current=None):
688688
debugMsg += "is not inside the %s" % place
689689
logger.debug(debugMsg)
690690

691-
elif len(conf.testParameter) != len(testableParameters.keys()):
691+
elif len(conf.testParameter) != len(testableParameters):
692692
for parameter in conf.testParameter:
693693
if parameter not in testableParameters:
694694
debugMsg = "provided parameter '%s' " % parameter
@@ -1560,7 +1560,7 @@ def expandAsteriskForColumns(expression):
15601560
columnsDict = conf.dbmsHandler.getColumns(onlyColNames=True)
15611561

15621562
if columnsDict and conf.db in columnsDict and conf.tbl in columnsDict[conf.db]:
1563-
columns = columnsDict[conf.db][conf.tbl].keys()
1563+
columns = list(columnsDict[conf.db][conf.tbl].keys())
15641564
columns.sort()
15651565
columnsStr = ", ".join(column for column in columns)
15661566
expression = expression.replace('*', columnsStr, 1)
@@ -2064,7 +2064,7 @@ def getSQLSnippet(dbms, sfile, **variables):
20642064
retVal = re.sub(r"#.+", "", retVal)
20652065
retVal = re.sub(r";\s+", "; ", retVal).strip("\r\n")
20662066

2067-
for _ in variables.keys():
2067+
for _ in variables:
20682068
retVal = re.sub(r"%%%s%%" % _, variables[_].replace('\\', r'\\'), retVal)
20692069

20702070
for _ in re.findall(r"%RANDSTR\d+%", retVal, re.I):
@@ -2223,7 +2223,7 @@ def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, un
22232223
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
22242224
raise SqlmapSystemException(errMsg)
22252225

2226-
return retVal if not unique else retVal.keys()
2226+
return retVal if not unique else list(retVal.keys())
22272227

22282228
def goGoodSamaritan(prevValue, originalCharset):
22292229
"""
@@ -3056,7 +3056,7 @@ def saveConfig(conf, filename):
30563056
config = UnicodeRawConfigParser()
30573057
userOpts = {}
30583058

3059-
for family in optDict.keys():
3059+
for family in optDict:
30603060
userOpts[family] = []
30613061

30623062
for option, value in conf.items():
@@ -3795,7 +3795,7 @@ def __init__(self):
37953795
logger.debug(debugMsg)
37963796
else:
37973797
found = sorted(options.keys(), key=lambda x: len(x))[0]
3798-
warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to any of: %s). " % (name, ", ".join("'%s'" % key for key in options.keys()))
3798+
warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to any of: %s). " % (name, ", ".join("'%s'" % key for key in options))
37993799
warnMsg += "Resolved to shortest of those ('%s')" % found
38003800
logger.warn(warnMsg)
38013801

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ class _(unicode):
16401640
map(lambda _: conf.__setitem__(_, True), WIZARD.ALL)
16411641

16421642
if conf.noCast:
1643-
for _ in DUMP_REPLACEMENTS.keys():
1643+
for _ in list(DUMP_REPLACEMENTS.keys()):
16441644
del DUMP_REPLACEMENTS[_]
16451645

16461646
if conf.dumpFormat:

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.3.1.65"
22+
VERSION = "1.3.1.66"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/parse/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _feedInfo(self, key, value):
3535
if key == "dbmsVersion":
3636
self._info[key] = value
3737
else:
38-
if key not in self._info.keys():
38+
if key not in self._info:
3939
self._info[key] = set()
4040

4141
for _ in value.split("|"):

lib/request/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def forgeHeaders(items=None, base=None):
5757

5858
items = items or {}
5959

60-
for _ in items.keys():
60+
for _ in list(items.keys()):
6161
if items[_] is None:
6262
del items[_]
6363

lib/request/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
817817

818818
if conf.httpHeaders:
819819
headers = OrderedDict(conf.httpHeaders)
820-
contentType = max(headers[_] if _.upper() == HTTP_HEADER.CONTENT_TYPE.upper() else None for _ in headers.keys())
820+
contentType = max(headers[_] if _.upper() == HTTP_HEADER.CONTENT_TYPE.upper() else None for _ in headers)
821821

822822
if (kb.postHint or conf.skipUrlEncode) and postUrlEncode:
823823
postUrlEncode = False
@@ -1125,7 +1125,7 @@ def _randomizeParameter(paramString, randomParameter):
11251125
originals.update(variables)
11261126
evaluateCode(conf.evalCode, variables)
11271127

1128-
for variable in variables.keys():
1128+
for variable in list(variables.keys()):
11291129
if variable.endswith(EVALCODE_KEYWORD_SUFFIX):
11301130
value = variables[variable]
11311131
del variables[variable]

lib/utils/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
699699
except ImportError:
700700
if adapter.lower() not in server_names:
701701
errMsg = "Adapter '%s' is unknown. " % adapter
702-
errMsg += "List of supported adapters: %s" % ', '.join(sorted(server_names.keys()))
702+
errMsg += "List of supported adapters: %s" % ', '.join(sorted(list(server_names.keys())))
703703
else:
704704
errMsg = "Server support for adapter '%s' is not installed on this system " % adapter
705705
errMsg += "(Note: you can try to install it with 'sudo apt-get install python-%s' or 'sudo pip install %s')" % (adapter, adapter)

lib/utils/hash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def attackCachedUsersPasswords():
601601
for (_, hash_, password) in results:
602602
lut[hash_.lower()] = password
603603

604-
for user in kb.data.cachedUsersPasswords.keys():
604+
for user in kb.data.cachedUsersPasswords:
605605
for i in xrange(len(kb.data.cachedUsersPasswords[user])):
606606
if (kb.data.cachedUsersPasswords[user][i] or "").strip():
607607
value = kb.data.cachedUsersPasswords[user][i].lower().split()[0]
@@ -611,7 +611,7 @@ def attackCachedUsersPasswords():
611611
def attackDumpedTable():
612612
if kb.data.dumpedTable:
613613
table = kb.data.dumpedTable
614-
columns = table.keys()
614+
columns = list(table.keys())
615615
count = table["__infos__"]["count"]
616616

617617
if not count:

0 commit comments

Comments
 (0)