CryptoParser 1.1.0__tar.gz → 1.2.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.1.0 → cryptoparser-1.2.0}/CHANGELOG.rst +23 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/CryptoParser.egg-info/PKG-INFO +3 -3
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/CryptoParser.egg-info/requires.txt +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/PKG-INFO +3 -3
- cryptoparser-1.2.0/cryptoparser/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/__setup__.py +1 -0
- cryptoparser-1.2.0/cryptoparser/common/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/base.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/classes.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/exception.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/field.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/parse.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/utils.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/common/x509.py +1 -0
- cryptoparser-1.2.0/cryptoparser/dnsrec/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/dnsrec/record.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/dnsrec/txt.py +1 -0
- cryptoparser-1.2.0/cryptoparser/httpx/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/httpx/header.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/httpx/parse.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/httpx/version.py +1 -0
- cryptoparser-1.2.0/cryptoparser/ike/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ike/common.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ike/ikev1.py +182 -13
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ike/ikev2.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ike/isakmp.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ike/version.py +1 -0
- cryptoparser-1.2.0/cryptoparser/ssh/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ssh/key.py +6 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ssh/record.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ssh/subprotocol.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/ssh/version.py +1 -1
- cryptoparser-1.2.0/cryptoparser/tls/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/algorithm.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/ciphersuite.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/extension.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/grease.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/ldap.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/mysql.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/openvpn.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/postgresql.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/rdp.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/record.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/subprotocol.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/cryptoparser/tls/version.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/docs/conf.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/pyproject.toml +4 -3
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/setup.py +1 -0
- cryptoparser-1.2.0/test/__init__.py +1 -0
- cryptoparser-1.2.0/test/common/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/classes.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_algorithm.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_base.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_classes.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_exception.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_field.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_parse.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_utils.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/test_x509.py +1 -0
- cryptoparser-1.2.0/test/dnsrec/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/dnsrec/test_record.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/dnsrec/test_txt.py +1 -1
- cryptoparser-1.2.0/test/httpx/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/httpx/classes.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/httpx/test_header.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/httpx/test_version.py +1 -1
- cryptoparser-1.2.0/test/ike/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/classes.py +38 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_ikev1_payload.py +177 -89
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_ikev1_sa.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_ikev2_notify.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_ikev2_payload.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_ikev2_sa.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_isakmp.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ike/test_version.py +1 -0
- cryptoparser-1.2.0/test/ssh/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ssh/test_ciphersuites.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ssh/test_key.py +4 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ssh/test_record.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ssh/test_subprotocol.py +1 -1
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/ssh/test_version.py +1 -1
- cryptoparser-1.2.0/test/tls/__init__.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/classes.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_alert.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_application_data.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_change_cipher_spec.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_ciphersuite.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_extension.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_grease.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_handshake.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_ldap.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_mysql.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_openvpn.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_postgresql.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_rdp.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_record.py +1 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/tls/test_version.py +1 -0
- cryptoparser-1.1.0/cryptoparser/__init__.py +0 -0
- cryptoparser-1.1.0/cryptoparser/common/__init__.py +0 -0
- cryptoparser-1.1.0/cryptoparser/dnsrec/__init__.py +0 -0
- cryptoparser-1.1.0/cryptoparser/httpx/__init__.py +0 -0
- cryptoparser-1.1.0/cryptoparser/ike/__init__.py +0 -0
- cryptoparser-1.1.0/cryptoparser/ssh/__init__.py +0 -0
- cryptoparser-1.1.0/cryptoparser/tls/__init__.py +0 -0
- cryptoparser-1.1.0/test/__init__.py +0 -0
- cryptoparser-1.1.0/test/common/__init__.py +0 -0
- cryptoparser-1.1.0/test/dnsrec/__init__.py +0 -0
- cryptoparser-1.1.0/test/httpx/__init__.py +0 -0
- cryptoparser-1.1.0/test/ike/__init__.py +0 -0
- cryptoparser-1.1.0/test/ssh/__init__.py +0 -0
- cryptoparser-1.1.0/test/tls/__init__.py +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.coveragerc +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.flake8 +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.gitignore +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.gitlab-ci.yml +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.gitmodules +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.pylintrc +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/.readthedocs.yaml +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/CONTRIBUTING.rst +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/CryptoParser.egg-info/SOURCES.txt +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/CryptoParser.egg-info/dependency_links.txt +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/CryptoParser.egg-info/top_level.txt +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/LICENSE.txt +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/MANIFEST.in +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/README.rst +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/docs/.gitignore +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/docs/changelog.rst +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/docs/development.rst +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/docs/features.rst +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/docs/index.rst +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/setup.cfg +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/certs/ecc256.badssl.com.pem +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/certs/rsa8192.badssl.com.pem +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/certs/rsa8192.badssl.com_certificate.crt +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/certs/rsa8192.badssl.com_root_ca.crt +0 -0
- {cryptoparser-1.1.0 → cryptoparser-1.2.0}/test/common/certs/snakeoil_cert.pem +0 -0
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
=========
|
|
4
4
|
|
|
5
|
+
------------------
|
|
6
|
+
1.2.0 - 2026-05-05
|
|
7
|
+
------------------
|
|
8
|
+
|
|
9
|
+
Features
|
|
10
|
+
========
|
|
11
|
+
|
|
12
|
+
- IKE (``ike``)
|
|
13
|
+
|
|
14
|
+
- add IKEv1 delete payload parsing (#92)
|
|
15
|
+
- add IKEv1 certificate request payload parsing (#97)
|
|
16
|
+
|
|
17
|
+
------------------
|
|
18
|
+
1.1.1 - 2026-05-03
|
|
19
|
+
------------------
|
|
20
|
+
|
|
21
|
+
Notable fixes
|
|
22
|
+
=============
|
|
23
|
+
|
|
24
|
+
- SSH
|
|
25
|
+
|
|
26
|
+
- add missing key size property (#96)
|
|
27
|
+
|
|
5
28
|
-------------------
|
|
6
29
|
1.1.0 - 2026-02-13
|
|
7
30
|
-------------------
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CryptoParser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.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>
|
|
7
|
-
License: MPL-2.0
|
|
7
|
+
License-Expression: MPL-2.0
|
|
8
8
|
Project-URL: Homepage, https://gitlab.com/coroner/cryptoparser
|
|
9
9
|
Project-URL: Changelog, https://cryptoparser.readthedocs.io/en/latest/changelog
|
|
10
10
|
Project-URL: Documentation, https://cryptoparser.readthedocs.io/en/latest/
|
|
@@ -40,7 +40,7 @@ Description-Content-Type: text/x-rst
|
|
|
40
40
|
License-File: LICENSE.txt
|
|
41
41
|
Requires-Dist: asn1crypto
|
|
42
42
|
Requires-Dist: attrs
|
|
43
|
-
Requires-Dist: cryptodatahub==1.
|
|
43
|
+
Requires-Dist: cryptodatahub==1.2.0
|
|
44
44
|
Requires-Dist: urllib3
|
|
45
45
|
Provides-Extra: tests
|
|
46
46
|
Requires-Dist: pyfakefs; extra == "tests"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CryptoParser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.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>
|
|
7
|
-
License: MPL-2.0
|
|
7
|
+
License-Expression: MPL-2.0
|
|
8
8
|
Project-URL: Homepage, https://gitlab.com/coroner/cryptoparser
|
|
9
9
|
Project-URL: Changelog, https://cryptoparser.readthedocs.io/en/latest/changelog
|
|
10
10
|
Project-URL: Documentation, https://cryptoparser.readthedocs.io/en/latest/
|
|
@@ -40,7 +40,7 @@ Description-Content-Type: text/x-rst
|
|
|
40
40
|
License-File: LICENSE.txt
|
|
41
41
|
Requires-Dist: asn1crypto
|
|
42
42
|
Requires-Dist: attrs
|
|
43
|
-
Requires-Dist: cryptodatahub==1.
|
|
43
|
+
Requires-Dist: cryptodatahub==1.2.0
|
|
44
44
|
Requires-Dist: urllib3
|
|
45
45
|
Provides-Extra: tests
|
|
46
46
|
Requires-Dist: pyfakefs; extra == "tests"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
1
2
|
"""IKEv1 payload parsers."""
|
|
2
3
|
|
|
3
4
|
import abc
|
|
@@ -587,7 +588,60 @@ class Ikev1PayloadHash(Ikev1PayloadBase):
|
|
|
587
588
|
|
|
588
589
|
|
|
589
590
|
@attr.s
|
|
590
|
-
class
|
|
591
|
+
class Ikev1PayloadDoiProtocolSpiBase(Ikev1PayloadBase):
|
|
592
|
+
"""Base class for IKEv1 payloads with DOI, Protocol-Id, and SPI Size fields.
|
|
593
|
+
|
|
594
|
+
Shared structure:
|
|
595
|
+
|
|
596
|
+
.. code-block:: text
|
|
597
|
+
|
|
598
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
599
|
+
| Domain of Interpretation (DOI) |
|
|
600
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
601
|
+
| Protocol-Id | SPI Size | |
|
|
602
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
603
|
+
|
|
604
|
+
:ivar doi: Domain of Interpretation (4 bytes)
|
|
605
|
+
:ivar protocol_id: Protocol ID (1 byte)
|
|
606
|
+
:ivar spi_size: Size of SPI in bytes (1 byte)
|
|
607
|
+
"""
|
|
608
|
+
|
|
609
|
+
DOI_PROTOCOL_SPI_SIZE = 6
|
|
610
|
+
|
|
611
|
+
doi: Ikev1Doi = attr.ib(validator=attr.validators.instance_of(Ikev1Doi))
|
|
612
|
+
protocol_id: Ikev1ProtocolId = attr.ib(validator=attr.validators.instance_of(Ikev1ProtocolId))
|
|
613
|
+
spi_size: int = attr.ib(validator=attr.validators.instance_of(int))
|
|
614
|
+
|
|
615
|
+
@classmethod
|
|
616
|
+
@abc.abstractmethod
|
|
617
|
+
def _parse(cls, parsable):
|
|
618
|
+
raise NotImplementedError()
|
|
619
|
+
|
|
620
|
+
@abc.abstractmethod
|
|
621
|
+
def compose(self):
|
|
622
|
+
raise NotImplementedError()
|
|
623
|
+
|
|
624
|
+
@classmethod
|
|
625
|
+
def _parse_header(cls, parsable):
|
|
626
|
+
parser = super()._parse_header(parsable)
|
|
627
|
+
if parser.unparsed_length < cls.DOI_PROTOCOL_SPI_SIZE:
|
|
628
|
+
raise NotEnoughData(cls.DOI_PROTOCOL_SPI_SIZE - parser.unparsed_length)
|
|
629
|
+
|
|
630
|
+
parser.parse_numeric_enum_coded('doi', Ikev1Doi)
|
|
631
|
+
parser.parse_numeric_enum_coded('protocol_id', Ikev1ProtocolId)
|
|
632
|
+
parser.parse_numeric('spi_size', 1)
|
|
633
|
+
|
|
634
|
+
return parser
|
|
635
|
+
|
|
636
|
+
def _compose_doi_protocol_spi(self, composer):
|
|
637
|
+
"""Compose DOI, Protocol-Id, and SPI Size to composer."""
|
|
638
|
+
composer.compose_numeric_enum_coded(self.doi)
|
|
639
|
+
composer.compose_numeric_enum_coded(self.protocol_id)
|
|
640
|
+
composer.compose_numeric(self.spi_size, 1)
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
@attr.s
|
|
644
|
+
class Ikev1PayloadNotification(Ikev1PayloadDoiProtocolSpiBase):
|
|
591
645
|
"""Notification payload parser.
|
|
592
646
|
|
|
593
647
|
The Notification payload has the following format:
|
|
@@ -612,17 +666,11 @@ class Ikev1PayloadNotification(Ikev1PayloadBase):
|
|
|
612
666
|
! !
|
|
613
667
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
614
668
|
|
|
615
|
-
:ivar doi: Domain of Interpretation (4 bytes)
|
|
616
|
-
:ivar protocol_id: Protocol ID (1 byte)
|
|
617
|
-
:ivar spi_size: Size of SPI in bytes (1 byte)
|
|
618
669
|
:ivar notify_message_type: Notify message type (1 byte)
|
|
619
670
|
:ivar spi: Security Parameter Index (variable length)
|
|
620
671
|
:ivar notification_data: Notification data (variable length)
|
|
621
672
|
"""
|
|
622
673
|
|
|
623
|
-
doi: Ikev1Doi = attr.ib(validator=attr.validators.instance_of(Ikev1Doi))
|
|
624
|
-
protocol_id: Ikev1ProtocolId = attr.ib(validator=attr.validators.instance_of(Ikev1ProtocolId))
|
|
625
|
-
spi_size: int = attr.ib(validator=attr.validators.instance_of(int))
|
|
626
674
|
notify_type: Ikev1NotifyType = attr.ib(validator=attr.validators.instance_of(Ikev1NotifyType))
|
|
627
675
|
spi: bytes = attr.ib(converter=bytes, validator=attr.validators.instance_of(bytes))
|
|
628
676
|
notification_data: bytes = attr.ib(converter=bytes, validator=attr.validators.instance_of(bytes))
|
|
@@ -634,9 +682,6 @@ class Ikev1PayloadNotification(Ikev1PayloadBase):
|
|
|
634
682
|
@classmethod
|
|
635
683
|
def _parse(cls, parsable):
|
|
636
684
|
parser = cls._parse_header(parsable)
|
|
637
|
-
parser.parse_numeric_enum_coded('doi', Ikev1Doi)
|
|
638
|
-
parser.parse_numeric_enum_coded('protocol_id', Ikev1ProtocolId)
|
|
639
|
-
parser.parse_numeric('spi_size', 1)
|
|
640
685
|
parser.parse_numeric_enum_coded('notify_type', Ikev1NotifyType)
|
|
641
686
|
parser.parse_raw('spi', parser['spi_size'])
|
|
642
687
|
parser.parse_raw('notification_data', parser['payload_length'] - parser.parsed_length)
|
|
@@ -654,9 +699,7 @@ class Ikev1PayloadNotification(Ikev1PayloadBase):
|
|
|
654
699
|
|
|
655
700
|
def compose(self):
|
|
656
701
|
composer_payload = ComposerBinary()
|
|
657
|
-
|
|
658
|
-
composer_payload.compose_numeric_enum_coded(self.protocol_id)
|
|
659
|
-
composer_payload.compose_numeric(len(self.spi), 1)
|
|
702
|
+
self._compose_doi_protocol_spi(composer_payload)
|
|
660
703
|
composer_payload.compose_numeric_enum_coded(self.notify_type)
|
|
661
704
|
composer_payload.compose_raw(self.spi)
|
|
662
705
|
composer_payload.compose_raw(self.notification_data)
|
|
@@ -665,6 +708,74 @@ class Ikev1PayloadNotification(Ikev1PayloadBase):
|
|
|
665
708
|
return composer_header.composed_bytes + composer_payload.composed_bytes
|
|
666
709
|
|
|
667
710
|
|
|
711
|
+
@attr.s
|
|
712
|
+
class Ikev1PayloadDelete(Ikev1PayloadDoiProtocolSpiBase):
|
|
713
|
+
"""Delete payload parser.
|
|
714
|
+
|
|
715
|
+
The Delete payload has the following format:
|
|
716
|
+
|
|
717
|
+
.. code-block:: text
|
|
718
|
+
|
|
719
|
+
1 2 3
|
|
720
|
+
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
721
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
722
|
+
| Next Payload | RESERVED | Payload Length |
|
|
723
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
724
|
+
| Domain of Interpretation (DOI) |
|
|
725
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
726
|
+
| Protocol-Id | SPI Size | # of SPIs |
|
|
727
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
728
|
+
| |
|
|
729
|
+
~ Security Parameter Index(es) (SPI) ~
|
|
730
|
+
| |
|
|
731
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
732
|
+
|
|
733
|
+
:ivar spis: Security Parameter Index(es) (variable length, list of spi_size bytes each)
|
|
734
|
+
"""
|
|
735
|
+
|
|
736
|
+
spis: typing.Sequence[typing.Union[bytes, bytearray]] = attr.ib(
|
|
737
|
+
validator=attr.validators.deep_iterable(
|
|
738
|
+
member_validator=attr.validators.instance_of((bytes, bytearray)),
|
|
739
|
+
)
|
|
740
|
+
)
|
|
741
|
+
|
|
742
|
+
@classmethod
|
|
743
|
+
def get_payload_type(cls):
|
|
744
|
+
return Ikev1PayloadType.DELETE
|
|
745
|
+
|
|
746
|
+
@classmethod
|
|
747
|
+
def _parse(cls, parsable):
|
|
748
|
+
parser = cls._parse_header(parsable)
|
|
749
|
+
parser.parse_numeric('spi_count', 2)
|
|
750
|
+
|
|
751
|
+
spis = []
|
|
752
|
+
for _ in range(parser['spi_count']):
|
|
753
|
+
parser.parse_raw('spi', parser['spi_size'])
|
|
754
|
+
spis.append(parser['spi'])
|
|
755
|
+
|
|
756
|
+
payload = cls(
|
|
757
|
+
doi=parser['doi'],
|
|
758
|
+
protocol_id=parser['protocol_id'],
|
|
759
|
+
spi_size=parser['spi_size'],
|
|
760
|
+
spis=spis,
|
|
761
|
+
)
|
|
762
|
+
payload.next_payload = parser['next_payload']
|
|
763
|
+
|
|
764
|
+
return payload, parser.parsed_length
|
|
765
|
+
|
|
766
|
+
def compose(self):
|
|
767
|
+
composer_payload = ComposerBinary()
|
|
768
|
+
self._compose_doi_protocol_spi(composer_payload)
|
|
769
|
+
composer_payload.compose_numeric(len(self.spis), 2)
|
|
770
|
+
|
|
771
|
+
for spi in self.spis:
|
|
772
|
+
composer_payload.compose_raw(spi)
|
|
773
|
+
|
|
774
|
+
composer_header = self.compose_header(composer_payload.composed_length)
|
|
775
|
+
|
|
776
|
+
return composer_header.composed_bytes + composer_payload.composed_bytes
|
|
777
|
+
|
|
778
|
+
|
|
668
779
|
@attr.s
|
|
669
780
|
class Ikev1PayloadVendorId(Ikev1PayloadBase):
|
|
670
781
|
"""Vendor ID payload parser.
|
|
@@ -712,13 +823,71 @@ class Ikev1PayloadVendorId(Ikev1PayloadBase):
|
|
|
712
823
|
return composer_header.composed_bytes + composer_payload.composed_bytes
|
|
713
824
|
|
|
714
825
|
|
|
826
|
+
@attr.s
|
|
827
|
+
class Ikev1PayloadCertificateRequest(Ikev1PayloadBase):
|
|
828
|
+
"""Certificate Request payload parser.
|
|
829
|
+
|
|
830
|
+
The Certificate Request payload has the following format:
|
|
831
|
+
|
|
832
|
+
.. code-block:: text
|
|
833
|
+
|
|
834
|
+
0 1 2 3
|
|
835
|
+
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
836
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
837
|
+
| Next Payload |C| RESERVED | Payload Length |
|
|
838
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
839
|
+
| Cert Encoding | |
|
|
840
|
+
+-+-+-+-+-+-+-+-+ +
|
|
841
|
+
~ Certificate Data ~
|
|
842
|
+
| |
|
|
843
|
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
844
|
+
|
|
845
|
+
:ivar cert_encoding: Certificate encoding type
|
|
846
|
+
:ivar certificate_data: Certificate data
|
|
847
|
+
"""
|
|
848
|
+
|
|
849
|
+
cert_encoding: int = attr.ib(validator=attr.validators.instance_of(int))
|
|
850
|
+
certificate_data: typing.Union[bytes, bytearray] = attr.ib(
|
|
851
|
+
validator=attr.validators.instance_of((bytes, bytearray))
|
|
852
|
+
)
|
|
853
|
+
|
|
854
|
+
@classmethod
|
|
855
|
+
def get_payload_type(cls):
|
|
856
|
+
return Ikev1PayloadType.CERTIFICATE_REQUEST
|
|
857
|
+
|
|
858
|
+
@classmethod
|
|
859
|
+
def _parse(cls, parsable):
|
|
860
|
+
parser = cls._parse_header(parsable)
|
|
861
|
+
parser.parse_numeric('cert_encoding', 1)
|
|
862
|
+
parser.parse_raw('certificate_data', parser['payload_length'] - cls.HEADER_SIZE - 1)
|
|
863
|
+
|
|
864
|
+
payload = cls(
|
|
865
|
+
cert_encoding=parser['cert_encoding'],
|
|
866
|
+
certificate_data=parser['certificate_data']
|
|
867
|
+
)
|
|
868
|
+
payload.next_payload = parser['next_payload']
|
|
869
|
+
|
|
870
|
+
return payload, parser.parsed_length
|
|
871
|
+
|
|
872
|
+
def compose(self):
|
|
873
|
+
composer_payload = ComposerBinary()
|
|
874
|
+
composer_payload.compose_numeric(self.cert_encoding, 1)
|
|
875
|
+
composer_payload.compose_raw(self.certificate_data)
|
|
876
|
+
|
|
877
|
+
composer_header = self.compose_header(composer_payload.composed_length)
|
|
878
|
+
|
|
879
|
+
return composer_header.composed_bytes + composer_payload.composed_bytes
|
|
880
|
+
|
|
881
|
+
|
|
715
882
|
IKEV1_PAYLOAD_CLASSES_BY_TYPE = {
|
|
716
883
|
Ikev1PayloadType.SECURITY_ASSOCIATION: Ikev1PayloadSecurityAssociation,
|
|
717
884
|
Ikev1PayloadType.KEY_EXCHANGE: Ikev1PayloadKeyExchange,
|
|
718
885
|
Ikev1PayloadType.HASH: Ikev1PayloadHash,
|
|
719
886
|
Ikev1PayloadType.NONCE: Ikev1PayloadNonce,
|
|
720
887
|
Ikev1PayloadType.NOTIFICATION: Ikev1PayloadNotification,
|
|
888
|
+
Ikev1PayloadType.DELETE: Ikev1PayloadDelete,
|
|
721
889
|
Ikev1PayloadType.VENDOR_ID: Ikev1PayloadVendorId,
|
|
890
|
+
Ikev1PayloadType.CERTIFICATE_REQUEST: Ikev1PayloadCertificateRequest,
|
|
722
891
|
}
|
|
723
892
|
|
|
724
893
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
1
2
|
# -*- coding: utf-8 -*-
|
|
2
3
|
# pylint: disable=too-many-lines
|
|
3
4
|
|
|
@@ -24,6 +25,7 @@ from cryptodatahub.common.key import (
|
|
|
24
25
|
PublicKeyParamsEcdsa,
|
|
25
26
|
PublicKeyParamsEddsa,
|
|
26
27
|
PublicKeyParamsRsa,
|
|
28
|
+
PublicKeySize,
|
|
27
29
|
)
|
|
28
30
|
from cryptodatahub.common.utils import hash_bytes
|
|
29
31
|
from cryptodatahub.ssh.algorithm import SshHostKeyAlgorithm, SshHostKeyType, SshEllipticCurveIdentifier
|
|
@@ -77,6 +79,10 @@ class SshPublicKeyBase():
|
|
|
77
79
|
|
|
78
80
|
return ':'.join((prefix, fingerprint))
|
|
79
81
|
|
|
82
|
+
@property
|
|
83
|
+
def key_size(self):
|
|
84
|
+
return PublicKeySize(self.public_key.key_type, self.public_key.key_size)
|
|
85
|
+
|
|
80
86
|
@property
|
|
81
87
|
def fingerprints(self):
|
|
82
88
|
key_bytes = self.key_bytes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = 'CryptoParser'
|
|
7
|
-
version = '1.
|
|
7
|
+
version = '1.2.0'
|
|
8
8
|
description = 'An analysis oriented security protocol parser and generator'
|
|
9
9
|
authors = [
|
|
10
10
|
{name = 'Szilárd Pfeiffer', email = 'coroner@pfeifferszilard.hu'}
|
|
@@ -42,12 +42,13 @@ classifiers=[
|
|
|
42
42
|
|
|
43
43
|
keywords=['ssl', 'tls', 'gost', 'ja3', 'ldap', 'rdp', 'ssh', 'hsts', 'dns', 'ike']
|
|
44
44
|
readme = {file = 'README.rst', content-type = 'text/x-rst'}
|
|
45
|
-
license =
|
|
45
|
+
license = 'MPL-2.0'
|
|
46
|
+
license-files = ['LICENSE.txt']
|
|
46
47
|
|
|
47
48
|
dependencies = [
|
|
48
49
|
'asn1crypto',
|
|
49
50
|
'attrs',
|
|
50
|
-
'cryptodatahub==1.
|
|
51
|
+
'cryptodatahub==1.2.0',
|
|
51
52
|
'urllib3',
|
|
52
53
|
]
|
|
53
54
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|