Skip to content

Commit a48f2d8

Browse files
committed
Merge branch 'master' into add-sortable-tables-to-html-dump
# Conflicts: # data/txt/sha256sums.txt
2 parents cf1a869 + 6c108d9 commit a48f2d8

File tree

8 files changed

+52
-20
lines changed

8 files changed

+52
-20
lines changed

lib/core/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import time
3636
import types
3737
import unicodedata
38+
import zlib
3839

3940
from difflib import SequenceMatcher
4041
from math import sqrt
@@ -4005,7 +4006,8 @@ def createGithubIssue(errMsg, excMsg):
40054006
pass
40064007

40074008
data = {"title": "Unhandled exception (#%s)" % key, "body": "```%s\n```\n```\n%s```" % (errMsg, excMsg)}
4008-
req = _urllib.request.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=getBytes(json.dumps(data)), headers={HTTP_HEADER.AUTHORIZATION: "token %s" % decodeBase64(GITHUB_REPORT_OAUTH_TOKEN, binary=False), HTTP_HEADER.USER_AGENT: fetchRandomAgent()})
4009+
token = getText(zlib.decompress(decodeBase64(GITHUB_REPORT_OAUTH_TOKEN[::-1], binary=True))[0::2][::-1])
4010+
req = _urllib.request.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=getBytes(json.dumps(data)), headers={HTTP_HEADER.AUTHORIZATION: "token %s" % token, HTTP_HEADER.USER_AGENT: fetchRandomAgent()})
40094011

40104012
try:
40114013
content = getText(_urllib.request.urlopen(req).read())

lib/core/option.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ def _setHTTPHandlers():
11751175
proxyString = ""
11761176

11771177
proxyString += "%s:%d" % (hostname, port)
1178-
proxyHandler.proxies = {"http": proxyString, "https": proxyString}
1178+
proxyHandler.proxies = kb.proxies = {"http": proxyString, "https": proxyString}
11791179

11801180
proxyHandler.__init__(proxyHandler.proxies)
11811181

@@ -2151,6 +2151,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
21512151
kb.previousMethod = None
21522152
kb.processNonCustom = None
21532153
kb.processUserMarks = None
2154+
kb.proxies = None
21542155
kb.proxyAuthHeader = None
21552156
kb.queryCounter = 0
21562157
kb.randomPool = {}

lib/core/settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from thirdparty import six
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.9.2.10"
22+
VERSION = "1.9.3.2"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -61,7 +61,7 @@
6161
UPPER_RATIO_BOUND = 0.98
6262

6363
# For filling in case of dumb push updates
64-
DUMMY_JUNK = "ouZ0ii8A"
64+
DUMMY_JUNK = "ahy9Ouge"
6565

6666
# Markers for special cases when parameter values contain html encoded characters
6767
PARAMETER_AMP_MARKER = "__AMP__"
@@ -701,7 +701,7 @@
701701
FORCE_COOKIE_EXPIRATION_TIME = "9999999999"
702702

703703
# Github OAuth token used for creating an automatic Issue for unhandled exceptions
704-
GITHUB_REPORT_OAUTH_TOKEN = "Z2hwX0pNd0I2U25kN2Q5QmxlWkhxZmkxVXZTSHZiTlRDWjE5NUNpNA"
704+
GITHUB_REPORT_OAUTH_TOKEN = "wxqc7vTeW8ohIcX+1wK55Mnql2Ex9cP+2s1dqTr/mjlZJVfLnq24fMAi08v5vRvOmuhVZQdOT/lhIRovWvIJrdECD1ud8VMPWpxY+NmjHoEx+VLK1/vCAUBwJe"
705705

706706
# Skip unforced HashDB flush requests below the threshold number of cached items
707707
HASHDB_FLUSH_THRESHOLD = 32

