cryptoparser 0.9.0__tar.gz → 0.9.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/CHANGELOG.rst +10 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1/CryptoParser.egg-info}/PKG-INFO +8 -2
- {cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/SOURCES.txt +6 -5
- {cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/requires.txt +3 -3
- {cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1}/PKG-INFO +8 -2
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/README.rst +6 -0
- CryptoParser-0.9.1/cryptoparser/__setup__.py +10 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/base.py +9 -6
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/parse.py +18 -9
- CryptoParser-0.9.1/cryptoparser/common/x509.py +101 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/extension.py +17 -9
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/requirements.txt +2 -1
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/setup.py +18 -22
- cryptoparser-0.9.0/cryptoparser/common/x509.py +0 -27
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/CONTRIBUTING.rst +0 -0
- {cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/dependency_links.txt +0 -0
- {cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/top_level.txt +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/LICENSE.txt +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/MANIFEST.in +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/__init__.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/__init__.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/classes.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/exception.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/key.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/common/utils.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/httpx/__init__.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/httpx/header.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/httpx/parse.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/httpx/version.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/ssh/__init__.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/ssh/key.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/ssh/record.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/ssh/subprotocol.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/ssh/version.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/__init__.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/algorithm.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/ciphersuite.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/grease.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/ldap.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/mysql.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/openvpn.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/postgresql.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/rdp.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/record.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/subprotocol.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/cryptoparser/tls/version.py +0 -0
- {cryptoparser-0.9.0 → CryptoParser-0.9.1}/setup.cfg +0 -0
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
0.9.1 - 2022-06-22
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
- TLS (``tls``)
|
|
8
|
+
|
|
9
|
+
- Generic
|
|
10
|
+
|
|
11
|
+
- add parser for `signed certificate timestamp <https://www.rfc-editor.org/rfc/rfc6962.html#section-3.3.1>`__
|
|
12
|
+
entries (#52)
|
|
13
|
+
|
|
4
14
|
0.9.0 - 2023-04-29
|
|
5
15
|
------------------
|
|
6
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.9.
|
|
2
|
+
Name: CryptoParser
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: Fast and flexible security protocol parser and generator
|
|
5
5
|
Author: Szilárd Pfeiffer
|
|
6
6
|
Author-email: coroner@pfeifferszilard.hu
|
|
@@ -88,3 +88,9 @@ The code is available under the terms of Mozilla Public License Version 2.0 (MPL
|
|
|
88
88
|
|
|
89
89
|
A non-comprehensive, but straightforward description of MPL 2.0 can be found at
|
|
90
90
|
`Choose an open source license <https://choosealicense.com/licenses#mpl-2.0>`__ website.
|
|
91
|
+
|
|
92
|
+
Credits
|
|
93
|
+
-------
|
|
94
|
+
|
|
95
|
+
- `NLnet Foundation <https://nlnet.nl>`__ and `NGI Assure <https://www.assure.ngi.eu>`__, supports the project part of
|
|
96
|
+
the `Next Generation Internet <https://ngi.eu>`__ initiative.
|
{cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/SOURCES.txt
RENAMED
|
@@ -5,12 +5,13 @@ MANIFEST.in
|
|
|
5
5
|
README.rst
|
|
6
6
|
requirements.txt
|
|
7
7
|
setup.py
|
|
8
|
+
CryptoParser.egg-info/PKG-INFO
|
|
9
|
+
CryptoParser.egg-info/SOURCES.txt
|
|
10
|
+
CryptoParser.egg-info/dependency_links.txt
|
|
11
|
+
CryptoParser.egg-info/requires.txt
|
|
12
|
+
CryptoParser.egg-info/top_level.txt
|
|
8
13
|
cryptoparser/__init__.py
|
|
9
|
-
cryptoparser.
|
|
10
|
-
cryptoparser.egg-info/SOURCES.txt
|
|
11
|
-
cryptoparser.egg-info/dependency_links.txt
|
|
12
|
-
cryptoparser.egg-info/requires.txt
|
|
13
|
-
cryptoparser.egg-info/top_level.txt
|
|
14
|
+
cryptoparser/__setup__.py
|
|
14
15
|
cryptoparser/common/__init__.py
|
|
15
16
|
cryptoparser/common/base.py
|
|
16
17
|
cryptoparser/common/classes.py
|
{cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/requires.txt
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
asn1crypto
|
|
2
|
-
|
|
2
|
+
attrs<22.0.1,>=19.1
|
|
3
|
+
cryptodatahub>=0.9.1
|
|
3
4
|
python-dateutil
|
|
4
5
|
python-dateutil
|
|
5
6
|
|
|
@@ -13,6 +14,7 @@ typing
|
|
|
13
14
|
enum34==1.1.6
|
|
14
15
|
pathlib2==2.3.7.post1
|
|
15
16
|
Mock
|
|
17
|
+
unittest2
|
|
16
18
|
|
|
17
19
|
[pep8]
|
|
18
20
|
flake8
|
|
@@ -21,6 +23,4 @@ flake8
|
|
|
21
23
|
pylint
|
|
22
24
|
|
|
23
25
|
[test]
|
|
24
|
-
unittest2
|
|
25
26
|
coverage
|
|
26
|
-
six
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.9.
|
|
2
|
+
Name: CryptoParser
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: Fast and flexible security protocol parser and generator
|
|
5
5
|
Author: Szilárd Pfeiffer
|
|
6
6
|
Author-email: coroner@pfeifferszilard.hu
|
|
@@ -88,3 +88,9 @@ The code is available under the terms of Mozilla Public License Version 2.0 (MPL
|
|
|
88
88
|
|
|
89
89
|
A non-comprehensive, but straightforward description of MPL 2.0 can be found at
|
|
90
90
|
`Choose an open source license <https://choosealicense.com/licenses#mpl-2.0>`__ website.
|
|
91
|
+
|
|
92
|
+
Credits
|
|
93
|
+
-------
|
|
94
|
+
|
|
95
|
+
- `NLnet Foundation <https://nlnet.nl>`__ and `NGI Assure <https://www.assure.ngi.eu>`__, supports the project part of
|
|
96
|
+
the `Next Generation Internet <https://ngi.eu>`__ initiative.
|
|
@@ -36,3 +36,9 @@ The code is available under the terms of Mozilla Public License Version 2.0 (MPL
|
|
|
36
36
|
|
|
37
37
|
A non-comprehensive, but straightforward description of MPL 2.0 can be found at
|
|
38
38
|
`Choose an open source license <https://choosealicense.com/licenses#mpl-2.0>`__ website.
|
|
39
|
+
|
|
40
|
+
Credits
|
|
41
|
+
-------
|
|
42
|
+
|
|
43
|
+
- `NLnet Foundation <https://nlnet.nl>`__ and `NGI Assure <https://www.assure.ngi.eu>`__, supports the project part of
|
|
44
|
+
the `Next Generation Internet <https://ngi.eu>`__ initiative.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
__title__ = 'CryptoParser'
|
|
4
|
+
__technical_name__ = __title__.lower()
|
|
5
|
+
__version__ = '0.9.1'
|
|
6
|
+
__description__ = 'Fast and flexible security protocol parser and generator'
|
|
7
|
+
__author__ = 'Szilárd Pfeiffer'
|
|
8
|
+
__author_email__ = 'coroner@pfeifferszilard.hu'
|
|
9
|
+
__url__ = 'https://gitlab.com/coroner/' + __technical_name__
|
|
10
|
+
__license__ = 'MPL-2.0'
|
|
@@ -81,7 +81,7 @@ class Serializable(object): # pylint: disable=too-few-public-methods
|
|
|
81
81
|
keys = sorted(filter(lambda key: not key.startswith('_'), dict_value.keys()))
|
|
82
82
|
|
|
83
83
|
result = OrderedDict([
|
|
84
|
-
(
|
|
84
|
+
(key, dict_value[key])
|
|
85
85
|
for key in keys
|
|
86
86
|
])
|
|
87
87
|
|
|
@@ -135,12 +135,13 @@ class Serializable(object): # pylint: disable=too-few-public-methods
|
|
|
135
135
|
name_dict = {}
|
|
136
136
|
fields_dict = attr.fields_dict(type(obj)) if attr.has(type(obj)) else {}
|
|
137
137
|
for name in dict_value:
|
|
138
|
-
if name
|
|
139
|
-
human_readable_name
|
|
138
|
+
if isinstance(name, six.string_types):
|
|
139
|
+
if name in fields_dict and 'human_readable_name' in fields_dict[name].metadata:
|
|
140
|
+
human_readable_name = fields_dict[name].metadata['human_readable_name']
|
|
141
|
+
else:
|
|
142
|
+
human_readable_name = ' '.join(name.split('_')).title()
|
|
140
143
|
else:
|
|
141
144
|
_, human_readable_name = cls._markdown_result(name)
|
|
142
|
-
if not human_readable_name.isupper():
|
|
143
|
-
human_readable_name = ' '.join(name.split('_')).title()
|
|
144
145
|
name_dict[name] = human_readable_name
|
|
145
146
|
|
|
146
147
|
return name_dict
|
|
@@ -192,7 +193,7 @@ class Serializable(object): # pylint: disable=too-few-public-methods
|
|
|
192
193
|
|
|
193
194
|
@staticmethod
|
|
194
195
|
def _markdown_is_directly_printable(obj):
|
|
195
|
-
return isinstance(obj, six.string_types + six.integer_types + (float, ))
|
|
196
|
+
return not isinstance(obj, enum.Enum) and isinstance(obj, six.string_types + six.integer_types + (float, ))
|
|
196
197
|
|
|
197
198
|
@classmethod
|
|
198
199
|
def _markdown_result(cls, obj, level=0):
|
|
@@ -211,6 +212,8 @@ class Serializable(object): # pylint: disable=too-few-public-methods
|
|
|
211
212
|
return False, str(obj.value)
|
|
212
213
|
|
|
213
214
|
return False, obj.name
|
|
215
|
+
elif hasattr(obj, '_asdict'):
|
|
216
|
+
result = cls._markdown_result(obj._asdict(), level)
|
|
214
217
|
elif hasattr(obj, '__dict__') or isinstance(obj, dict):
|
|
215
218
|
result = cls._markdown_result_complex(obj, level)
|
|
216
219
|
elif isinstance(obj, (list, tuple, set, ArrayBase)):
|
|
@@ -457,16 +457,21 @@ class ParserText(ParserBase):
|
|
|
457
457
|
class ParserBinary(ParserBase):
|
|
458
458
|
byte_order = attr.ib(default=ByteOrder.NETWORK, validator=attr.validators.in_(ByteOrder))
|
|
459
459
|
|
|
460
|
-
def parse_timestamp(self, name):
|
|
460
|
+
def parse_timestamp(self, name, milliseconds=False):
|
|
461
461
|
value, parsed_length = self._parse_numeric_array(name, 1, 8, int)
|
|
462
462
|
|
|
463
463
|
self._parsed_length += parsed_length
|
|
464
464
|
if value[0] == 0xffffffffffffffff:
|
|
465
465
|
self._parsed_values[name] = None
|
|
466
466
|
else:
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
value = value[0]
|
|
468
|
+
if milliseconds:
|
|
469
|
+
millis = value % 1000
|
|
470
|
+
value //= 1000
|
|
471
|
+
value = datetime.datetime.fromtimestamp(0x00000000ffffffff & value, dateutil.tz.UTC)
|
|
472
|
+
if milliseconds:
|
|
473
|
+
value += datetime.timedelta(milliseconds=millis)
|
|
474
|
+
self._parsed_values[name] = value
|
|
470
475
|
|
|
471
476
|
def _parse_numeric_array(self, name, item_num, item_size, item_numeric_class):
|
|
472
477
|
if self._parsed_length + (item_num * item_size) > len(self._parsable):
|
|
@@ -573,7 +578,7 @@ class ParserBinary(ParserBase):
|
|
|
573
578
|
def parse_raw(self, name, size):
|
|
574
579
|
parsed_bytes = self._parse_bytes(size)
|
|
575
580
|
|
|
576
|
-
self._parsed_values[name] = parsed_bytes
|
|
581
|
+
self._parsed_values[name] = bytearray(parsed_bytes)
|
|
577
582
|
self._parsed_length += size
|
|
578
583
|
|
|
579
584
|
def parse_string(self, name, item_size, encoding, converter=str):
|
|
@@ -782,13 +787,17 @@ class ComposerText(ComposerBase):
|
|
|
782
787
|
class ComposerBinary(ComposerBase):
|
|
783
788
|
byte_order = attr.ib(default=ByteOrder.NETWORK, validator=attr.validators.in_(ByteOrder))
|
|
784
789
|
|
|
785
|
-
def compose_timestamp(self, value):
|
|
790
|
+
def compose_timestamp(self, value, milliseconds=False):
|
|
786
791
|
if value is None:
|
|
787
|
-
|
|
792
|
+
timestamp = 0xffffffffffffffff
|
|
788
793
|
else:
|
|
789
|
-
|
|
794
|
+
timestamp = int(time.mktime(value.timetuple())) - time.timezone
|
|
795
|
+
|
|
796
|
+
if milliseconds:
|
|
797
|
+
timestamp *= 1000
|
|
798
|
+
timestamp += value.microsecond // 1000
|
|
790
799
|
|
|
791
|
-
return self._compose_numeric_array([
|
|
800
|
+
return self._compose_numeric_array([timestamp, ], 8)
|
|
792
801
|
|
|
793
802
|
def _compose_numeric_array(self, values, item_size):
|
|
794
803
|
composed_bytes = bytearray()
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
import enum
|
|
5
|
+
|
|
6
|
+
import attr
|
|
7
|
+
|
|
8
|
+
from cryptodatahub.common.stores import CertificateTransparencyLog, CertificateTransparencyLogParamsBase
|
|
9
|
+
|
|
10
|
+
from cryptoparser.common.base import (
|
|
11
|
+
Opaque,
|
|
12
|
+
OpaqueParam,
|
|
13
|
+
Serializable,
|
|
14
|
+
VectorParamParsable,
|
|
15
|
+
VectorParsable,
|
|
16
|
+
)
|
|
17
|
+
from cryptoparser.common.parse import ComposerBinary, ParsableBase, ParserBinary
|
|
18
|
+
|
|
19
|
+
from cryptoparser.tls.algorithm import TlsSignatureAndHashAlgorithm, TlsSignatureAndHashAlgorithmFactory
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CtExtensions(Opaque):
|
|
23
|
+
@classmethod
|
|
24
|
+
def get_param(cls):
|
|
25
|
+
return OpaqueParam(
|
|
26
|
+
min_byte_num=0,
|
|
27
|
+
max_byte_num=2 ** 16 - 1,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class CtSignature(Opaque):
|
|
32
|
+
@classmethod
|
|
33
|
+
def get_param(cls):
|
|
34
|
+
return OpaqueParam(
|
|
35
|
+
min_byte_num=0,
|
|
36
|
+
max_byte_num=2 ** 16 - 1,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class CtVersion(enum.IntEnum):
|
|
41
|
+
V1 = 0x00 # pylint: disable=invalid-name
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@attr.s
|
|
45
|
+
class SignedCertificateTimestamp(ParsableBase, Serializable):
|
|
46
|
+
version = attr.ib(validator=attr.validators.in_(CtVersion))
|
|
47
|
+
log = attr.ib(
|
|
48
|
+
converter=CertificateTransparencyLog.from_log_id,
|
|
49
|
+
validator=attr.validators.instance_of(CertificateTransparencyLogParamsBase)
|
|
50
|
+
)
|
|
51
|
+
timestamp = attr.ib(validator=attr.validators.instance_of(datetime.datetime))
|
|
52
|
+
extensions = attr.ib(
|
|
53
|
+
validator=attr.validators.deep_iterable(member_validator=attr.validators.instance_of(CtExtensions))
|
|
54
|
+
)
|
|
55
|
+
signature_algorithm = attr.ib(validator=attr.validators.in_(TlsSignatureAndHashAlgorithm))
|
|
56
|
+
signature = attr.ib(
|
|
57
|
+
converter=CtSignature,
|
|
58
|
+
validator=attr.validators.instance_of(CtSignature),
|
|
59
|
+
metadata={'human_friendly': False},
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def _parse(cls, parsable):
|
|
64
|
+
header_parser = ParserBinary(parsable)
|
|
65
|
+
header_parser.parse_bytes('sct', 2)
|
|
66
|
+
|
|
67
|
+
body_parser = ParserBinary(header_parser['sct'])
|
|
68
|
+
|
|
69
|
+
body_parser.parse_numeric('version', 1, CtVersion)
|
|
70
|
+
body_parser.parse_raw('log', 32)
|
|
71
|
+
body_parser.parse_timestamp('timestamp', milliseconds=True)
|
|
72
|
+
body_parser.parse_parsable('extensions', CtExtensions)
|
|
73
|
+
body_parser.parse_parsable('signature_algorithm', TlsSignatureAndHashAlgorithmFactory)
|
|
74
|
+
body_parser.parse_parsable('signature', CtSignature)
|
|
75
|
+
|
|
76
|
+
return cls(**body_parser), header_parser.parsed_length
|
|
77
|
+
|
|
78
|
+
def compose(self):
|
|
79
|
+
body_composer = ComposerBinary()
|
|
80
|
+
|
|
81
|
+
body_composer.compose_numeric(self.version, 1)
|
|
82
|
+
body_composer.compose_raw(self.log.log_id.value)
|
|
83
|
+
body_composer.compose_timestamp(self.timestamp, milliseconds=True)
|
|
84
|
+
body_composer.compose_parsable(self.extensions)
|
|
85
|
+
body_composer.compose_numeric_enum_coded(self.signature_algorithm)
|
|
86
|
+
body_composer.compose_parsable(self.signature)
|
|
87
|
+
|
|
88
|
+
header_composer = ComposerBinary()
|
|
89
|
+
header_composer.compose_numeric(len(body_composer.composed_bytes), 2)
|
|
90
|
+
|
|
91
|
+
return header_composer.composed_bytes + body_composer.composed_bytes
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class SignedCertificateTimestampList(VectorParsable):
|
|
95
|
+
@classmethod
|
|
96
|
+
def get_param(cls):
|
|
97
|
+
return VectorParamParsable(
|
|
98
|
+
item_class=SignedCertificateTimestamp,
|
|
99
|
+
fallback_class=None,
|
|
100
|
+
min_byte_num=0, max_byte_num=2 ** 16 - 1
|
|
101
|
+
)
|
|
@@ -685,9 +685,9 @@ class TlsCertificateStatusRequestResponderIdList(VectorParsable):
|
|
|
685
685
|
)
|
|
686
686
|
|
|
687
687
|
|
|
688
|
-
class
|
|
688
|
+
class TlsExtensionCertificateStatusRequestClient(TlsExtensionParsed):
|
|
689
689
|
def __init__(self, responder_id_list=(), extensions=()):
|
|
690
|
-
super(
|
|
690
|
+
super(TlsExtensionCertificateStatusRequestClient, self).__init__()
|
|
691
691
|
|
|
692
692
|
self.responder_id_list = TlsCertificateStatusRequestResponderIdList(responder_id_list)
|
|
693
693
|
self.request_extensions = TlsCertificateStatusRequestExtensions(extensions)
|
|
@@ -698,15 +698,13 @@ class TlsExtensionCertificateStatusRequest(TlsExtensionParsed):
|
|
|
698
698
|
|
|
699
699
|
@classmethod
|
|
700
700
|
def _parse(cls, parsable):
|
|
701
|
-
parser = super(
|
|
702
|
-
if parser['extension_length'] == 0:
|
|
703
|
-
return TlsExtensionCertificateStatusRequest(), parser.parsed_length
|
|
701
|
+
parser = super(TlsExtensionCertificateStatusRequestClient, cls)._parse_header(parsable)
|
|
704
702
|
|
|
705
703
|
parser.parse_numeric('status_type', 1, TlsCertificateStatusType)
|
|
706
704
|
parser.parse_parsable('responder_id_list', TlsCertificateStatusRequestResponderIdList)
|
|
707
705
|
parser.parse_parsable('extensions', TlsCertificateStatusRequestExtensions)
|
|
708
706
|
|
|
709
|
-
return
|
|
707
|
+
return cls(
|
|
710
708
|
parser['responder_id_list'],
|
|
711
709
|
parser['extensions'],
|
|
712
710
|
), parser.parsed_length
|
|
@@ -723,6 +721,12 @@ class TlsExtensionCertificateStatusRequest(TlsExtensionParsed):
|
|
|
723
721
|
return header_bytes + payload_composer.composed_bytes
|
|
724
722
|
|
|
725
723
|
|
|
724
|
+
class TlsExtensionCertificateStatusRequestServer(TlsExtensionUnusedData):
|
|
725
|
+
@classmethod
|
|
726
|
+
def get_extension_type(cls):
|
|
727
|
+
return TlsExtensionType.STATUS_REQUEST
|
|
728
|
+
|
|
729
|
+
|
|
726
730
|
class TlsRenegotiatedConnection(Opaque):
|
|
727
731
|
@classmethod
|
|
728
732
|
def get_param(cls):
|
|
@@ -1080,7 +1084,10 @@ class TlsExtensionSignedCertificateTimestampClient(TlsExtensionUnusedData):
|
|
|
1080
1084
|
|
|
1081
1085
|
@attr.s
|
|
1082
1086
|
class TlsExtensionSignedCertificateTimestampServer(TlsExtensionParsed):
|
|
1083
|
-
scts = attr.ib(
|
|
1087
|
+
scts = attr.ib(
|
|
1088
|
+
converter=SignedCertificateTimestampList,
|
|
1089
|
+
validator=attr.validators.optional(attr.validators.instance_of(SignedCertificateTimestampList))
|
|
1090
|
+
)
|
|
1084
1091
|
|
|
1085
1092
|
@classmethod
|
|
1086
1093
|
def get_extension_type(cls):
|
|
@@ -1167,7 +1174,7 @@ class TlsExtensionPadding(TlsExtensionParsed):
|
|
|
1167
1174
|
|
|
1168
1175
|
parser.parse_raw('padding', parser['extension_length'])
|
|
1169
1176
|
try:
|
|
1170
|
-
non_zero_int = next(byte for byte in
|
|
1177
|
+
non_zero_int = next(byte for byte in parser['padding'] if byte != 0)
|
|
1171
1178
|
raise InvalidValue(six.int2byte(non_zero_int), cls)
|
|
1172
1179
|
except StopIteration:
|
|
1173
1180
|
pass
|
|
@@ -1220,7 +1227,7 @@ class TlsExtensionVariantClient(TlsExtensionVariantBase):
|
|
|
1220
1227
|
(TlsExtensionType.PADDING, [TlsExtensionPadding, ]),
|
|
1221
1228
|
(TlsExtensionType.SERVER_NAME, [TlsExtensionServerNameClient, ]),
|
|
1222
1229
|
(TlsExtensionType.SESSION_TICKET, [TlsExtensionSessionTicket, ]),
|
|
1223
|
-
(TlsExtensionType.STATUS_REQUEST, [
|
|
1230
|
+
(TlsExtensionType.STATUS_REQUEST, [TlsExtensionCertificateStatusRequestClient, ]),
|
|
1224
1231
|
(TlsExtensionType.SUPPORTED_GROUPS, [TlsExtensionEllipticCurves, ]),
|
|
1225
1232
|
(TlsExtensionType.DELEGATED_CREDENTIALS, [TlsExtensionDelegatedCredentials, ]),
|
|
1226
1233
|
(TlsExtensionType.EC_POINT_FORMATS, [TlsExtensionECPointFormats, ]),
|
|
@@ -1254,5 +1261,6 @@ class TlsExtensionVariantServer(TlsExtensionVariantBase):
|
|
|
1254
1261
|
(TlsExtensionType.SERVER_NAME, [TlsExtensionServerNameServer, ]),
|
|
1255
1262
|
(TlsExtensionType.SESSION_TICKET, [TlsExtensionSessionTicket, ]),
|
|
1256
1263
|
(TlsExtensionType.SIGNED_CERTIFICATE_TIMESTAMP, [TlsExtensionSignedCertificateTimestampServer, ]),
|
|
1264
|
+
(TlsExtensionType.STATUS_REQUEST, [TlsExtensionCertificateStatusRequestServer, ]),
|
|
1257
1265
|
(TlsExtensionType.SUPPORTED_VERSIONS, [TlsExtensionSupportedVersionsServer, ]),
|
|
1258
1266
|
])
|
|
@@ -7,6 +7,9 @@ import unittest
|
|
|
7
7
|
|
|
8
8
|
from setuptools import setup
|
|
9
9
|
|
|
10
|
+
from cryptoparser import __setup__
|
|
11
|
+
|
|
12
|
+
|
|
10
13
|
this_directory = os.getenv('REQUIREMENTS_DIR', '')
|
|
11
14
|
with open(os.path.join(this_directory, 'requirements.txt')) as f:
|
|
12
15
|
install_requirements = f.read().splitlines()
|
|
@@ -15,13 +18,6 @@ with codecs.open(os.path.join(this_directory, 'README.rst'), encoding='utf-8') a
|
|
|
15
18
|
long_description = f.read()
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
test_requirements = [
|
|
19
|
-
"unittest2",
|
|
20
|
-
"coverage",
|
|
21
|
-
"six",
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
|
|
25
21
|
def test_discover():
|
|
26
22
|
test_loader = unittest.TestLoader()
|
|
27
23
|
test_suite = test_loader.discover('test', pattern='test_*.py')
|
|
@@ -29,23 +25,23 @@ def test_discover():
|
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
setup(
|
|
32
|
-
name=
|
|
33
|
-
version=
|
|
34
|
-
description=
|
|
28
|
+
name=__setup__.__title__,
|
|
29
|
+
version=__setup__.__version__,
|
|
30
|
+
description=__setup__.__description__,
|
|
35
31
|
long_description=long_description,
|
|
36
32
|
long_description_content_type='text/x-rst',
|
|
37
|
-
author=
|
|
38
|
-
author_email=
|
|
39
|
-
maintainer=
|
|
40
|
-
maintainer_email=
|
|
41
|
-
license=
|
|
33
|
+
author=__setup__.__author__,
|
|
34
|
+
author_email=__setup__.__author_email__,
|
|
35
|
+
maintainer=__setup__.__author__,
|
|
36
|
+
maintainer_email=__setup__.__author_email__,
|
|
37
|
+
license=__setup__.__license__,
|
|
42
38
|
license_files=['LICENSE.txt', ],
|
|
43
39
|
project_urls={
|
|
44
|
-
'Homepage':
|
|
45
|
-
'Changelog': 'https://
|
|
46
|
-
'Documentation': 'https://
|
|
47
|
-
'Issues': '
|
|
48
|
-
'Source':
|
|
40
|
+
'Homepage': __setup__.__url__,
|
|
41
|
+
'Changelog': 'https://' + __setup__.__technical_name__ + '.readthedocs.io/en/latest/changelog',
|
|
42
|
+
'Documentation': 'https://' + __setup__.__technical_name__ + '.readthedocs.io/en/latest/',
|
|
43
|
+
'Issues': __setup__.__url__ + '/-/issues',
|
|
44
|
+
'Source': __setup__.__url__,
|
|
49
45
|
},
|
|
50
46
|
keywords='ssl tls gost ja3 ldap rdp ssh hsts',
|
|
51
47
|
|
|
@@ -55,9 +51,9 @@ setup(
|
|
|
55
51
|
"enum34==1.1.6",
|
|
56
52
|
"pathlib2==2.3.7.post1",
|
|
57
53
|
"Mock",
|
|
54
|
+
"unittest2",
|
|
58
55
|
],
|
|
59
|
-
|
|
60
|
-
"test": test_requirements,
|
|
56
|
+
"test": ["coverage", ],
|
|
61
57
|
"pep8": ["flake8", ],
|
|
62
58
|
"pylint": ["pylint", ],
|
|
63
59
|
},
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
from cryptoparser.common.base import (
|
|
4
|
-
Opaque,
|
|
5
|
-
OpaqueParam,
|
|
6
|
-
VectorParamParsable,
|
|
7
|
-
VectorParsable,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class SerializedSCT(Opaque):
|
|
12
|
-
@classmethod
|
|
13
|
-
def get_param(cls):
|
|
14
|
-
return OpaqueParam(
|
|
15
|
-
min_byte_num=1,
|
|
16
|
-
max_byte_num=2 ** 16 - 1,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class SignedCertificateTimestampList(VectorParsable):
|
|
21
|
-
@classmethod
|
|
22
|
-
def get_param(cls):
|
|
23
|
-
return VectorParamParsable(
|
|
24
|
-
item_class=SerializedSCT,
|
|
25
|
-
fallback_class=None,
|
|
26
|
-
min_byte_num=0, max_byte_num=2 ** 16 - 1
|
|
27
|
-
)
|
|
File without changes
|
|
File without changes
|
{cryptoparser-0.9.0/cryptoparser.egg-info → CryptoParser-0.9.1/CryptoParser.egg-info}/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|