Skip to content

Commit d47aacb

Browse files
committed
Update of chardet to 4.0.0
1 parent af0e463 commit d47aacb

17 files changed

Lines changed: 26944 additions & 1630 deletions

data/txt/sha256sums.txt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data.
188188
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
189189
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
190190
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
191-
b035d4789fe95557807a3e0b3e16822a31dba2f46cb952cd46c9bce270fa7368 lib/core/settings.py
191+
6e5a916581e1e7032cdd451737be69af0bbc42cfc7e46d44a43df0ee272c361d lib/core/settings.py
192192
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
193193
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
194194
70ea3768f1b3062b22d20644df41c86238157ec80dd43da40545c620714273c6 lib/core/target.py
@@ -208,7 +208,7 @@ c5b258be7485089fac9d9cd179960e774fbd85e62836dc67cce76cc028bb6aeb lib/parse/hand
208208
d2e771cdacef25ee3fdc0e0355b92e7cd1b68f5edc2756ffc19f75d183ba2c73 lib/parse/payloads.py
209209
455ab0ec63e55cd56ce4a884b85bdc089223155008cab0f3696da5a33118f95b lib/parse/sitemap.py
210210
1be3da334411657461421b8a26a0f2ff28e1af1e28f1e963c6c92768f9b0847c lib/request/basicauthhandler.py
211-
132abf563aeaaf0108b7e3932cfcc9680c8f445e992de4ee71ceed1ddf60bc29 lib/request/basic.py
211+
08e31008a089f8ff058afaccc06f42d6ca103408f9167cfb1831428e608374a4 lib/request/basic.py
212212
bc61bc944b81a7670884f82231033a6ac703324b34b071c9834886a92e249d0e lib/request/chunkedhandler.py
213213
09c2d8786fb5280f5f14a7b4345ecb2e7c2ca836ee06a6cf9b51770df923d94c lib/request/comparison.py
214214
9236db2abad1b1d368a3c5a5beb655055fd2445faba57a4172db264b06105bd4 lib/request/connect.py
@@ -573,10 +573,10 @@ f862301288d2ba2f913860bb901cd5197e72c0461e3330164f90375f713b8199 thirdparty/bot
573573
0ffccae46cb3a15b117acd0790b2738a5b45417d1b2822ceac57bdff10ef3bff thirdparty/chardet/big5freq.py
574574
901c476dd7ad0693deef1ae56fe7bdf748a8b7ae20fde1922dddf6941eff8773 thirdparty/chardet/big5prober.py
575575
df0a164bad8aac6a282b2ab3e334129e315b2696ba57b834d9d68089b4f0725f thirdparty/chardet/chardistribution.py
576-
e9b0eef1822246e49c5f871af4881bd14ebd4c0d8f1975c37a3e82738ffd90ee thirdparty/chardet/charsetgroupprober.py
576+
1992d17873fa151467e3786f48ea060b161a984acacf2a7a460390c55782de48 thirdparty/chardet/charsetgroupprober.py
577577
2929b0244ae3ca9ca3d1b459982e45e5e33b73c61080b6088d95e29ed64db2d8 thirdparty/chardet/charsetprober.py
578578
558a7fe9ccb2922e6c1e05c34999d75b8ab5a1e94773772ef40c904d7eeeba0f thirdparty/chardet/codingstatemachine.py
579-
3ca4f31e449bb5b1c3a92f4fcae8cc6d7ef8ab56bc98ca5e4130d5b10859311c thirdparty/chardet/compat.py
579+
e34cebeb0202670927c72b8b18670838fcaf7bc0d379b0426dbbedb6f9e6a794 thirdparty/chardet/compat.py
580580
4d9e37e105fccf306c9d4bcbffcc26e004154d9d9992a10440bfe5370f5ff68c thirdparty/chardet/cp949prober.py
581581
0229b075bf5ab357492996853541f63a158854155de9990927f58ae6c358f1c5 thirdparty/chardet/enums.py
582582
924caa560d58c370c8380309d9b765c9081415086e1c05bc7541ac913a0d5927 thirdparty/chardet/escprober.py
@@ -589,26 +589,25 @@ d77a7a10fe3245ac6a9cfe221edc47389e91db3c47ab5fe6f214d18f3559f797 thirdparty/cha
589589
257f25b3078a2e69c2c2693c507110b0b824affacffe411bbe2bc2e2a3ceae57 thirdparty/chardet/gb2312freq.py
590590
806bc85a2f568438c4fb14171ef348cab9cbbc46cc01883251267ae4751fca5c thirdparty/chardet/gb2312prober.py
591591
737499f8aee1bf2cc663a251019c4983027fb144bd93459892f318d34601605a thirdparty/chardet/hebrewprober.py
592-
62c3f9c1096c1c9d9ab85d516497f2a624ab080eff6d08919b7112fcd23bebe6 thirdparty/chardet/__init__.py
592+
99665a5a6bd9921c1f044013f4ed58ea74537cace14fb1478504d302e8dba940 thirdparty/chardet/__init__.py
593593
be9989bf606ed09f209cc5513c730579f4d1be8fe16b59abc8b8a0f0207080e8 thirdparty/chardet/jisfreq.py
594594
3d894da915104fc2ccddc4f91661c63f48a2b1c1654d6103f763002ef06e9e0a thirdparty/chardet/jpcntx.py
595-
d47a904bd3dbb678f5c508318ad24cbf0f17ea42abe4ea1c90d09959f110acf1 thirdparty/chardet/langbulgarianmodel.py
596-
2ce0da8efb1eb47f3bc980c340a0360942d7507f3bb48db6ddd85f8e1f59c7d7 thirdparty/chardet/langcyrillicmodel.py
597-
f18016edb53c6304896a9d2420949b3ccc35044ab31a35b3a9ca9fd168142800 thirdparty/chardet/langgreekmodel.py
598-
2529ea984e44eb6b432d33d3bcba50b20e6038c3b83db75646f57b02f91cd070 thirdparty/chardet/langhebrewmodel.py
599-
4616a96121b997465a3be555e056a7e6c5b4591190aa1c0133ad72c77cb1c8e0 thirdparty/chardet/langhungarianmodel.py
600-
f25d35ef71aefd6e86f26c6640e4c417896cd98744ec5c567f74244b11065c94 thirdparty/chardet/langthaimodel.py
601-
5b6d9e44d26ca88eae5807f05d22955969c27ab62aac8f1d6504e6fccd254459 thirdparty/chardet/langturkishmodel.py
595+
afab6f3ad3bc16a8676d6041e55e1ccdc9757d6338a41f651a259053ef20becc thirdparty/chardet/langbulgarianmodel.py
596+
d5c32edb05203c1f1b43645b5634782cdc020844e043e0f0a34120dbfb81d75b thirdparty/chardet/langgreekmodel.py
597+
bab3262471c85ed0b069602acb5cc463fe129b0c0dcedef7d1b0ceb635f3463b thirdparty/chardet/langhebrewmodel.py
598+
383022b2fa827deb3c07815ec8cfcf83d1d8dd90e7132682893e01c72ce873ac thirdparty/chardet/langhungarianmodel.py
599+
a69a0a3862fd38f763f40e025321bc478f336e75edf4c37559778261ea5aeac7 thirdparty/chardet/langthaimodel.py
600+
1f795d89c23fae196fd2bdd5169556b542fa5f7d16cb9f7abfbfd81f3dac11d8 thirdparty/chardet/langturkishmodel.py
602601
4b6228391845937f451053a54855ad815c9b4623fa87b0652e574755c94d914f thirdparty/chardet/latin1prober.py
603602
011f797851fdbeea927ef2d064df8be628de6b6e4d3810a85eac3cb393bdc4b4 thirdparty/chardet/mbcharsetprober.py
604603
87a4d19e762ad8ec46d56743e493b2c5c755a67edd1b4abebc1f275abe666e1e thirdparty/chardet/mbcsgroupprober.py
605604
498df6c15205dc7cdc8d8dc1684b29cbd99eb5b3522b120807444a3e7eed8e92 thirdparty/chardet/mbcssm.py
606-
2c34a90a5743085958c149069300f6a05c4b94f5885974f4f5a907ff63e263be thirdparty/chardet/sbcharsetprober.py
607-
d48a6b70207f935a9f9a7c460ba3016f110b94aa83dec716e92f1823075ec970 thirdparty/chardet/sbcsgroupprober.py
605+
9e6c8ccaec731bcec337a2b7464d8c53324b30b47af4cad6a5d9c7ccec155304 thirdparty/chardet/sbcharsetprober.py
606+
86a79f42e5e6885c83040ace8ee8c7ea177a5855e5383d64582b310e18f1e557 thirdparty/chardet/sbcsgroupprober.py
608607
208b7e9598f4589a8ae2b9946732993f8189944f0a504b45615b98f7a7a4e4c4 thirdparty/chardet/sjisprober.py
609-
a8bd35ef8952644e38d9e076d679e4b53f7f55c0327b4ee5685594794ae3b6d6 thirdparty/chardet/universaldetector.py
608+
0e96535c25f49d41d7c6443db2be06671181fe1bde67a856b77b8cf7872058ab thirdparty/chardet/universaldetector.py
610609
21d0fcbf7cd63ac07c38b8b23e2fb2fdfab08a9445c55f4d73578a04b4ae204c thirdparty/chardet/utf8prober.py
611-
b29dc1d3c9ab0d707ea5fdcaf5fa89ff37831ce08b0bc46b9e04320c56a9ffb8 thirdparty/chardet/version.py
610+
0380882c501df0c4551b51e85cfa78e622bd44b956c95ef76b512dc04f13be7f thirdparty/chardet/version.py
612611
1c1ee8a91eb20f8038ace6611610673243d0f71e2b7566111698462182c7efdd thirdparty/clientform/clientform.py
613612
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 thirdparty/clientform/__init__.py
614613
4e8a7811e12e69074159db5e28c11c18e4de29e175f50f96a3febf0a3e643b34 thirdparty/colorama/ansi.py

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.6.56"
23+
VERSION = "1.10.6.57"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,11 @@ def getHeuristicCharEncoding(page):
258258
259259
>>> getHeuristicCharEncoding(b"<html></html>")
260260
'ascii'
261+
>>> getHeuristicCharEncoding(b'<!DOCTYPE html><html><head><meta charset="windows-1251"><title>\\xd2\\xe5\\xf1\\xf2</title></head><body>\\xc2 \\xf1\\xee\\xee\\xf2\\xe2\\xe5\\xf2\\xf1\\xf2\\xe2\\xe8\\xe8 \\xf1 \\xef\\xf0\\xe8\\xed\\xf6\\xe8\\xef\\xe0\\xec\\xe8 \\xf0\\xe0\\xe1\\xee\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xe8\\xf6\\xe5 \\xe1\\xe0\\xb9\\xf2\\xee\\xe2. \\xca\\xee\\xe3\\xe4\\xe0 \\xf2\\xe5\\xea\\xf1\\xf2\\xe0 \\xf1\\xf2\\xe0\\xed\\xee\\xe2\\xe8\\xf2\\xf1\\xff \\xe4\\xee\\xf1\\xf2\\xe0\\xf2\\xee\\xf7\\xed\\xee \\xec\\xed\\xee\\xe3\\xee, \\xe2\\xe5\\xf0\\xee\\xff\\xf2\\xed\\xee\\xf1\\xf2\\xfc \\xee\\xf8\\xe8\\xe1\\xea\\xe8 \\xf1\\xed\\xe8\\xe6\\xe0\\xe5\\xf2\\xf1\\xff \\xef\\xf0\\xe0\\xea\\xf2\\xe8\\xf7\\xe5\\xf1\\xea\\xe8 \\xe4\\xee \\xed\\xf3\\xeb\\xff. \\xcc\\xfb \\xe4\\xee\\xe1\\xe0\\xe2\\xeb\\xff\\xe5\\xec \\xe5\\xf9\\xe5 \\xed\\xe5\\xf1\\xea\\xee\\xeb\\xfc\\xea\\xee \\xef\\xf0\\xe5\\xe4\\xeb\\xee\\xe6\\xe5\\xed\\xe8\\xb9, \\xf7\\xf2\\xee\\xf1\\xfb \\xf0\\xe0\\xf1\\xf8\\xe8\\xf0\\xe8\\xf2\\xfc \\xe2\\xfb\\xe1\\xee\\xf0\\xea\\xf3 \\xe4\\xe0\\xed\\xed\\xfb\\xf5 \\xe4\\xeb\\xff \\xea\\xee\\xf0\\xf0\\xe5\\xea\\xf2\\xed\\xee\\xe3\\xee \\xf2\\xe5\\xf1\\xf2\\xe8\\xf0\\xee\\xe2\\xe0\\xed\\xe8\\xff \\xe2\\xe0\\xf8\\xe5\\xb9 \\xe1\\xe8\\xe1\\xeb\\xe8\\xee\\xf2\\xe5\\xea\\xe8 \\xe2 \\xf1\\xf0\\xe5\\xe4\\xe5 Python.</body></html>')
262+
'windows-1251'
261263
"""
262264

263265
key = (len(page), hash(page))
264-
265266
retVal = kb.cache.encoding.get(key)
266267
if retVal is None:
267268
retVal = detect(page[:HEURISTIC_PAGE_SIZE_THRESHOLD])["encoding"]

thirdparty/chardet/__init__.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
######################### END LICENSE BLOCK #########################
1717

1818

19-
from .compat import PY2, PY3
2019
from .universaldetector import UniversalDetector
20+
from .enums import InputState
2121
from .version import __version__, VERSION
2222

2323

24+
__all__ = ['UniversalDetector', 'detect', 'detect_all', '__version__', 'VERSION']
25+
26+
2427
def detect(byte_str):
2528
"""
2629
Detect the encoding of the given byte string.
@@ -31,9 +34,50 @@ def detect(byte_str):
3134
if not isinstance(byte_str, bytearray):
3235
if not isinstance(byte_str, bytes):
3336
raise TypeError('Expected object of type bytes or bytearray, got: '
34-
'{0}'.format(type(byte_str)))
37+
'{}'.format(type(byte_str)))
3538
else:
3639
byte_str = bytearray(byte_str)
3740
detector = UniversalDetector()
3841
detector.feed(byte_str)
3942
return detector.close()
43+
44+
45+
def detect_all(byte_str):
46+
"""
47+
Detect all the possible encodings of the given byte string.
48+
49+
:param byte_str: The byte sequence to examine.
50+
:type byte_str: ``bytes`` or ``bytearray``
51+
"""
52+
if not isinstance(byte_str, bytearray):
53+
if not isinstance(byte_str, bytes):
54+
raise TypeError('Expected object of type bytes or bytearray, got: '
55+
'{}'.format(type(byte_str)))
56+
else:
57+
byte_str = bytearray(byte_str)
58+
59+
detector = UniversalDetector()
60+
detector.feed(byte_str)
61+
detector.close()
62+
63+
if detector._input_state == InputState.HIGH_BYTE:
64+
results = []
65+
for prober in detector._charset_probers:
66+
if prober.get_confidence() > detector.MINIMUM_THRESHOLD:
67+
charset_name = prober.charset_name
68+
lower_charset_name = prober.charset_name.lower()
69+
# Use Windows encoding name instead of ISO-8859 if we saw any
70+
# extra Windows-specific bytes
71+
if lower_charset_name.startswith('iso-8859'):
72+
if detector._has_win_bytes:
73+
charset_name = detector.ISO_WIN_MAP.get(lower_charset_name,
74+
charset_name)
75+
results.append({
76+
'encoding': charset_name,
77+
'confidence': prober.get_confidence(),
78+
'language': prober.language,
79+
})
80+
if len(results) > 0:
81+
return sorted(results, key=lambda result: -result['confidence'])
82+
83+
return [detector.result]

thirdparty/chardet/charsetgroupprober.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def feed(self, byte_str):
7373
continue
7474
if state == ProbingState.FOUND_IT:
7575
self._best_guess_prober = prober
76+
self._state = ProbingState.FOUND_IT
7677
return self.state
7778
elif state == ProbingState.NOT_ME:
7879
prober.active = False

thirdparty/chardet/compat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
if sys.version_info < (3, 0):
2626
PY2 = True
2727
PY3 = False
28-
base_str = (str, unicode)
28+
string_types = (str, unicode)
2929
text_type = unicode
30+
iteritems = dict.iteritems
3031
else:
3132
PY2 = False
3233
PY3 = True
33-
base_str = (bytes, str)
34+
string_types = (bytes, str)
3435
text_type = str
36+
iteritems = dict.items

0 commit comments

Comments
 (0)