lib/parse/cmdline.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,10 @@ def _format_action_invocation(self, action):
10101010
argv[i] = ""
10111011
elif argv[i] in DEPRECATED_OPTIONS:
10121012
argv[i] = ""
1013+
elif argv[i] in ("-s", "--silent"):
1014+
if i + 1 < len(argv) and argv[i + 1].startswith('-') or i + 1 == len(argv):
1015+
argv[i] = ""
1016+
conf.verbose = 0
10131017
elif argv[i].startswith("--data-raw"):
10141018
argv[i] = argv[i].replace("--data-raw", "--data", 1)
10151019
elif argv[i].startswith("--auth-creds"):
@@ -1018,7 +1022,6 @@ def _format_action_invocation(self, action):
10181022
argv[i] = argv[i].replace("--drop-cookie", "--drop-set-cookie", 1)
10191023
elif re.search(r"\A--tamper[^=\s]", argv[i]):
10201024
argv[i] = ""
1021-
continue
10221025
elif re.search(r"\A(--(tamper|ignore-code|skip))(?!-)", argv[i]):
10231026
key = re.search(r"\-?\-(\w+)\b", argv[i]).group(1)
10241027
index = auxIndexes.get(key, None)

lib/request/comparison.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
from lib.core.data import kb
2222
from lib.core.data import logger
2323
from lib.core.exception import SqlmapNoneDataException
24+
from lib.core.exception import SqlmapSilentQuitException
2425
from lib.core.settings import DEFAULT_PAGE_ENCODING
26+
from lib.core.settings import DEV_EMAIL_ADDRESS
2527
from lib.core.settings import DIFF_TOLERANCE
2628
from lib.core.settings import HTML_TITLE_REGEX
2729
from lib.core.settings import LOWER_RATIO_BOUND
@@ -35,8 +37,14 @@
3537
from thirdparty import six
3638

3739
def comparison(page, headers, code=None, getRatioValue=False, pageLength=None):
38-
_ = _adjust(_comparison(page, headers, code, getRatioValue, pageLength), getRatioValue)
39-
return _
40+
try:
41+
_ = _adjust(_comparison(page, headers, code, getRatioValue, pageLength), getRatioValue)
42+
return _
43+
except:
44+
warnMsg = "there was a KNOWN issue inside the internals regarding the difflib/comparison of pages. "
45+
warnMsg += "Please report details privately via e-mail to '%s'" % DEV_EMAIL_ADDRESS
46+
logger.critical(warnMsg)
47+
raise SqlmapSilentQuitException
4048

4149
def _adjust(condition, getRatioValue):
4250
if not any((conf.string, conf.notString, conf.regexp, conf.code)):
@@ -120,7 +128,7 @@ def _comparison(page, headers, code, getRatioValue, pageLength):
120128
if isinstance(seqMatcher.a, six.binary_type) and isinstance(page, six.text_type):
121129
page = getBytes(page, kb.pageEncoding or DEFAULT_PAGE_ENCODING, "ignore")
122130
elif isinstance(seqMatcher.a, six.text_type) and isinstance(page, six.binary_type):
123-
seqMatcher.a = getBytes(seqMatcher.a, kb.pageEncoding or DEFAULT_PAGE_ENCODING, "ignore")
131+
seqMatcher.set_seq1(getBytes(seqMatcher.a, kb.pageEncoding or DEFAULT_PAGE_ENCODING, "ignore"))
124132

125133
if any(_ is None for _ in (page, seqMatcher.a)):
126134
return None
@@ -146,12 +154,19 @@ def _comparison(page, headers, code, getRatioValue, pageLength):
146154
if seq1 is None or seq2 is None:
147155
return None
148156

149-
seq1 = seq1.replace(REFLECTED_VALUE_MARKER, "")
150-
seq2 = seq2.replace(REFLECTED_VALUE_MARKER, "")
157+
if isinstance(seq1, six.binary_type):
158+
seq1 = seq1.replace(REFLECTED_VALUE_MARKER.encode(), b"")
159+
elif isinstance(seq1, six.text_type):
160+
seq1 = seq1.replace(REFLECTED_VALUE_MARKER, "")
161+
162+
if isinstance(seq2, six.binary_type):
163+
seq2 = seq2.replace(REFLECTED_VALUE_MARKER.encode(), b"")
164+
elif isinstance(seq2, six.text_type):
165+
seq2 = seq2.replace(REFLECTED_VALUE_MARKER, "")
151166

