From 0f4d1e79b74a5e843ab320c5b87ae2c63e5c944a Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 3 May 2019 00:48:46 +0200 Subject: [PATCH] Minor update --- extra/shutils/drei.sh | 2 +- lib/core/settings.py | 2 +- lib/parse/cmdline.py | 3 ++- thirdparty/multipart/multipartpost.py | 9 +++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/extra/shutils/drei.sh b/extra/shutils/drei.sh index 78777a39d..ef4b51479 100755 --- a/extra/shutils/drei.sh +++ b/extra/shutils/drei.sh @@ -10,4 +10,4 @@ # unset SQLMAP_DREI # source `dirname "$0"`"/junk.sh" -for i in $(find . -iname "*.py" | grep -v __init__); do pylint --py3k $i; done +for i in $(find . -iname "*.py" | grep -v __init__); do timeout 10 pylint --py3k $i; done 2>&1 | grep -v -E 'absolute_import|No config file' diff --git a/lib/core/settings.py b/lib/core/settings.py index 1814d7fdf..c2db70be4 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.7" +VERSION = "1.3.5.8" 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/cmdline.py b/lib/parse/cmdline.py index bb6e9ef84..44ab96c29 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -21,6 +21,7 @@ from lib.core.common import checkDeprecatedOptions 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.data import cmdLineOptions @@ -836,7 +837,7 @@ def cmdLineParser(argv=None): for arg in shlex.split(command): argv.append(getUnicode(arg, encoding=sys.stdin.encoding)) except ValueError as ex: - raise SqlmapSyntaxException("something went wrong during command line parsing ('%s')" % ex.message) + raise SqlmapSyntaxException("something went wrong during command line parsing ('%s')" % getSafeExString(ex)) for i in xrange(len(argv)): if argv[i] == "-hh": diff --git a/thirdparty/multipart/multipartpost.py b/thirdparty/multipart/multipartpost.py index 52f75fa47..993f4ff90 100644 --- a/thirdparty/multipart/multipartpost.py +++ b/thirdparty/multipart/multipartpost.py @@ -26,6 +26,7 @@ import os import stat import sys +from lib.core.common import getBytes from lib.core.compat import choose_boundary from lib.core.exception import SqlmapDataException from thirdparty.six.moves import urllib as _urllib @@ -51,7 +52,7 @@ class MultipartPostHandler(_urllib.request.BaseHandler): try: for(key, value) in data.items(): - if isinstance(value, file) or hasattr(value, "file") or isinstance(value, io.IOBase): + if hasattr(value, "fileno") or hasattr(value, "file") or isinstance(value, io.IOBase): v_files.append((key, value)) else: v_vars.append((key, value)) @@ -85,7 +86,7 @@ class MultipartPostHandler(_urllib.request.BaseHandler): buf += "\r\n\r\n" + value + "\r\n" for (key, fd) in files: - file_size = os.fstat(fd.fileno())[stat.ST_SIZE] if isinstance(fd, file) else fd.len + file_size = os.fstat(fd.fileno())[stat.ST_SIZE] if hasattr(fd, "fileno") else fd.len filename = fd.name.split("/")[-1] if "/" in fd.name else fd.name.split("\\")[-1] try: contenttype = mimetypes.guess_type(filename)[0] or "application/octet-stream" @@ -98,8 +99,8 @@ class MultipartPostHandler(_urllib.request.BaseHandler): # buf += "Content-Length: %s\r\n" % file_size fd.seek(0) - buf = str(buf) if not isinstance(buf, unicode) else buf.encode("utf8") - buf += "\r\n%s\r\n" % fd.read() + buf = getBytes(buf) + buf += b"\r\n%s\r\n" % fd.read() buf += "--%s--\r\n\r\n" % boundary