diff --git a/lib/core/patch.py b/lib/core/patch.py index ada695427..405a87e37 100644 --- a/lib/core/patch.py +++ b/lib/core/patch.py @@ -8,6 +8,8 @@ See the file 'LICENSE' for copying permission import codecs import os import random +import re +import sys import lib.controller.checks import lib.core.common @@ -30,6 +32,7 @@ from lib.core.common import singleTimeWarnMessage from lib.core.compat import xrange from lib.core.convert import stdoutEncode from lib.core.data import conf +from lib.core.enums import PLACE from lib.core.option import _setHTTPHandlers from lib.core.option import setVerbosity from lib.core.settings import IS_WIN @@ -77,6 +80,10 @@ def dirtyPatches(): # to prevent too much "guessing" in case of binary data retrieval thirdparty.chardet.universaldetector.MINIMUM_THRESHOLD = 0.90 + match = re.search(r" --method[= ](\w+)", " ".join(sys.argv)) + if match and match.group(1).upper() != PLACE.POST: + PLACE.CUSTOM_POST = PLACE.CUSTOM_POST.replace("POST", "%s (body)" % match.group(1)) + # https://github.com/sqlmapproject/sqlmap/issues/4314 try: os.urandom(1) diff --git a/lib/core/settings.py b/lib/core/settings.py index d34d11956..f602fff4d 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.4.12.21" +VERSION = "1.4.12.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/request/connect.py b/lib/request/connect.py index 2177eef2b..4f64d075f 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -64,6 +64,7 @@ from lib.core.compat import xrange from lib.core.convert import getBytes from lib.core.convert import getText from lib.core.convert import getUnicode +from lib.core.data import cmdLineOptions from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -520,9 +521,9 @@ class Connect(object): logger.log(CUSTOM_LOGGING.TRAFFIC_OUT, requestMsg) else: - if method and method not in (HTTPMETHOD.GET, HTTPMETHOD.POST): + if target and cmdLineOptions.method or method and method not in (HTTPMETHOD.GET, HTTPMETHOD.POST): req = MethodRequest(url, post, headers) - req.set_method(method) + req.set_method(cmdLineOptions.method or method) elif url is not None: req = _urllib.request.Request(url, post, headers) else: