CryptoParser 1.3.0__tar.gz → 1.4.0__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-1.3.0 → cryptoparser-1.4.0}/.gitignore +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/.gitlab-ci.yml +21 -15
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/.pylintrc +1 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CHANGELOG.rst +23 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CryptoParser.egg-info/PKG-INFO +2 -3
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CryptoParser.egg-info/SOURCES.txt +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CryptoParser.egg-info/requires.txt +1 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CryptoParser.egg-info/top_level.txt +1 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/PKG-INFO +2 -3
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/__setup__.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/base.py +7 -8
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/classes.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/exception.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/field.py +1 -2
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/parse.py +7 -8
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/utils.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/x509.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/dnsrec/record.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/dnsrec/txt.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/httpx/parse.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/httpx/version.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ike/ikev1.py +5 -5
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ike/ikev2.py +139 -6
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ike/isakmp.py +21 -7
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ssh/key.py +5 -6
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ssh/record.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ssh/subprotocol.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ssh/version.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/algorithm.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/ciphersuite.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/extension.py +19 -20
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/grease.py +1 -2
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/ldap.py +1 -2
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/mysql.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/openvpn.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/postgresql.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/rdp.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/record.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/subprotocol.py +7 -8
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/version.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser.spec +16 -3
- cryptoparser-1.4.0/debian/changelog +31 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/debian/rules +1 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/docs/features.rst +1 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/pyproject.toml +7 -32
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/classes.py +10 -11
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_algorithm.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_base.py +3 -4
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_classes.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_exception.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_field.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_parse.py +2 -3
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_utils.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/test_x509.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/dnsrec/test_record.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/dnsrec/test_txt.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/httpx/classes.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/httpx/test_version.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/classes.py +68 -4
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/test_ikev1_payload.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/test_ikev1_sa.py +0 -1
- cryptoparser-1.4.0/test/ike/test_ikev2_notify.py +667 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/test_ikev2_payload.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/test_ikev2_sa.py +9 -10
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/test_isakmp.py +42 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/test_version.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ssh/test_ciphersuites.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ssh/test_key.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ssh/test_record.py +1 -2
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ssh/test_subprotocol.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ssh/test_version.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/classes.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_alert.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_application_data.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_change_cipher_spec.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_ciphersuite.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_extension.py +1 -2
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_grease.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_handshake.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_ldap.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_mysql.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_openvpn.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_postgresql.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_rdp.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_record.py +0 -1
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/test_version.py +0 -1
- cryptoparser-1.3.0/.flake8 +0 -2
- cryptoparser-1.3.0/debian/changelog +0 -15
- cryptoparser-1.3.0/test/ike/test_ikev2_notify.py +0 -376
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/.coveragerc +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/.gitmodules +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/.readthedocs.yaml +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CONTRIBUTING.rst +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/CryptoParser.egg-info/dependency_links.txt +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/LICENSE.txt +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/MANIFEST.in +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/README.rst +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/common/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/dnsrec/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/httpx/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/httpx/header.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ike/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ike/common.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ike/version.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/ssh/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/cryptoparser/tls/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/debian/control +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/debian/copyright +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/debian/source/format +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/debian/watch +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/docs/.gitignore +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/docs/changelog.rst +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/docs/conf.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/docs/development.rst +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/docs/index.rst +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/setup.cfg +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/setup.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/certs/ecc256.badssl.com.pem +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/certs/rsa8192.badssl.com.pem +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/certs/rsa8192.badssl.com_certificate.crt +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/certs/rsa8192.badssl.com_root_ca.crt +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/common/certs/snakeoil_cert.pem +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/dnsrec/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/httpx/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/httpx/test_header.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ike/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/ssh/__init__.py +0 -0
- {cryptoparser-1.3.0 → cryptoparser-1.4.0}/test/tls/__init__.py +0 -0
|
@@ -6,62 +6,70 @@ stages:
|
|
|
6
6
|
- deploy
|
|
7
7
|
|
|
8
8
|
before_script:
|
|
9
|
-
- pip install
|
|
9
|
+
- pip install uv
|
|
10
|
+
- uv pip install --system .[tests]
|
|
10
11
|
|
|
11
12
|
variables:
|
|
12
13
|
GIT_SUBMODULE_DEPTH: 1
|
|
13
14
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
14
15
|
PYTHONPATH: "submodules/cryptodatahub"
|
|
15
16
|
|
|
17
|
+
.test:
|
|
18
|
+
script:
|
|
19
|
+
- coverage run -m unittest discover -v
|
|
20
|
+
- coverage report
|
|
21
|
+
|
|
16
22
|
pylint:
|
|
17
23
|
image: python:3.14-slim
|
|
18
24
|
stage: earlytest
|
|
19
|
-
script:
|
|
25
|
+
script:
|
|
26
|
+
- uv pip install --system pylint
|
|
27
|
+
- pylint --rcfile .pylintrc cryptoparser docs test
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
ruff:
|
|
22
30
|
image: python:3.14-slim
|
|
23
31
|
stage: earlytest
|
|
24
|
-
script:
|
|
32
|
+
script: uvx ruff check cryptoparser docs test
|
|
25
33
|
|
|
26
34
|
python314:
|
|
35
|
+
extends: .test
|
|
27
36
|
image: python:3.14-slim
|
|
28
37
|
stage: earlytest
|
|
29
|
-
script: tox -e py314
|
|
30
38
|
|
|
31
39
|
python39:
|
|
40
|
+
extends: .test
|
|
32
41
|
image: python:3.9-slim
|
|
33
42
|
stage: fulltest
|
|
34
|
-
script: tox -e py39
|
|
35
43
|
|
|
36
44
|
python310:
|
|
45
|
+
extends: .test
|
|
37
46
|
image: python:3.10-slim
|
|
38
47
|
stage: fulltest
|
|
39
|
-
script: tox -e py310
|
|
40
48
|
|
|
41
49
|
python311:
|
|
50
|
+
extends: .test
|
|
42
51
|
image: python:3.11-slim
|
|
43
52
|
stage: fulltest
|
|
44
|
-
script: tox -e py311
|
|
45
53
|
|
|
46
54
|
python312:
|
|
55
|
+
extends: .test
|
|
47
56
|
image: python:3.12-slim
|
|
48
57
|
stage: fulltest
|
|
49
|
-
script: tox -e py312
|
|
50
58
|
|
|
51
59
|
python313:
|
|
60
|
+
extends: .test
|
|
52
61
|
image: python:3.13-slim
|
|
53
62
|
stage: fulltest
|
|
54
|
-
script: tox -e py313
|
|
55
63
|
|
|
56
64
|
pythonrc:
|
|
65
|
+
extends: .test
|
|
57
66
|
image: python:3.15-rc-slim
|
|
58
67
|
stage: fulltest
|
|
59
|
-
script: tox -e py315
|
|
60
68
|
|
|
61
69
|
pypy3:
|
|
70
|
+
extends: .test
|
|
62
71
|
image: pypy:3-slim
|
|
63
72
|
stage: fulltest
|
|
64
|
-
script: tox -e pypy3
|
|
65
73
|
|
|
66
74
|
coveralls:
|
|
67
75
|
image: python:3.12-slim
|
|
@@ -75,9 +83,7 @@ coveralls:
|
|
|
75
83
|
PYTHONPATH: "submodules/cryptodatahub"
|
|
76
84
|
stage: deploy
|
|
77
85
|
script:
|
|
78
|
-
- pip install coveralls
|
|
79
|
-
- pip install .
|
|
80
|
-
- pip install .[tests]
|
|
86
|
+
- uv pip install --system coveralls
|
|
81
87
|
- coverage run -m unittest -v -f
|
|
82
88
|
- coveralls
|
|
83
89
|
only:
|
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
=========
|
|
4
4
|
|
|
5
|
+
------------------
|
|
6
|
+
1.4.0 - 2026-07-17
|
|
7
|
+
------------------
|
|
8
|
+
|
|
9
|
+
Features
|
|
10
|
+
========
|
|
11
|
+
|
|
12
|
+
- IKE (``ike``)
|
|
13
|
+
|
|
14
|
+
- add getter for multiple payloads with the same type (#93)
|
|
15
|
+
- add IKEv2 notify payload parsing for protocol extensions (#93)
|
|
16
|
+
|
|
17
|
+
- NAT detection source IP and destination IP
|
|
18
|
+
- set window size
|
|
19
|
+
- use transport mode
|
|
20
|
+
- HTTP certificate lookup supported
|
|
21
|
+
- signature hash algorithms
|
|
22
|
+
- intermediate exchange supported
|
|
23
|
+
- use PPK
|
|
24
|
+
- redirect supported
|
|
25
|
+
- IKEv2 fragmentation supported
|
|
26
|
+
- childless IKEv2 supported
|
|
27
|
+
|
|
5
28
|
------------------
|
|
6
29
|
1.3.0 - 2026-06-15
|
|
7
30
|
------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CryptoParser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: An analysis oriented security protocol parser and generator
|
|
5
5
|
Author-email: Szilárd Pfeiffer <coroner@pfeifferszilard.hu>
|
|
6
6
|
Maintainer-email: Szilárd Pfeiffer <coroner@pfeifferszilard.hu>
|
|
@@ -13,7 +13,6 @@ Project-URL: Source, https://gitlab.com/coroner/cryptoparser
|
|
|
13
13
|
Keywords: ssl,tls,gost,ja3,ldap,rdp,ssh,hsts,dns,ike
|
|
14
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
15
15
|
Classifier: Environment :: Console
|
|
16
|
-
Classifier: Framework :: tox
|
|
17
16
|
Classifier: Intended Audience :: Information Technology
|
|
18
17
|
Classifier: Intended Audience :: Science/Research
|
|
19
18
|
Classifier: Intended Audience :: System Administrators
|
|
@@ -40,7 +39,7 @@ Description-Content-Type: text/x-rst
|
|
|
40
39
|
License-File: LICENSE.txt
|
|
41
40
|
Requires-Dist: asn1crypto
|
|
42
41
|
Requires-Dist: attrs
|
|
43
|
-
Requires-Dist: cryptodatahub==1.
|
|
42
|
+
Requires-Dist: cryptodatahub==1.4.0
|
|
44
43
|
Requires-Dist: urllib3
|
|
45
44
|
Provides-Extra: tests
|
|
46
45
|
Requires-Dist: pyfakefs; extra == "tests"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CryptoParser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: An analysis oriented security protocol parser and generator
|
|
5
5
|
Author-email: Szilárd Pfeiffer <coroner@pfeifferszilard.hu>
|
|
6
6
|
Maintainer-email: Szilárd Pfeiffer <coroner@pfeifferszilard.hu>
|
|
@@ -13,7 +13,6 @@ Project-URL: Source, https://gitlab.com/coroner/cryptoparser
|
|
|
13
13
|
Keywords: ssl,tls,gost,ja3,ldap,rdp,ssh,hsts,dns,ike
|
|
14
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
15
15
|
Classifier: Environment :: Console
|
|
16
|
-
Classifier: Framework :: tox
|
|
17
16
|
Classifier: Intended Audience :: Information Technology
|
|
18
17
|
Classifier: Intended Audience :: Science/Research
|
|
19
18
|
Classifier: Intended Audience :: System Administrators
|
|
@@ -40,7 +39,7 @@ Description-Content-Type: text/x-rst
|
|
|
40
39
|
License-File: LICENSE.txt
|
|
41
40
|
Requires-Dist: asn1crypto
|
|
42
41
|
Requires-Dist: attrs
|
|
43
|
-
Requires-Dist: cryptodatahub==1.
|
|
42
|
+
Requires-Dist: cryptodatahub==1.4.0
|
|
44
43
|
Requires-Dist: urllib3
|
|
45
44
|
Provides-Extra: tests
|
|
46
45
|
Requires-Dist: pyfakefs; extra == "tests"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# pylint: disable=too-many-lines
|
|
4
3
|
|
|
5
4
|
import abc
|
|
@@ -14,7 +13,7 @@ import ipaddress
|
|
|
14
13
|
try:
|
|
15
14
|
from collections.abc import MutableSequence # only works on python 3.3+
|
|
16
15
|
except ImportError: # pragma: no cover
|
|
17
|
-
from collections import MutableSequence # pylint: disable=deprecated-class
|
|
16
|
+
from collections.abc import MutableSequence # pylint: disable=deprecated-class
|
|
18
17
|
|
|
19
18
|
from collections import OrderedDict
|
|
20
19
|
|
|
@@ -49,7 +48,7 @@ _default.default = json.JSONEncoder().default
|
|
|
49
48
|
json.JSONEncoder.default = _default
|
|
50
49
|
|
|
51
50
|
|
|
52
|
-
class SerializableTextEncoder
|
|
51
|
+
class SerializableTextEncoder:
|
|
53
52
|
def __call__(self, obj, level):
|
|
54
53
|
if isinstance(obj, str):
|
|
55
54
|
string_result = obj
|
|
@@ -59,7 +58,7 @@ class SerializableTextEncoder():
|
|
|
59
58
|
return False, string_result
|
|
60
59
|
|
|
61
60
|
|
|
62
|
-
class Serializable
|
|
61
|
+
class Serializable: # pylint: disable=too-few-public-methods
|
|
63
62
|
_MARKDOWN_RESULT_STRING_CLASSES = (
|
|
64
63
|
ipaddress.IPv4Network,
|
|
65
64
|
ipaddress.IPv6Network,
|
|
@@ -367,7 +366,7 @@ class VariantParsableExact(VariantParsableBase):
|
|
|
367
366
|
|
|
368
367
|
|
|
369
368
|
@attr.s
|
|
370
|
-
class VectorParamBase
|
|
369
|
+
class VectorParamBase: # pylint: disable=too-few-public-methods
|
|
371
370
|
min_byte_num = attr.ib(validator=attr.validators.instance_of(int))
|
|
372
371
|
max_byte_num = attr.ib(validator=attr.validators.instance_of(int))
|
|
373
372
|
item_num_size = attr.ib(init=False, validator=attr.validators.instance_of(int))
|
|
@@ -863,7 +862,7 @@ class StringEnumParsableBase(ParsableBaseNoABC):
|
|
|
863
862
|
return self._asdict().encode('ascii')
|
|
864
863
|
|
|
865
864
|
def _asdict(self):
|
|
866
|
-
return
|
|
865
|
+
return self.value.code
|
|
867
866
|
|
|
868
867
|
|
|
869
868
|
class StringEnumParsable(StringEnumParsableBase):
|
|
@@ -946,7 +945,7 @@ class ProtocolVersionMajorMinorBase(ProtocolVersionBase):
|
|
|
946
945
|
|
|
947
946
|
|
|
948
947
|
@attr.s
|
|
949
|
-
class ListParamParsable
|
|
948
|
+
class ListParamParsable: # pylint: disable=too-few-public-methods
|
|
950
949
|
item_class = attr.ib(validator=attr.validators.instance_of(type))
|
|
951
950
|
fallback_class = attr.ib(validator=attr.validators.optional(attr.validators.instance_of(type)))
|
|
952
951
|
separator_class = attr.ib(attr.validators.instance_of(ParsableBase))
|
|
@@ -994,7 +993,7 @@ class ListParsable(ArrayBase):
|
|
|
994
993
|
class OpaqueEnumParsable(Vector):
|
|
995
994
|
@classmethod
|
|
996
995
|
def _parse(cls, parsable):
|
|
997
|
-
opaque, parsed_length = super(
|
|
996
|
+
opaque, parsed_length = super()._parse(parsable)
|
|
998
997
|
code = b''.join([bytes((opaque_item,)) for opaque_item in opaque]).decode(cls.get_encoding())
|
|
999
998
|
|
|
1000
999
|
try:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# pylint: disable=too-many-lines
|
|
4
3
|
|
|
5
4
|
import abc
|
|
@@ -540,7 +539,7 @@ class FieldValueComponentPercent(FieldValueComponentNumber):
|
|
|
540
539
|
|
|
541
540
|
|
|
542
541
|
@attr.s
|
|
543
|
-
class FieldValueComponentStringEnumParams
|
|
542
|
+
class FieldValueComponentStringEnumParams:
|
|
544
543
|
code = attr.ib(validator=attr.validators.instance_of(str))
|
|
545
544
|
|
|
546
545
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
# pylint: disable=too-many-lines
|
|
4
3
|
|
|
5
4
|
import abc
|
|
@@ -19,7 +18,7 @@ from cryptoparser.common.exception import InvalidType, NotEnoughData, TooMuchDat
|
|
|
19
18
|
import cryptoparser.common.utils
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
class ParsableBaseNoABC
|
|
21
|
+
class ParsableBaseNoABC:
|
|
23
22
|
@classmethod
|
|
24
23
|
def parse_mutable(cls, parsable):
|
|
25
24
|
parsed_object, parsed_length = cls._parse(parsable)
|
|
@@ -96,7 +95,7 @@ class ParserBase(collections.abc.Mapping):
|
|
|
96
95
|
validator=attr.validators.instance_of((bytes, bytearray))
|
|
97
96
|
)
|
|
98
97
|
_parsed_length: int = attr.ib(init=False, default=0)
|
|
99
|
-
_parsed_values:
|
|
98
|
+
_parsed_values: dict[str, typing.Any] = attr.ib(init=False, default=None)
|
|
100
99
|
|
|
101
100
|
def __attrs_post_init__(self):
|
|
102
101
|
if self._parsed_values is None:
|
|
@@ -165,7 +164,7 @@ class ParserBase(collections.abc.Mapping):
|
|
|
165
164
|
value = self._parsable[self._parsed_length:self._parsed_length + parsable_length]
|
|
166
165
|
try:
|
|
167
166
|
value = value.decode(encoding)
|
|
168
|
-
if converter
|
|
167
|
+
if converter is not str:
|
|
169
168
|
value = converter(value)
|
|
170
169
|
self._parsed_values[name] = value
|
|
171
170
|
except UnicodeError as e:
|
|
@@ -760,8 +759,8 @@ class ParserBinary(ParserBase):
|
|
|
760
759
|
|
|
761
760
|
|
|
762
761
|
@attr.s
|
|
763
|
-
class ComposerBase
|
|
764
|
-
_composed = attr.ib(init=False, default=
|
|
762
|
+
class ComposerBase:
|
|
763
|
+
_composed = attr.ib(init=False, default=b'')
|
|
765
764
|
|
|
766
765
|
@property
|
|
767
766
|
def composed(self):
|
|
@@ -795,7 +794,7 @@ class ComposerText(ComposerBase):
|
|
|
795
794
|
self._encoding = encoding
|
|
796
795
|
|
|
797
796
|
def _compose_numeric_array(self, values, separator):
|
|
798
|
-
composed_str =
|
|
797
|
+
composed_str = ''
|
|
799
798
|
|
|
800
799
|
for value in values:
|
|
801
800
|
composed_str += f'{value:d}{separator}'
|
|
@@ -969,7 +968,7 @@ class ComposerBinary(ComposerBase):
|
|
|
969
968
|
self.compose_numeric(len(composed), item_size)
|
|
970
969
|
self._composed += composed
|
|
971
970
|
|
|
972
|
-
def compose_parsable_array(self, values, separator=
|
|
971
|
+
def compose_parsable_array(self, values, separator=b''):
|
|
973
972
|
self._composed += separator.join(map(lambda item: item.compose(), values))
|
|
974
973
|
|
|
975
974
|
def compose_bytes(self, value, item_size, converter=bytearray):
|
|
@@ -226,7 +226,7 @@ class Ikev1PayloadTransform(Ikev1PayloadBase):
|
|
|
226
226
|
"""
|
|
227
227
|
|
|
228
228
|
transform_id: Ikev1TransformId = attr.ib(validator=attr.validators.instance_of(Ikev1TransformId))
|
|
229
|
-
attributes:
|
|
229
|
+
attributes: list[DataAttributeBase] = attr.ib(
|
|
230
230
|
validator=attr.validators.deep_iterable(
|
|
231
231
|
member_validator=attr.validators.instance_of(DataAttributeBase),
|
|
232
232
|
)
|
|
@@ -310,10 +310,10 @@ class Ikev1PayloadProposal(Ikev1PayloadBase):
|
|
|
310
310
|
"""
|
|
311
311
|
|
|
312
312
|
protocol_id: Ikev1ProtocolId = attr.ib(validator=attr.validators.instance_of(Ikev1ProtocolId))
|
|
313
|
-
transforms:
|
|
313
|
+
transforms: list[Ikev1PayloadTransform] = attr.ib(validator=attr.validators.deep_iterable(
|
|
314
314
|
member_validator=attr.validators.instance_of(Ikev1PayloadTransform),
|
|
315
315
|
))
|
|
316
|
-
spi: bytes = attr.ib(default=
|
|
316
|
+
spi: bytes = attr.ib(default=b'', converter=bytes, validator=attr.validators.instance_of(bytes))
|
|
317
317
|
next_payload: typing.Optional[Ikev1PayloadType] = attr.ib(
|
|
318
318
|
init=False,
|
|
319
319
|
default=None,
|
|
@@ -409,10 +409,10 @@ class Ikev1PayloadSecurityAssociation(Ikev1PayloadBase):
|
|
|
409
409
|
"""
|
|
410
410
|
|
|
411
411
|
doi: Ikev1Doi = attr.ib(validator=attr.validators.instance_of(Ikev1Doi))
|
|
412
|
-
situation:
|
|
412
|
+
situation: list[Ikev1Situation] = attr.ib(validator=attr.validators.deep_iterable(
|
|
413
413
|
member_validator=attr.validators.instance_of(Ikev1Situation),
|
|
414
414
|
))
|
|
415
|
-
proposals:
|
|
415
|
+
proposals: list[Ikev1PayloadProposal] = attr.ib(validator=attr.validators.deep_iterable(
|
|
416
416
|
member_validator=attr.validators.instance_of(Ikev1PayloadProposal),
|
|
417
417
|
))
|
|
418
418
|
|
|
@@ -57,7 +57,7 @@ class Ikev2PayloadBase(ParsableBase):
|
|
|
57
57
|
"""
|
|
58
58
|
HEADER_SIZE = 4
|
|
59
59
|
|
|
60
|
-
flags:
|
|
60
|
+
flags: set[Ikev2PayloadFlags] = attr.ib(
|
|
61
61
|
validator=attr.validators.deep_iterable(
|
|
62
62
|
member_validator=attr.validators.instance_of(Ikev2PayloadFlags),
|
|
63
63
|
)
|
|
@@ -474,10 +474,10 @@ class Ikev2Proposal(ParsableBase):
|
|
|
474
474
|
HEADER_SIZE = 8
|
|
475
475
|
|
|
476
476
|
protocol_id: Ikev2ProtocolId = attr.ib(validator=attr.validators.instance_of(Ikev2ProtocolId))
|
|
477
|
-
transforms:
|
|
477
|
+
transforms: list[Transform] = attr.ib(validator=attr.validators.deep_iterable(
|
|
478
478
|
member_validator=attr.validators.instance_of(Transform)
|
|
479
479
|
))
|
|
480
|
-
spi: bytes = attr.ib(default=
|
|
480
|
+
spi: bytes = attr.ib(default=b'', converter=bytes, validator=attr.validators.instance_of(bytes))
|
|
481
481
|
last: typing.Optional[Ikev2ProposalNextPayload] = attr.ib(
|
|
482
482
|
init=False,
|
|
483
483
|
default=None,
|
|
@@ -579,7 +579,7 @@ class Ikev2PayloadSecurityAssociation(Ikev2PayloadBase):
|
|
|
579
579
|
| |
|
|
580
580
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
581
581
|
"""
|
|
582
|
-
proposals:
|
|
582
|
+
proposals: list[Ikev2Proposal] = attr.ib(validator=attr.validators.deep_iterable(
|
|
583
583
|
member_validator=attr.validators.instance_of(Ikev2Proposal)
|
|
584
584
|
))
|
|
585
585
|
|
|
@@ -777,7 +777,7 @@ class Ikev2PayloadDelete(Ikev2PayloadBase):
|
|
|
777
777
|
:ivar spis: List of Security Parameter Indexes
|
|
778
778
|
"""
|
|
779
779
|
protocol_id: Ikev2ProtocolId = attr.ib(validator=attr.validators.instance_of(Ikev2ProtocolId))
|
|
780
|
-
spis:
|
|
780
|
+
spis: list[int] = attr.ib(validator=attr.validators.deep_iterable(
|
|
781
781
|
member_validator=attr.validators.instance_of(int),
|
|
782
782
|
))
|
|
783
783
|
|
|
@@ -889,7 +889,7 @@ class Ikev2PayloadNotifyBase(Ikev2PayloadBase):
|
|
|
889
889
|
parser.parse_raw('spi', parser['spi_size'])
|
|
890
890
|
spi = parser['spi']
|
|
891
891
|
else:
|
|
892
|
-
spi =
|
|
892
|
+
spi = b''
|
|
893
893
|
|
|
894
894
|
del parser['spi_size']
|
|
895
895
|
if 'spi' in parser:
|
|
@@ -954,6 +954,48 @@ class Ikev2PayloadNotifyAuthenticationFailed(Ikev2PayloadNotifyNoData):
|
|
|
954
954
|
return Ikev2NotifyType.AUTHENTICATION_FAILED
|
|
955
955
|
|
|
956
956
|
|
|
957
|
+
class Ikev2NotifyPayloadUseTransportMode(Ikev2PayloadNotifyNoData):
|
|
958
|
+
@classmethod
|
|
959
|
+
def _get_message_type(cls):
|
|
960
|
+
return Ikev2NotifyType.USE_TRANSPORT_MODE
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
class Ikev2NotifyPayloadHttpCertLookupSupported(Ikev2PayloadNotifyNoData):
|
|
964
|
+
@classmethod
|
|
965
|
+
def _get_message_type(cls):
|
|
966
|
+
return Ikev2NotifyType.HTTP_CERT_LOOKUP_SUPPORTED
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
class Ikev2NotifyPayloadIkev2FragmentationSupported(Ikev2PayloadNotifyNoData):
|
|
970
|
+
@classmethod
|
|
971
|
+
def _get_message_type(cls):
|
|
972
|
+
return Ikev2NotifyType.IKEV2_FRAGMENTATION_SUPPORTED
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
class Ikev2NotifyPayloadIntermediateExchangeSupported(Ikev2PayloadNotifyNoData):
|
|
976
|
+
@classmethod
|
|
977
|
+
def _get_message_type(cls):
|
|
978
|
+
return Ikev2NotifyType.INTERMEDIATE_EXCHANGE_SUPPORTED
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
class Ikev2NotifyPayloadUsePpk(Ikev2PayloadNotifyNoData):
|
|
982
|
+
@classmethod
|
|
983
|
+
def _get_message_type(cls):
|
|
984
|
+
return Ikev2NotifyType.USE_PPK
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
class Ikev2NotifyPayloadRedirectSupported(Ikev2PayloadNotifyNoData):
|
|
988
|
+
@classmethod
|
|
989
|
+
def _get_message_type(cls):
|
|
990
|
+
return Ikev2NotifyType.REDIRECT_SUPPORTED
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
class Ikev2NotifyPayloadChildlessIkev2Supported(Ikev2PayloadNotifyNoData):
|
|
994
|
+
@classmethod
|
|
995
|
+
def _get_message_type(cls):
|
|
996
|
+
return Ikev2NotifyType.CHILDLESS_IKEV2_SUPPORTED
|
|
997
|
+
|
|
998
|
+
|
|
957
999
|
@attr.s
|
|
958
1000
|
class Ikev2PayloadNotifyUnparsed(Ikev2PayloadNotifyBase):
|
|
959
1001
|
data: typing.Union[bytes, bytearray] = attr.ib(validator=attr.validators.instance_of((bytes, bytearray)))
|
|
@@ -1028,6 +1070,86 @@ class Ikev2NotifyPayloadCookie(Ikev2PayloadNotifyParsedBase):
|
|
|
1028
1070
|
composer.compose_raw(self.cookie)
|
|
1029
1071
|
|
|
1030
1072
|
|
|
1073
|
+
@attr.s
|
|
1074
|
+
class Ikev2NotifyPayloadSetWindowSize(Ikev2PayloadNotifyParsedBase):
|
|
1075
|
+
"""Set window size payload notification data parser."""
|
|
1076
|
+
window_size: int = attr.ib(validator=[
|
|
1077
|
+
attr.validators.instance_of(int),
|
|
1078
|
+
attr.validators.in_(range(0, 2 ** 32)),
|
|
1079
|
+
])
|
|
1080
|
+
|
|
1081
|
+
@classmethod
|
|
1082
|
+
def _get_message_type(cls):
|
|
1083
|
+
return Ikev2NotifyType.SET_WINDOW_SIZE
|
|
1084
|
+
|
|
1085
|
+
@classmethod
|
|
1086
|
+
def _parse_data(cls, parser, notification_data_length):
|
|
1087
|
+
if notification_data_length != 4:
|
|
1088
|
+
raise InvalidValue(notification_data_length, cls, 'notification_data_length')
|
|
1089
|
+
parser.parse_numeric('window_size', 4)
|
|
1090
|
+
|
|
1091
|
+
def _compose_data(self, composer):
|
|
1092
|
+
composer.compose_numeric(self.window_size, 4)
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
@attr.s
|
|
1096
|
+
class Ikev2NotifyPayloadNatDetectionBase(Ikev2PayloadNotifyParsedBase):
|
|
1097
|
+
hash_data: typing.Union[bytes, bytearray] = attr.ib(validator=attr.validators.instance_of((bytes, bytearray)))
|
|
1098
|
+
|
|
1099
|
+
@classmethod
|
|
1100
|
+
@abc.abstractmethod
|
|
1101
|
+
def _get_message_type(cls):
|
|
1102
|
+
raise NotImplementedError()
|
|
1103
|
+
|
|
1104
|
+
@classmethod
|
|
1105
|
+
def _parse_data(cls, parser, notification_data_length):
|
|
1106
|
+
parser.parse_raw('hash_data', notification_data_length)
|
|
1107
|
+
|
|
1108
|
+
def _compose_data(self, composer):
|
|
1109
|
+
composer.compose_raw(self.hash_data)
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
@attr.s
|
|
1113
|
+
class Ikev2NotifyPayloadNatDetectionSourceIp(Ikev2NotifyPayloadNatDetectionBase):
|
|
1114
|
+
"""NAT detection source IP payload notification data parser."""
|
|
1115
|
+
|
|
1116
|
+
@classmethod
|
|
1117
|
+
def _get_message_type(cls):
|
|
1118
|
+
return Ikev2NotifyType.NAT_DETECTION_SOURCE_IP
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
@attr.s
|
|
1122
|
+
class Ikev2NotifyPayloadNatDetectionDestinationIp(Ikev2NotifyPayloadNatDetectionBase):
|
|
1123
|
+
"""NAT detection destination IP payload notification data parser."""
|
|
1124
|
+
|
|
1125
|
+
@classmethod
|
|
1126
|
+
def _get_message_type(cls):
|
|
1127
|
+
return Ikev2NotifyType.NAT_DETECTION_DESTINATION_IP
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
@attr.s
|
|
1131
|
+
class Ikev2NotifyPayloadSignatureHashAlgorithms(Ikev2PayloadNotifyParsedBase):
|
|
1132
|
+
"""Signature hash algorithms notification (RFC 7427 §4)."""
|
|
1133
|
+
hash_algorithms: tuple[int, ...] = attr.ib(
|
|
1134
|
+
converter=tuple,
|
|
1135
|
+
validator=attr.validators.deep_iterable(attr.validators.instance_of(int)),
|
|
1136
|
+
)
|
|
1137
|
+
|
|
1138
|
+
@classmethod
|
|
1139
|
+
def _get_message_type(cls):
|
|
1140
|
+
return Ikev2NotifyType.SIGNATURE_HASH_ALGORITHMS
|
|
1141
|
+
|
|
1142
|
+
@classmethod
|
|
1143
|
+
def _parse_data(cls, parser, notification_data_length):
|
|
1144
|
+
if notification_data_length % 2 != 0:
|
|
1145
|
+
raise InvalidValue(notification_data_length, cls, 'notification_data_length')
|
|
1146
|
+
parser.parse_numeric_array('hash_algorithms', notification_data_length // 2, 2)
|
|
1147
|
+
|
|
1148
|
+
def _compose_data(self, composer):
|
|
1149
|
+
for hash_id in self.hash_algorithms:
|
|
1150
|
+
composer.compose_numeric(hash_id, 2)
|
|
1151
|
+
|
|
1152
|
+
|
|
1031
1153
|
class Ikev2NotifyPayloadVariantBase(VariantParsable):
|
|
1032
1154
|
@classmethod
|
|
1033
1155
|
@abc.abstractmethod
|
|
@@ -1053,6 +1175,17 @@ class Ikev2NotifyPayloadVariantResponder(Ikev2NotifyPayloadVariantBase):
|
|
|
1053
1175
|
return collections.OrderedDict([
|
|
1054
1176
|
(Ikev2NotifyType.COOKIE, [Ikev2NotifyPayloadCookie, ]),
|
|
1055
1177
|
(Ikev2NotifyType.INVALID_KE_PAYLOAD, [Ikev2NotifyPayloadInvalidKe, ]),
|
|
1178
|
+
(Ikev2NotifyType.SET_WINDOW_SIZE, [Ikev2NotifyPayloadSetWindowSize, ]),
|
|
1179
|
+
(Ikev2NotifyType.NAT_DETECTION_SOURCE_IP, [Ikev2NotifyPayloadNatDetectionSourceIp, ]),
|
|
1180
|
+
(Ikev2NotifyType.NAT_DETECTION_DESTINATION_IP, [Ikev2NotifyPayloadNatDetectionDestinationIp, ]),
|
|
1181
|
+
(Ikev2NotifyType.USE_TRANSPORT_MODE, [Ikev2NotifyPayloadUseTransportMode, ]),
|
|
1182
|
+
(Ikev2NotifyType.HTTP_CERT_LOOKUP_SUPPORTED, [Ikev2NotifyPayloadHttpCertLookupSupported, ]),
|
|
1183
|
+
(Ikev2NotifyType.SIGNATURE_HASH_ALGORITHMS, [Ikev2NotifyPayloadSignatureHashAlgorithms, ]),
|
|
1184
|
+
(Ikev2NotifyType.IKEV2_FRAGMENTATION_SUPPORTED, [Ikev2NotifyPayloadIkev2FragmentationSupported, ]),
|
|
1185
|
+
(Ikev2NotifyType.INTERMEDIATE_EXCHANGE_SUPPORTED, [Ikev2NotifyPayloadIntermediateExchangeSupported, ]),
|
|
1186
|
+
(Ikev2NotifyType.USE_PPK, [Ikev2NotifyPayloadUsePpk, ]),
|
|
1187
|
+
(Ikev2NotifyType.REDIRECT_SUPPORTED, [Ikev2NotifyPayloadRedirectSupported, ]),
|
|
1188
|
+
(Ikev2NotifyType.CHILDLESS_IKEV2_SUPPORTED, [Ikev2NotifyPayloadChildlessIkev2Supported, ]),
|
|
1056
1189
|
])
|
|
1057
1190
|
|
|
1058
1191
|
|