diff --git a/lib/core/common.py b/lib/core/common.py index 73cd925b3..5996e46b3 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1196,7 +1196,7 @@ def setPaths(): paths.SQLMAP_XML_PAYLOADS_PATH = os.path.join(paths.SQLMAP_XML_PATH, "payloads") _ = os.path.join(os.path.expandvars(os.path.expanduser("~")), ".sqlmap") - paths.SQLMAP_OUTPUT_PATH = getUnicode(paths.get("SQLMAP_OUTPUT_PATH", os.path.join(_, "output")), encoding=sys.getfilesystemencoding()) + paths.SQLMAP_OUTPUT_PATH = getUnicode(paths.get("SQLMAP_OUTPUT_PATH", os.path.join(_, "output")), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump") paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") diff --git a/lib/core/option.py b/lib/core/option.py index a533ed951..dda62c5de 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -127,6 +127,7 @@ from lib.core.settings import SQLMAP_ENVIRONMENT_PREFIX from lib.core.settings import SUPPORTED_DBMS from lib.core.settings import SUPPORTED_OS from lib.core.settings import TIME_DELAY_CANDIDATES +from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNION_CHAR_REGEX from lib.core.settings import UNKNOWN_DBMS_VERSION from lib.core.settings import URI_INJECTABLE_REGEX @@ -913,7 +914,7 @@ def _setTamperingFunctions(): sys.path.insert(0, dirname) try: - module = __import__(filename[:-3].encode(sys.getfilesystemencoding())) + module = __import__(filename[:-3].encode(sys.getfilesystemencoding() or UNICODE_ENCODING)) except (ImportError, SyntaxError), ex: raise SqlmapSyntaxException("cannot import tamper script '%s' (%s)" % (filename[:-3], getSafeExString(ex))) diff --git a/lib/core/settings.py b/lib/core/settings.py index 79d6fda38..390ed5b05 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -VERSION = "1.0.6.44" +VERSION = "1.0.6.45" REVISION = getRevisionNumber() STABLE = VERSION.count('.') <= 2 VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev") diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 0bf8136ff..d6279798d 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -31,6 +31,7 @@ from lib.core.settings import BASIC_HELP_ITEMS from lib.core.settings import DUMMY_URL from lib.core.settings import IS_WIN from lib.core.settings import MAX_HELP_OPTION_LENGTH +from lib.core.settings import UNICODE_ENCODING from lib.core.settings import VERSION_STRING from lib.core.shell import autoCompletion from lib.core.shell import clearHistory @@ -47,7 +48,7 @@ def cmdLineParser(argv=None): checkSystemEncoding() - _ = getUnicode(os.path.basename(argv[0]), encoding=sys.getfilesystemencoding()) + _ = getUnicode(os.path.basename(argv[0]), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) usage = "%s%s [options]" % ("python " if not IS_WIN else "", \ "\"%s\"" % _ if " " in _ else _) @@ -825,7 +826,7 @@ def cmdLineParser(argv=None): extraHeaders = [] for arg in argv: - _.append(getUnicode(arg, encoding=sys.getfilesystemencoding())) + _.append(getUnicode(arg, encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)) argv = _ checkDeprecatedOptions(argv) diff --git a/plugins/generic/filesystem.py b/plugins/generic/filesystem.py index 2dc5a4565..ef3482675 100644 --- a/plugins/generic/filesystem.py +++ b/plugins/generic/filesystem.py @@ -28,6 +28,7 @@ from lib.core.enums import CHARSET_TYPE from lib.core.enums import EXPECTED from lib.core.enums import PAYLOAD from lib.core.exception import SqlmapUndefinedMethod +from lib.core.settings import UNICODE_ENCODING from lib.request import inject class Filesystem: @@ -69,7 +70,7 @@ class Filesystem: if isNumPosStrValue(remoteFileSize): remoteFileSize = long(remoteFileSize) - localFile = getUnicode(localFile, encoding=sys.getfilesystemencoding()) + localFile = getUnicode(localFile, encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) sameFile = False if localFileSize == remoteFileSize: diff --git a/sqlmap.py b/sqlmap.py index 5634fdd8e..3cb943f48 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -58,6 +58,7 @@ try: from lib.core.settings import IS_WIN from lib.core.settings import LEGAL_DISCLAIMER from lib.core.settings import THREAD_FINALIZATION_TIMEOUT + from lib.core.settings import UNICODE_ENCODING from lib.core.settings import VERSION from lib.core.testing import smokeTest from lib.core.testing import liveTest @@ -81,7 +82,7 @@ def modulePath(): except NameError: _ = inspect.getsourcefile(modulePath) - return getUnicode(os.path.dirname(os.path.realpath(_)), encoding=sys.getfilesystemencoding()) + return getUnicode(os.path.dirname(os.path.realpath(_)), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) def checkEnvironment(): paths.SQLMAP_ROOT_PATH = modulePath()