diff --git a/lib/controller/checks.py b/lib/controller/checks.py index b66f35cab..8c56752aa 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -29,7 +29,6 @@ from lib.core.common import getLastRequestHTTPError from lib.core.common import getPublicTypeMembers from lib.core.common import getSafeExString from lib.core.common import getSortedInjectionTests -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.common import intersect @@ -49,6 +48,7 @@ from lib.core.common import urlencode from lib.core.common import wasLastResponseDBMSError from lib.core.common import wasLastResponseHTTPError from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.defaults import defaults from lib.core.data import conf from lib.core.data import kb diff --git a/lib/core/agent.py b/lib/core/agent.py index 733b38c4a..d79209bc6 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -12,7 +12,6 @@ from lib.core.common import Backend from lib.core.common import extractRegexResult from lib.core.common import filterNone from lib.core.common import getSQLSnippet -from lib.core.common import getUnicode from lib.core.common import isDBMSVersionAtLeast from lib.core.common import isNumber from lib.core.common import isTechniqueAvailable @@ -26,6 +25,7 @@ from lib.core.common import unArrayizeValue from lib.core.common import urlencode from lib.core.common import zeroDepthSearch from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import queries diff --git a/lib/core/common.py b/lib/core/common.py index 363c3772e..f286fbe0a 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -56,6 +56,7 @@ from lib.core.convert import decodeBase64 from lib.core.convert import decodeHex from lib.core.convert import getBytes from lib.core.convert import getText +from lib.core.convert import getUnicode from lib.core.convert import htmlunescape from lib.core.convert import stdoutencode from lib.core.data import conf @@ -2418,50 +2419,6 @@ def getPartRun(alias=True): else: return retVal -def getUnicode(value, encoding=None, noneToNull=False): - """ - Return the unicode representation of the supplied value: - - >>> getUnicode('test') == u'test' - True - >>> getUnicode(1) == u'1' - True - """ - - if noneToNull and value is None: - return NULL - - if isinstance(value, six.text_type): - return value - elif isinstance(value, six.binary_type): - # Heuristics (if encoding not explicitly specified) - candidates = filterNone((encoding, kb.get("pageEncoding") if kb.get("originalPage") else None, conf.get("encoding"), UNICODE_ENCODING, sys.getfilesystemencoding())) - if all(_ in value for _ in (b'<', b'>')): - pass - elif any(_ in value for _ in (b":\\", b'/', b'.')) and b'\n' not in value: - candidates = filterNone((encoding, sys.getfilesystemencoding(), kb.get("pageEncoding") if kb.get("originalPage") else None, UNICODE_ENCODING, conf.get("encoding"))) - elif conf.get("encoding") and b'\n' not in value: - candidates = filterNone((encoding, conf.get("encoding"), kb.get("pageEncoding") if kb.get("originalPage") else None, sys.getfilesystemencoding(), UNICODE_ENCODING)) - - for candidate in candidates: - try: - return six.text_type(value, candidate) - except UnicodeDecodeError: - pass - - try: - return six.text_type(value, encoding or (kb.get("pageEncoding") if kb.get("originalPage") else None) or UNICODE_ENCODING) - except UnicodeDecodeError: - return six.text_type(value, UNICODE_ENCODING, errors="reversible") - elif isListLike(value): - value = list(getUnicode(_, encoding, noneToNull) for _ in value) - return value - else: - try: - return six.text_type(value) - except UnicodeDecodeError: - return six.text_type(str(value), errors="ignore") # encoding ignored for non-basestring instances - def longestCommonPrefix(*sequences): """ Returns longest common prefix occuring in given sequences diff --git a/lib/core/convert.py b/lib/core/convert.py index fabfe69e8..ce4c071bf 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -16,8 +16,11 @@ import json import re import sys +from lib.core.data import conf +from lib.core.data import kb from lib.core.settings import INVALID_UNICODE_PRIVATE_AREA from lib.core.settings import IS_WIN +from lib.core.settings import NULL from lib.core.settings import PICKLE_PROTOCOL from lib.core.settings import SAFE_HEX_MARKER from lib.core.settings import UNICODE_ENCODING @@ -89,6 +92,12 @@ def singleTimeWarnMessage(message): # Cross-referenced function sys.stdout.write("\n") sys.stdout.flush() +def filterNone(values): # Cross-referenced function + raise NotImplementedError + +def isListLike(value): # Cross-referenced function + raise NotImplementedError + def stdoutencode(data): retVal = data @@ -146,7 +155,7 @@ def decodeHex(value, binary=True): retVal = value if isinstance(value, six.binary_type): - value = value.decode(UNICODE_ENCODING) + value = getText(value) if value.lower().startswith("0x"): value = value[2:] @@ -250,6 +259,50 @@ def getOrds(value): return [_ if isinstance(_, int) else ord(_) for _ in value] +def getUnicode(value, encoding=None, noneToNull=False): + """ + Return the unicode representation of the supplied value: + + >>> getUnicode('test') == u'test' + True + >>> getUnicode(1) == u'1' + True + """ + + if noneToNull and value is None: + return NULL + + if isinstance(value, six.text_type): + return value + elif isinstance(value, six.binary_type): + # Heuristics (if encoding not explicitly specified) + candidates = filterNone((encoding, kb.get("pageEncoding") if kb.get("originalPage") else None, conf.get("encoding"), UNICODE_ENCODING, sys.getfilesystemencoding())) + if all(_ in value for _ in (b'<', b'>')): + pass + elif any(_ in value for _ in (b":\\", b'/', b'.')) and b'\n' not in value: + candidates = filterNone((encoding, sys.getfilesystemencoding(), kb.get("pageEncoding") if kb.get("originalPage") else None, UNICODE_ENCODING, conf.get("encoding"))) + elif conf.get("encoding") and b'\n' not in value: + candidates = filterNone((encoding, conf.get("encoding"), kb.get("pageEncoding") if kb.get("originalPage") else None, sys.getfilesystemencoding(), UNICODE_ENCODING)) + + for candidate in candidates: + try: + return six.text_type(value, candidate) + except UnicodeDecodeError: + pass + + try: + return six.text_type(value, encoding or (kb.get("pageEncoding") if kb.get("originalPage") else None) or UNICODE_ENCODING) + except UnicodeDecodeError: + return six.text_type(value, UNICODE_ENCODING, errors="reversible") + elif isListLike(value): + value = list(getUnicode(_, encoding, noneToNull) for _ in value) + return value + else: + try: + return six.text_type(value) + except UnicodeDecodeError: + return six.text_type(str(value), errors="ignore") # encoding ignored for non-basestring instances + def getText(value): """ Returns textual value of a given value (Note: not necessary Unicode on Python2) @@ -263,7 +316,7 @@ def getText(value): retVal = value if isinstance(value, six.binary_type): - retVal = value.decode(UNICODE_ENCODING) + retVal = getUnicode(value) if six.PY2: try: diff --git a/lib/core/dump.py b/lib/core/dump.py index 4c5f7c683..5d7a38c01 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -18,7 +18,6 @@ from lib.core.common import checkFile from lib.core.common import dataToDumpFile from lib.core.common import dataToStdout from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import isListLike from lib.core.common import isMultiThreadMode from lib.core.common import normalizeUnicode @@ -29,6 +28,7 @@ from lib.core.common import safeCSValue from lib.core.common import unsafeSQLIdentificatorNaming from lib.core.compat import xrange from lib.core.convert import getBytes +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/core/option.py b/lib/core/option.py index 1d2f67f9e..423b72cfa 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -17,13 +17,6 @@ import tempfile import threading import time -import lib.controller.checks -import lib.core.common -import lib.core.threads -import lib.core.convert -import lib.request.connect -import lib.utils.search - from lib.controller.checks import checkConnection from lib.core.common import Backend from lib.core.common import boldifyMessage @@ -32,7 +25,6 @@ from lib.core.common import dataToStdout from lib.core.common import decodeStringEscape from lib.core.common import getPublicTypeMembers from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import filterNone from lib.core.common import findLocalPort from lib.core.common import findPageForms @@ -61,6 +53,7 @@ from lib.core.common import singleTimeWarnMessage from lib.core.common import urldecode from lib.core.compat import round from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -2621,15 +2614,6 @@ def _basicOptionValidation(): errMsg = "cookies file '%s' does not exist" % conf.loadCookies raise SqlmapFilePathException(errMsg) -def _resolveCrossReferences(): - lib.core.threads.readInput = readInput - lib.core.common.getPageTemplate = getPageTemplate - lib.core.convert.singleTimeWarnMessage = singleTimeWarnMessage - lib.request.connect.setHTTPHandlers = _setHTTPHandlers - lib.utils.search.setHTTPHandlers = _setHTTPHandlers - lib.controller.checks.setVerbosity = setVerbosity - lib.controller.checks.setWafFunctions = _setWafFunctions - def initOptions(inputOptions=AttribDict(), overrideOptions=False): _setConfAttributes() _setKnowledgeBaseAttributes() @@ -2663,7 +2647,6 @@ def init(): _setWafFunctions() _setTrafficOutputFP() _setupHTTPCollector() - _resolveCrossReferences() _setHttpChunked() _checkWebSocket() diff --git a/lib/core/patch.py b/lib/core/patch.py index 0dd3e4a41..5fc1be330 100644 --- a/lib/core/patch.py +++ b/lib/core/patch.py @@ -7,6 +7,24 @@ See the file 'LICENSE' for copying permission import codecs +import lib.controller.checks +import lib.core.common +import lib.core.threads +import lib.core.convert +import lib.request.connect +import lib.utils.search +import thirdparty.ansistrm.ansistrm + +from lib.request.templates import getPageTemplate + +from lib.core.common import filterNone +from lib.core.common import isListLike +from lib.core.common import singleTimeWarnMessage +from lib.core.common import readInput +from lib.core.convert import stdoutencode +from lib.core.option import _setHTTPHandlers +from lib.core.option import setVerbosity +from lib.core.option import _setWafFunctions from lib.core.settings import IS_WIN from thirdparty.six.moves import http_client as _http_client @@ -32,3 +50,19 @@ def dirtyPatches(): _http_client.LineAndFileWrapper._readline = _http_client.LineAndFileWrapper.readline _http_client.LineAndFileWrapper.readline = _ + +def resolveCrossReferences(): + """ + Place for cross-reference resolution + """ + + lib.core.threads.readInput = readInput + lib.core.common.getPageTemplate = getPageTemplate + lib.core.convert.filterNone = filterNone + lib.core.convert.isListLike = isListLike + lib.core.convert.singleTimeWarnMessage = singleTimeWarnMessage + lib.request.connect.setHTTPHandlers = _setHTTPHandlers + lib.utils.search.setHTTPHandlers = _setHTTPHandlers + lib.controller.checks.setVerbosity = setVerbosity + lib.controller.checks.setWafFunctions = _setWafFunctions + thirdparty.ansistrm.ansistrm.stdoutencode = stdoutencode diff --git a/lib/core/settings.py b/lib/core/settings.py index dbd497fd2..efb5f2ad6 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (...) -VERSION = "1.3.5.21" +VERSION = "1.3.5.22" 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/core/target.py b/lib/core/target.py index 557aee7bc..6e6f4030b 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -15,7 +15,6 @@ import time from lib.core.common import Backend from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import intersect from lib.core.common import isNumPosStrValue @@ -27,6 +26,7 @@ from lib.core.common import readInput from lib.core.common import resetCookieJar from lib.core.common import urldecode from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/core/testing.py b/lib/core/testing.py index c4ef74759..f04e5f2b3 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -22,12 +22,12 @@ from extra.vulnserver import vulnserver from lib.controller.controller import start from lib.core.common import clearConsoleLine from lib.core.common import dataToStdout -from lib.core.common import getUnicode from lib.core.common import randomStr from lib.core.common import readXmlFile from lib.core.common import shellExec from lib.core.compat import round from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import logger from lib.core.data import paths diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 44ab96c29..b5dae03f2 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -22,8 +22,8 @@ from lib.core.common import checkSystemEncoding from lib.core.common import dataToStdout from lib.core.common import expandMnemonics from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import cmdLineOptions from lib.core.data import conf from lib.core.data import logger diff --git a/lib/parse/configfile.py b/lib/parse/configfile.py index fc5b332d7..36f063abc 100644 --- a/lib/parse/configfile.py +++ b/lib/parse/configfile.py @@ -7,10 +7,10 @@ See the file 'LICENSE' for copying permission from lib.core.common import checkFile from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import openFile from lib.core.common import unArrayizeValue from lib.core.common import UnicodeRawConfigParser +from lib.core.convert import getUnicode from lib.core.data import cmdLineOptions from lib.core.data import conf from lib.core.data import logger diff --git a/lib/request/basic.py b/lib/request/basic.py index 593cd360a..53a3aa3bf 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -19,7 +19,6 @@ from lib.core.common import extractRegexResult from lib.core.common import filterNone from lib.core.common import getPublicTypeMembers from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import isListLike from lib.core.common import randomStr from lib.core.common import readInput @@ -29,6 +28,7 @@ from lib.core.common import singleTimeWarnMessage from lib.core.common import unArrayizeValue from lib.core.convert import decodeHex from lib.core.convert import getBytes +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/request/connect.py b/lib/request/connect.py index c007932c5..379011dfd 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -39,7 +39,6 @@ from lib.core.common import getHeader from lib.core.common import getHostHeader from lib.core.common import getRequestHeader from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import isMultiThreadMode from lib.core.common import logHTTPTraffic from lib.core.common import pushValue @@ -60,6 +59,7 @@ from lib.core.common import urlencode from lib.core.compat import patchHeaders from lib.core.compat import xrange from lib.core.convert import getBytes +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/request/direct.py b/lib/request/direct.py index a85c5bd46..1bd675b1b 100644 --- a/lib/request/direct.py +++ b/lib/request/direct.py @@ -13,10 +13,10 @@ from lib.core.common import Backend from lib.core.common import calculateDeltaSeconds from lib.core.common import extractExpectedValue from lib.core.common import getCurrentThreadData -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.common import isListLike +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/request/redirecthandler.py b/lib/request/redirecthandler.py index 0fd68d0bd..b2eaeb519 100644 --- a/lib/request/redirecthandler.py +++ b/lib/request/redirecthandler.py @@ -14,9 +14,9 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.common import getHostHeader from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import logHTTPTraffic from lib.core.common import readInput +from lib.core.convert import getUnicode from lib.core.enums import CUSTOM_LOGGING from lib.core.enums import HTTP_HEADER from lib.core.enums import HTTPMETHOD diff --git a/lib/takeover/abstraction.py b/lib/takeover/abstraction.py index 7b5bc2f54..1a7895806 100644 --- a/lib/takeover/abstraction.py +++ b/lib/takeover/abstraction.py @@ -13,9 +13,9 @@ from extra.safe2bin.safe2bin import safechardecode from lib.core.common import dataToStdout from lib.core.common import Backend from lib.core.common import getSQLSnippet -from lib.core.common import getUnicode from lib.core.common import isStackingAvailable from lib.core.common import readInput +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import logger from lib.core.enums import AUTOCOMPLETE_TYPE diff --git a/lib/takeover/web.py b/lib/takeover/web.py index cc6b08885..3e7680cbd 100644 --- a/lib/takeover/web.py +++ b/lib/takeover/web.py @@ -20,7 +20,6 @@ from lib.core.common import getAutoDirectories from lib.core.common import getManualDirectories from lib.core.common import getPublicTypeMembers from lib.core.common import getSQLSnippet -from lib.core.common import getUnicode from lib.core.common import ntToPosixSlashes from lib.core.common import isTechniqueAvailable from lib.core.common import isWindowsDriveLetterPath @@ -36,6 +35,7 @@ from lib.core.compat import xrange from lib.core.convert import encodeHex from lib.core.convert import getBytes from lib.core.convert import getText +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/techniques/error/use.py b/lib/techniques/error/use.py index 47dcb3c90..45aac9163 100644 --- a/lib/techniques/error/use.py +++ b/lib/techniques/error/use.py @@ -21,7 +21,6 @@ from lib.core.common import extractRegexResult from lib.core.common import firstNotNone from lib.core.common import getConsoleWidth from lib.core.common import getPartRun -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.common import incrementCounter @@ -34,6 +33,7 @@ from lib.core.common import unArrayizeValue from lib.core.common import wasLastResponseHTTPError from lib.core.compat import xrange from lib.core.convert import decodeHex +from lib.core.convert import getUnicode from lib.core.convert import htmlunescape from lib.core.data import conf from lib.core.data import kb diff --git a/lib/techniques/union/use.py b/lib/techniques/union/use.py index 071398c4a..fa78ea6dd 100644 --- a/lib/techniques/union/use.py +++ b/lib/techniques/union/use.py @@ -24,7 +24,6 @@ from lib.core.common import flattenValue from lib.core.common import safeStringFormat from lib.core.common import getConsoleWidth from lib.core.common import getPartRun -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.common import incrementCounter @@ -42,6 +41,7 @@ from lib.core.common import wasLastResponseDBMSError from lib.core.compat import xrange from lib.core.convert import decodeBase64 from lib.core.convert import getBytes +from lib.core.convert import getUnicode from lib.core.convert import htmlunescape from lib.core.data import conf from lib.core.data import kb diff --git a/lib/utils/hash.py b/lib/utils/hash.py index f34a7c799..6ac03ad3d 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -53,7 +53,6 @@ from lib.core.common import dataToStdout from lib.core.common import getFileItems from lib.core.common import getPublicTypeMembers from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.common import normalizeUnicode @@ -67,6 +66,7 @@ from lib.core.convert import decodeBase64 from lib.core.convert import decodeHex from lib.core.convert import getBytes from lib.core.convert import getText +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index d65360bbc..f756f1438 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -12,12 +12,12 @@ import threading import time from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import serializeObject from lib.core.common import singleTimeWarnMessage from lib.core.common import unserializeObject from lib.core.compat import xrange from lib.core.convert import getBytes +from lib.core.convert import getUnicode from lib.core.data import logger from lib.core.exception import SqlmapConnectionException from lib.core.settings import HASHDB_END_TRANSACTION_RETRIES diff --git a/lib/utils/pivotdumptable.py b/lib/utils/pivotdumptable.py index 3b1b416a9..64a3e4321 100644 --- a/lib/utils/pivotdumptable.py +++ b/lib/utils/pivotdumptable.py @@ -13,13 +13,13 @@ from lib.core.bigarray import BigArray from lib.core.common import Backend from lib.core.common import filterNone from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import isNoneValue from lib.core.common import isNumPosStrValue from lib.core.common import singleTimeWarnMessage from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/utils/progress.py b/lib/utils/progress.py index dc9ade228..c41c61022 100644 --- a/lib/utils/progress.py +++ b/lib/utils/progress.py @@ -7,8 +7,8 @@ See the file 'LICENSE' for copying permission import time -from lib.core.common import getUnicode from lib.core.common import dataToStdout +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb diff --git a/lib/utils/search.py b/lib/utils/search.py index ddb6111a4..d907b2c51 100644 --- a/lib/utils/search.py +++ b/lib/utils/search.py @@ -9,11 +9,11 @@ import re import socket from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import popValue from lib.core.common import pushValue from lib.core.common import readInput from lib.core.common import urlencode +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/plugins/dbms/firebird/fingerprint.py b/plugins/dbms/firebird/fingerprint.py index e491fe1cc..90be5227a 100644 --- a/plugins/dbms/firebird/fingerprint.py +++ b/plugins/dbms/firebird/fingerprint.py @@ -9,9 +9,9 @@ import re from lib.core.common import Backend from lib.core.common import Format -from lib.core.common import getUnicode from lib.core.common import randomRange from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/plugins/dbms/mssqlserver/fingerprint.py b/plugins/dbms/mssqlserver/fingerprint.py index e67834e2b..502839480 100644 --- a/plugins/dbms/mssqlserver/fingerprint.py +++ b/plugins/dbms/mssqlserver/fingerprint.py @@ -7,7 +7,7 @@ See the file 'LICENSE' for copying permission from lib.core.common import Backend from lib.core.common import Format -from lib.core.common import getUnicode +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/plugins/dbms/mysql/fingerprint.py b/plugins/dbms/mysql/fingerprint.py index aeb9ffb14..20970e6d9 100644 --- a/plugins/dbms/mysql/fingerprint.py +++ b/plugins/dbms/mysql/fingerprint.py @@ -9,10 +9,10 @@ import re from lib.core.common import Backend from lib.core.common import Format -from lib.core.common import getUnicode from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.compat import xrange +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/plugins/dbms/mysql/syntax.py b/plugins/dbms/mysql/syntax.py index f7ea71eeb..a1f4f670a 100644 --- a/plugins/dbms/mysql/syntax.py +++ b/plugins/dbms/mysql/syntax.py @@ -7,9 +7,9 @@ See the file 'LICENSE' for copying permission import binascii -from lib.core.common import getUnicode from lib.core.convert import getBytes from lib.core.convert import getOrds +from lib.core.convert import getUnicode from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): diff --git a/plugins/dbms/sqlite/syntax.py b/plugins/dbms/sqlite/syntax.py index 21119a7a5..874203fdb 100644 --- a/plugins/dbms/sqlite/syntax.py +++ b/plugins/dbms/sqlite/syntax.py @@ -7,9 +7,9 @@ See the file 'LICENSE' for copying permission import binascii -from lib.core.common import getUnicode from lib.core.common import isDBMSVersionAtLeast from lib.core.convert import getBytes +from lib.core.convert import getUnicode from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): diff --git a/plugins/generic/custom.py b/plugins/generic/custom.py index 2c6ed4ea4..d7a025210 100644 --- a/plugins/generic/custom.py +++ b/plugins/generic/custom.py @@ -13,8 +13,8 @@ import sys from lib.core.common import Backend from lib.core.common import dataToStdout from lib.core.common import getSQLSnippet -from lib.core.common import getUnicode from lib.core.common import isStackingAvailable +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import logger from lib.core.dicts import SQL_STATEMENTS diff --git a/plugins/generic/entries.py b/plugins/generic/entries.py index b91fd5200..0f33c6bff 100644 --- a/plugins/generic/entries.py +++ b/plugins/generic/entries.py @@ -13,7 +13,6 @@ from lib.core.common import Backend from lib.core.common import clearConsoleLine from lib.core.common import getLimitRange from lib.core.common import getSafeExString -from lib.core.common import getUnicode from lib.core.common import isInferenceAvailable from lib.core.common import isListLike from lib.core.common import isNoneValue @@ -26,6 +25,7 @@ from lib.core.common import singleTimeLogMessage from lib.core.common import singleTimeWarnMessage from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/plugins/generic/filesystem.py b/plugins/generic/filesystem.py index 4efd64437..fb816c5b5 100644 --- a/plugins/generic/filesystem.py +++ b/plugins/generic/filesystem.py @@ -15,7 +15,6 @@ from lib.core.common import Backend from lib.core.common import checkFile from lib.core.common import decloakToTemp from lib.core.common import decodeDbmsHexValue -from lib.core.common import getUnicode from lib.core.common import isNumPosStrValue from lib.core.common import isListLike from lib.core.common import isStackingAvailable @@ -23,6 +22,7 @@ from lib.core.common import isTechniqueAvailable from lib.core.common import readInput from lib.core.compat import xrange from lib.core.convert import getText +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/plugins/generic/users.py b/plugins/generic/users.py index 87bb71d23..81e747934 100644 --- a/plugins/generic/users.py +++ b/plugins/generic/users.py @@ -12,7 +12,6 @@ from lib.core.common import arrayizeValue from lib.core.common import Backend from lib.core.common import filterPairValues from lib.core.common import getLimitRange -from lib.core.common import getUnicode from lib.core.common import isAdminFromPrivileges from lib.core.common import isInferenceAvailable from lib.core.common import isNoneValue @@ -23,6 +22,7 @@ from lib.core.common import readInput from lib.core.common import unArrayizeValue from lib.core.compat import xrange from lib.core.convert import encodeHex +from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/sqlmap.py b/sqlmap.py index 4b03662ba..667e61253 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -45,11 +45,11 @@ try: from lib.core.common import filterNone from lib.core.common import getDaysFromLastUpdate from lib.core.common import getSafeExString - from lib.core.common import getUnicode from lib.core.common import maskSensitiveData from lib.core.common import openFile from lib.core.common import setPaths from lib.core.common import weAreFrozen + from lib.core.convert import getUnicode from lib.core.data import cmdLineOptions from lib.core.data import conf from lib.core.data import kb @@ -63,6 +63,7 @@ try: from lib.core.option import initOptions from lib.core.option import init from lib.core.patch import dirtyPatches + from lib.core.patch import resolveCrossReferences from lib.core.settings import GIT_PAGE from lib.core.settings import IS_WIN from lib.core.settings import LAST_UPDATE_NAGGING_DAYS @@ -127,6 +128,7 @@ def main(): try: dirtyPatches() + resolveCrossReferences() checkEnvironment() setPaths(modulePath()) banner() diff --git a/thirdparty/ansistrm/ansistrm.py b/thirdparty/ansistrm/ansistrm.py index ace79c055..41e6646f7 100644 --- a/thirdparty/ansistrm/ansistrm.py +++ b/thirdparty/ansistrm/ansistrm.py @@ -8,7 +8,6 @@ import os import re import sys -from lib.core.convert import stdoutencode from lib.core.settings import IS_WIN if IS_WIN: @@ -21,6 +20,8 @@ if IS_WIN: ctypes.windll.kernel32.SetConsoleTextAttribute.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.WORD] ctypes.windll.kernel32.SetConsoleTextAttribute.restype = ctypes.wintypes.BOOL +def stdoutencode(data): # Cross-referenced function + raise NotImplementedError class ColorizingStreamHandler(logging.StreamHandler): # color names to indices diff --git a/waf/generic.py b/waf/generic.py index 6e6aa1d05..4a3afe018 100644 --- a/waf/generic.py +++ b/waf/generic.py @@ -7,7 +7,7 @@ See the file 'LICENSE' for copying permission import re -from lib.core.common import getUnicode +from lib.core.convert import getUnicode from lib.core.data import kb from lib.core.settings import GENERIC_PROTECTION_REGEX from lib.core.settings import IPS_WAF_CHECK_PAYLOAD