diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 672de3e14..a8343a214 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -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: diff --git a/lib/controller/controller.py b/lib/controller/controller.py index 6719130bd..af7a17a8f 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -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) diff --git a/lib/core/common.py b/lib/core/common.py index 321a34a52..e435f847c 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -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) diff --git a/lib/core/option.py b/lib/core/option.py index 92c0808d9..80865360e 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -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: diff --git a/lib/core/settings.py b/lib/core/settings.py index abd9c2202..315c95a77 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -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) diff --git a/lib/parse/handler.py b/lib/parse/handler.py index b69df9e81..ed03812bb 100644 --- a/lib/parse/handler.py +++ b/lib/parse/handler.py @@ -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("|"): diff --git a/lib/request/basic.py b/lib/request/basic.py index acdd29f10..40fdd57d0 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -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[_] diff --git a/lib/request/connect.py b/lib/request/connect.py index c8538b4c4..8ea22e11a 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -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] diff --git a/lib/utils/api.py b/lib/utils/api.py index fd8ce85df..ae971efe7 100644 --- a/lib/utils/api.py +++ b/lib/utils/api.py @@ -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) diff --git a/lib/utils/hash.py b/lib/utils/hash.py index 9871fd9b0..2117e85b3 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -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: diff --git a/plugins/generic/databases.py b/plugins/generic/databases.py index e126e65fc..b283642c9 100644 --- a/plugins/generic/databases.py +++ b/plugins/generic/databases.py @@ -415,7 +415,7 @@ class Databases: kb.data.cachedTables[db] = sorted(tables) if tables else tables if kb.data.cachedTables: - for db in kb.data.cachedTables.keys(): + for db in kb.data.cachedTables: kb.data.cachedTables[db] = list(set(kb.data.cachedTables[db])) return kb.data.cachedTables diff --git a/plugins/generic/entries.py b/plugins/generic/entries.py index 5c51c06a1..3e1052a3a 100644 --- a/plugins/generic/entries.py +++ b/plugins/generic/entries.py @@ -517,7 +517,7 @@ class Entries: choice = readInput(message, default='a') if not choice or choice in ('a', 'A'): - dumpFromDbs = dbs.keys() + dumpFromDbs = list(dbs.keys()) elif choice in ('q', 'Q'): return else: @@ -584,7 +584,7 @@ class Entries: choice = readInput(message, default='a') if not choice or choice.lower() == 'a': - dumpFromDbs = tables.keys() + dumpFromDbs = list(tables.keys()) elif choice.lower() == 'q': return else: diff --git a/plugins/generic/search.py b/plugins/generic/search.py index b9a5aaddc..b21957bb0 100644 --- a/plugins/generic/search.py +++ b/plugins/generic/search.py @@ -273,7 +273,7 @@ class Search: dbName = "SQLite" if Backend.isDbms(DBMS.SQLITE) else "Firebird" foundTbls["%s%s" % (dbName, METADB_SUFFIX)] = [] - for db in foundTbls.keys(): + for db in foundTbls: db = safeSQLIdentificatorNaming(db) infoMsg = "fetching number of table" @@ -326,7 +326,7 @@ class Search: foundTbl = safeSQLIdentificatorNaming(foundTbl, True) foundTbls[db].append(foundTbl) - for db in foundTbls.keys(): + for db in list(foundTbls.keys()): if isNoneValue(foundTbls[db]): del foundTbls[db] diff --git a/txt/checksum.md5 b/txt/checksum.md5 index ce53052b8..f3ffd7686 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -23,13 +23,13 @@ fb6be55d21a70765e35549af2484f762 extra/sqlharvest/__init__.py fb6be55d21a70765e35549af2484f762 extra/wafdetectify/__init__.py aec73042403993076f478da48066a79e extra/wafdetectify/wafdetectify.py ec782b9cdb8d857a80b6ecf0f32db7f4 lib/controller/action.py -d099724a49c5fd6b0dca8c777e82604e lib/controller/checks.py -c4d559a98cfc62b401ef7e0bfab782f0 lib/controller/controller.py +11132dd6114b3f76922bb36cff16eceb lib/controller/checks.py +b37a93767459162b30798bd9732a12a3 lib/controller/controller.py c1da277517c7ec4c23e953a51b51e203 lib/controller/handler.py fb6be55d21a70765e35549af2484f762 lib/controller/__init__.py ed7874be0d2d3802f3d20184f2b280d5 lib/core/agent.py a932126e7d80e545c5d44af178d0bc0c lib/core/bigarray.py -39860dfb1d1afa51b7ed9d4ddfdb82cd lib/core/common.py +2cb5d057cbb1f333dfd42b8c7262d404 lib/core/common.py de8d27ae6241163ff9e97aa9e7c51a18 lib/core/convert.py abcb1121eb56d3401839d14e8ed06b6e lib/core/data.py db60c6ebb63b72ed119e304b359fc1a6 lib/core/datatype.py @@ -42,14 +42,14 @@ fd5403505f76eee6829c06b9342e269c lib/core/dump.py fb6be55d21a70765e35549af2484f762 lib/core/__init__.py 18c896b157b03af716542e5fe9233ef9 lib/core/log.py fa9f24e88c81a6cef52da3dd5e637010 lib/core/optiondict.py -bf83a5194e5490273a64a35ae5eacf69 lib/core/option.py +bdb5a0e1f40d9c4d43593e25c8c58ec6 lib/core/option.py fe370021c6bc99daf44b2bfc0d1effb3 lib/core/patch.py 4cfda3735871cd59b213470a0bbc8c3a lib/core/profiling.py 5e2c16a8e2daee22dd545df13386e7a3 lib/core/readlineng.py 7d8a22c582ad201f65b73225e4456170 lib/core/replication.py 3179d34f371e0295dd4604568fb30bcd lib/core/revision.py d6269c55789f78cf707e09a0f5b45443 lib/core/session.py -931c1e5b6236016d536eb6f70a4a669e lib/core/settings.py +ae2061c30dfddcc64719a2ed8f41bd09 lib/core/settings.py 4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py 10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py 9c7b5c6397fb3da33e7a4d7876d159c6 lib/core/target.py @@ -62,16 +62,16 @@ fb6be55d21a70765e35549af2484f762 lib/__init__.py 4881480d0c1778053908904e04570dc3 lib/parse/banner.py 87a1d50411e74cd0afb2d1bed30f59d4 lib/parse/cmdline.py 06ccbccb63255c8f1c35950a4c8a6f6b lib/parse/configfile.py -9b33e52f697d6e915c7a10153562ce89 lib/parse/handler.py +d34df646508c2dceb25205e1316673d1 lib/parse/handler.py 43deb2400e269e602e916efaec7c0903 lib/parse/headers.py 77e802323ffa718dd9c27512656c0a70 lib/parse/html.py fb6be55d21a70765e35549af2484f762 lib/parse/__init__.py adcecd2d6a8667b22872a563eb83eac0 lib/parse/payloads.py 993104046c7d97120613409ef7780c76 lib/parse/sitemap.py e4ea70bcd461f5176867dcd89d372386 lib/request/basicauthhandler.py -88881f162a82325389c68a635723889b lib/request/basic.py +97b7577fdfe3d8537fe9ea3a070d0507 lib/request/basic.py fc25d951217077fe655ed2a3a81552ae lib/request/comparison.py -2192d65f4a8ba15c081e12590b6e517f lib/request/connect.py +5a1226fc294dd7507be089b5622564d1 lib/request/connect.py 7cba86090b02558f04c6692cef66e772 lib/request/direct.py 2b7509ba38a667c61cefff036ec4ca6f lib/request/dns.py ceac6b3bf1f726f8ff43c6814e9d7281 lib/request/httpshandler.py @@ -101,14 +101,14 @@ fb6be55d21a70765e35549af2484f762 lib/techniques/__init__.py fb6be55d21a70765e35549af2484f762 lib/techniques/union/__init__.py 9d9a6148f10693aaab5fac1273d981d4 lib/techniques/union/test.py e141fb96f2a136bafd6bb2350f02d33b lib/techniques/union/use.py -78cd3133349e9cfdcc6b3512c7d5ce36 lib/utils/api.py +936e5cb1bc25c69f0716df1c2900f52a lib/utils/api.py 544dee96e782560fe4355cbf6ee19b8c lib/utils/brute.py b27421eb57cea711050135f84be99258 lib/utils/crawler.py da4bc159e6920f1f7e45c92c39941690 lib/utils/deps.py f7c64515a3e4fcfe8266ca2be77be565 lib/utils/getch.py 0d497906b06eb82d14da676e9f9c98f5 lib/utils/har.py d11f7f208ccf3a7753ccc417b4b01901 lib/utils/hashdb.py -4bcee9dd3300aaad495e7f27f9fbccc0 lib/utils/hash.py +8fcdcf21cf037e0673d785489eb6806f lib/utils/hash.py 17009289bb5c0dc0cceaa483113101e1 lib/utils/htmlentities.py fb6be55d21a70765e35549af2484f762 lib/utils/__init__.py 833b05c72c9fa60b0a25b0a26f8f31fb lib/utils/pivotdumptable.py @@ -213,14 +213,14 @@ ec3f406591fc9472f5750bd40993e72e plugins/dbms/sybase/syntax.py 369476221b3059106410de05766227e0 plugins/dbms/sybase/takeover.py 312020bc31ffb0bc6077f62e6fff6e73 plugins/generic/connector.py 1ea0b0e7aa15b7687e1b00845e33f9ab plugins/generic/custom.py -a3fd48c7094fca6692be8b1ae5e29cea plugins/generic/databases.py -9c2c830b3cf66953ecffa6cf88fc7c14 plugins/generic/entries.py +f0ee05d8c97dc2ca20b39512a1cc9f99 plugins/generic/databases.py +e1c9b3c9b14e71c06381dd6832119158 plugins/generic/entries.py f3624debb8ae6fbcfb5f1b7f1d0743d1 plugins/generic/enumeration.py cda119b7b0d1afeb60f912009cdb0cf5 plugins/generic/filesystem.py 65e75cd3c2c7acffa6ac13b086e0f383 plugins/generic/fingerprint.py fb6be55d21a70765e35549af2484f762 plugins/generic/__init__.py de1928d6865547764ae9a896da4bf1d4 plugins/generic/misc.py -8bc2b5dfbc4c644ed95adfe8099ee067 plugins/generic/search.py +c95bf3dec22cc638100efef99e2ccc3c plugins/generic/search.py 1989f6cbed217f4222dc2dce72992d91 plugins/generic/syntax.py 44c388ea08d4296e2bf2706e19cbe64a plugins/generic/takeover.py a4b9f764140e89279e3d0dace99bfa5f plugins/generic/users.py