post-quantum-check 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,108 @@
1
+ from __future__ import annotations
2
+
3
+ from importlib.metadata import PackageNotFoundError
4
+ from importlib.metadata import version as _package_version
5
+
6
+ from post_quantum_check.audit import run_audit
7
+ from post_quantum_check.auditors import (
8
+ CommandResult,
9
+ CommandRunner,
10
+ SshHostProber,
11
+ SshHostProbeResult,
12
+ TlsProber,
13
+ TlsProbeResult,
14
+ audit_ssh,
15
+ audit_system,
16
+ audit_tls_endpoints,
17
+ scan_codebase,
18
+ )
19
+ from post_quantum_check.models import (
20
+ AuditReport,
21
+ CheckStatus,
22
+ CryptoAsset,
23
+ Finding,
24
+ Profile,
25
+ Severity,
26
+ Urgency,
27
+ redact_metadata,
28
+ redact_sensitive_text,
29
+ )
30
+ from post_quantum_check.policy import (
31
+ CNSA2_MILESTONES,
32
+ CNSA2_POLICY,
33
+ HYBRID_POLICY,
34
+ AlgorithmAssessment,
35
+ PolicySpec,
36
+ assess_algorithm,
37
+ get_policy,
38
+ parse_semver,
39
+ version_at_least,
40
+ )
41
+ from post_quantum_check.reporters import (
42
+ REPORT_FORMATS,
43
+ render_cyclonedx,
44
+ render_json,
45
+ render_markdown,
46
+ render_report,
47
+ render_sarif,
48
+ render_terminal,
49
+ )
50
+ from post_quantum_check.ssh_keygen import (
51
+ HARDENED_SSH_CONFIG_BLOCK,
52
+ HARDENED_SSHD_DROPIN,
53
+ SshKeygenPlan,
54
+ apply_ssh_keygen_plan,
55
+ build_ssh_keygen_plan,
56
+ render_ssh_keygen_plan,
57
+ )
58
+
59
+ try:
60
+ __version__ = _package_version("post-quantum-check")
61
+ except PackageNotFoundError:
62
+ __version__ = "0.1.0"
63
+
64
+ __all__ = [
65
+ "CNSA2_MILESTONES",
66
+ "CNSA2_POLICY",
67
+ "HARDENED_SSHD_DROPIN",
68
+ "HARDENED_SSH_CONFIG_BLOCK",
69
+ "HYBRID_POLICY",
70
+ "REPORT_FORMATS",
71
+ "AlgorithmAssessment",
72
+ "AuditReport",
73
+ "CheckStatus",
74
+ "CommandResult",
75
+ "CommandRunner",
76
+ "CryptoAsset",
77
+ "Finding",
78
+ "PolicySpec",
79
+ "Profile",
80
+ "Severity",
81
+ "SshHostProbeResult",
82
+ "SshHostProber",
83
+ "SshKeygenPlan",
84
+ "TlsProbeResult",
85
+ "TlsProber",
86
+ "Urgency",
87
+ "__version__",
88
+ "apply_ssh_keygen_plan",
89
+ "assess_algorithm",
90
+ "audit_ssh",
91
+ "audit_system",
92
+ "audit_tls_endpoints",
93
+ "build_ssh_keygen_plan",
94
+ "get_policy",
95
+ "parse_semver",
96
+ "redact_metadata",
97
+ "redact_sensitive_text",
98
+ "render_cyclonedx",
99
+ "render_json",
100
+ "render_markdown",
101
+ "render_report",
102
+ "render_sarif",
103
+ "render_ssh_keygen_plan",
104
+ "render_terminal",
105
+ "run_audit",
106
+ "scan_codebase",
107
+ "version_at_least",
108
+ ]
@@ -0,0 +1,6 @@
1
+ from __future__ import annotations
2
+
3
+ from post_quantum_check.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,82 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Sequence
4
+ from importlib.metadata import PackageNotFoundError
5
+ from importlib.metadata import version as _package_version
6
+ from pathlib import Path
7
+
8
+ from post_quantum_check.auditors.codebase import scan_codebase
9
+ from post_quantum_check.auditors.ssh import SshHostProber, audit_ssh
10
+ from post_quantum_check.auditors.system import CommandRunner, audit_system
11
+ from post_quantum_check.auditors.tls import TlsProber, audit_tls_endpoints
12
+ from post_quantum_check.models import AuditReport, CryptoAsset, Finding, Profile
13
+
14
+
15
+ def _tool_version() -> str:
16
+ try:
17
+ return _package_version("post-quantum-check")
18
+ except PackageNotFoundError:
19
+ return "0.1.0"
20
+
21
+
22
+ def run_audit(
23
+ *,
24
+ path: Path | str | None = None,
25
+ hosts: Sequence[str] = (),
26
+ profile: Profile = Profile.HYBRID,
27
+ include_system: bool = True,
28
+ include_ssh: bool = True,
29
+ include_scan: bool = True,
30
+ ssh_dir: Path | None = None,
31
+ ssh_host: str | None = None,
32
+ ssh_port: int = 22,
33
+ tls_timeout: float = 8.0,
34
+ ca_file: str | None = None,
35
+ runner: CommandRunner | None = None,
36
+ tls_prober: TlsProber | None = None,
37
+ ssh_prober: SshHostProber | None = None,
38
+ tool_version: str | None = None,
39
+ ) -> AuditReport:
40
+ """Run an aggregated multi-layer PQC readiness audit across system, SSH, TLS, and code."""
41
+ findings: list[Finding] = []
42
+ assets: list[CryptoAsset] = []
43
+
44
+ if include_system:
45
+ sys_findings, sys_assets = audit_system(profile=profile, runner=runner)
46
+ findings.extend(sys_findings)
47
+ assets.extend(sys_assets)
48
+
49
+ if include_ssh:
50
+ ssh_findings, ssh_assets = audit_ssh(
51
+ profile=profile,
52
+ ssh_dir=ssh_dir,
53
+ host=ssh_host,
54
+ port=ssh_port,
55
+ runner=runner,
56
+ host_prober=ssh_prober,
57
+ )
58
+ findings.extend(ssh_findings)
59
+ assets.extend(ssh_assets)
60
+
61
+ if hosts:
62
+ tls_findings, tls_assets = audit_tls_endpoints(
63
+ hosts,
64
+ profile=profile,
65
+ timeout=tls_timeout,
66
+ ca_file=ca_file,
67
+ prober=tls_prober,
68
+ )
69
+ findings.extend(tls_findings)
70
+ assets.extend(tls_assets)
71
+
72
+ if include_scan and path is not None:
73
+ scan_findings, scan_assets = scan_codebase(path, profile=profile)
74
+ findings.extend(scan_findings)
75
+ assets.extend(scan_assets)
76
+
77
+ return AuditReport(
78
+ tool_version=tool_version or _tool_version(),
79
+ profile=profile,
80
+ findings=findings,
81
+ assets=assets,
82
+ )
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ from post_quantum_check.auditors.codebase import scan_codebase
4
+ from post_quantum_check.auditors.ssh import (
5
+ SshHostProber,
6
+ SshHostProbeResult,
7
+ audit_ssh,
8
+ evaluate_ssh_host_probe,
9
+ parse_ssh_kexinit_payload,
10
+ probe_ssh_host,
11
+ )
12
+ from post_quantum_check.auditors.system import (
13
+ CommandResult,
14
+ CommandRunner,
15
+ audit_system,
16
+ )
17
+ from post_quantum_check.auditors.tls import (
18
+ TlsProber,
19
+ TlsProbeResult,
20
+ audit_tls_endpoints,
21
+ evaluate_tls_probe,
22
+ parse_host_target,
23
+ )
24
+
25
+ __all__ = [
26
+ "CommandResult",
27
+ "CommandRunner",
28
+ "SshHostProbeResult",
29
+ "SshHostProber",
30
+ "TlsProbeResult",
31
+ "TlsProber",
32
+ "audit_ssh",
33
+ "audit_system",
34
+ "audit_tls_endpoints",
35
+ "evaluate_ssh_host_probe",
36
+ "evaluate_tls_probe",
37
+ "parse_host_target",
38
+ "parse_ssh_kexinit_payload",
39
+ "probe_ssh_host",
40
+ "scan_codebase",
41
+ ]