152167
if kb.heavilyDynamic:
153-
seq1 = seq1.split("\n")
154-
seq2 = seq2.split("\n")
168+
seq1 = seq1.split("\n" if isinstance(seq1, six.text_type) else b"\n")
169+
seq2 = seq2.split("\n" if isinstance(seq2, six.text_type) else b"\n")
155170

156171
key = None
157172
else:

lib/request/connect.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,15 @@ class _(dict):
615615
if conf.http2:
616616
try:
617617
import httpx
618-
with httpx.Client(verify=False, http2=True, timeout=timeout, follow_redirects=True, cookies=conf.cj) as client:
619-
conn = client.request(method or (HTTPMETHOD.POST if post is not None else HTTPMETHOD.GET), url, headers=headers, data=post)
620618
except ImportError:
621619
raise SqlmapMissingDependence("httpx[http2] not available (e.g. 'pip%s install httpx[http2]')" % ('3' if six.PY3 else ""))
620+
621+
try:
622+
proxy_mounts = dict(("%s://" % key, httpx.HTTPTransport(proxy="%s%s" % ("http://" if not "://" in kb.proxies[key] else "", kb.proxies[key]))) for key in kb.proxies) if kb.proxies else None
623+
with httpx.Client(verify=False, http2=True, timeout=timeout, follow_redirects=True, cookies=conf.cj, mounts=proxy_mounts) as client:
624+
conn = client.request(method or (HTTPMETHOD.POST if post is not None else HTTPMETHOD.GET), url, headers=headers, data=post)
625+
except (httpx.HTTPError, httpx.InvalidURL, httpx.CookieConflict, httpx.StreamError) as ex:
626+
raise _http_client.HTTPException(getSafeExString(ex))
622627
else:
623628
conn.code = conn.status_code
624629
conn.msg = conn.reason_phrase

lib/request/httpshandler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def create_sock():
7979
try:
8080
# Reference(s): https://askubuntu.com/a/1263098
8181
# https://askubuntu.com/a/1250807
82-
_contexts[protocol].set_ciphers("DEFAULT@SECLEVEL=1")
82+
# https://git.zknt.org/mirror/bazarr/commit/7f05f932ffb84ba8b9e5630b2adc34dbd77e2b4a?style=split&whitespace=show-all&show-outdated=
83+
_contexts[protocol].set_ciphers("ALL@SECLEVEL=0")
8384
except (ssl.SSLError, AttributeError):
8485
pass
8586
result = _contexts[protocol].wrap_socket(sock, do_handshake_on_connect=True, server_hostname=self.host if re.search(r"\A[\d.]+\Z", self.host or "") is None else None)

thirdparty/six/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010-2020 Benjamin Peterson
1+
# Copyright (c) 2010-2024 Benjamin Peterson
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@
2929
import types
3030

3131
__author__ = "Benjamin Peterson <[email protected]>"
32-
__version__ = "1.16.0"
32+
__version__ = "1.17.0"
3333

3434

3535
# Useful for very coarse version differentiation.
@@ -435,12 +435,17 @@ class Module_six_moves_urllib_request(_LazyModule):
435435
MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
436436
MovedAttribute("urlretrieve", "urllib", "urllib.request"),
437437
MovedAttribute("urlcleanup", "urllib", "urllib.request"),
438-
MovedAttribute("URLopener", "urllib", "urllib.request"),
439-
MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
440438
MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
441439
MovedAttribute("parse_http_list", "urllib2", "urllib.request"),
442440
MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),
443441
]
442+
if sys.version_info[:2] < (3, 14):
443+
_urllib_request_moved_attributes.extend(
444+
[
445+
MovedAttribute("URLopener", "urllib", "urllib.request"),
446+
MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
447+
]
448+
)
444449
for attr in _urllib_request_moved_attributes:
445450
setattr(Module_six_moves_urllib_request, attr.name, attr)
446451
del attr

0 commit comments

Comments
 (0)