ether-core 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.
Files changed (104) hide show
  1. ether/__init__.py +32 -0
  2. ether/assets/wordlists/common_dirs.txt.gz +0 -0
  3. ether/assets/wordlists/common_params.txt.gz +0 -0
  4. ether/assets/wordlists/common_passwords.txt.gz +0 -0
  5. ether/assets/wordlists/common_usernames.txt.gz +0 -0
  6. ether/assets/wordlists/subdomains_500.txt.gz +0 -0
  7. ether/cli/__init__.py +5 -0
  8. ether/cli/__main__.py +8 -0
  9. ether/cli/commands/__init__.py +1 -0
  10. ether/cli/commands/doctor.py +21 -0
  11. ether/cli/commands/graph.py +311 -0
  12. ether/cli/commands/logs.py +45 -0
  13. ether/cli/commands/mcp.py +49 -0
  14. ether/cli/commands/run.py +146 -0
  15. ether/cli/commands/session.py +61 -0
  16. ether/cli/commands/telemetry.py +51 -0
  17. ether/cli/commands/tool.py +131 -0
  18. ether/cli/context.py +71 -0
  19. ether/cli/formatters.py +39 -0
  20. ether/cli/router.py +368 -0
  21. ether/common/__init__.py +201 -0
  22. ether/common/algorithms.py +407 -0
  23. ether/common/canonicalize.py +93 -0
  24. ether/common/context.py +25 -0
  25. ether/common/crypto.py +183 -0
  26. ether/common/embeddings.py +93 -0
  27. ether/common/exceptions.py +13 -0
  28. ether/common/logging.py +386 -0
  29. ether/common/secure_memory.py +159 -0
  30. ether/common/ssrf.py +93 -0
  31. ether/core/__init__.py +25 -0
  32. ether/core/diagnostics.py +368 -0
  33. ether/core/executor.py +296 -0
  34. ether/core/sandbox.py +118 -0
  35. ether/core/session.py +956 -0
  36. ether/gateway/__init__.py +21 -0
  37. ether/gateway/gate.py +392 -0
  38. ether/gateway/network.py +98 -0
  39. ether/gateway/preflight.py +802 -0
  40. ether/graph/__init__.py +13 -0
  41. ether/graph/analytics.py +334 -0
  42. ether/graph/store.py +1615 -0
  43. ether/graph/telemetry.py +334 -0
  44. ether/graph/timeline.py +185 -0
  45. ether/mcp/__init__.py +5 -0
  46. ether/mcp/server.py +382 -0
  47. ether/paths.py +176 -0
  48. ether/py.typed +0 -0
  49. ether/registry/__init__.py +7 -0
  50. ether/registry/adapter.py +194 -0
  51. ether/registry/manifest.py +53 -0
  52. ether/registry/registry.py +150 -0
  53. ether/registry/wordlists.py +156 -0
  54. ether/schemas/__init__.py +50 -0
  55. ether/schemas/base.py +122 -0
  56. ether/schemas/credential.py +50 -0
  57. ether/schemas/dns.py +116 -0
  58. ether/schemas/host_internal.py +58 -0
  59. ether/schemas/network.py +142 -0
  60. ether/schemas/power.py +68 -0
  61. ether/schemas/vulnerability.py +221 -0
  62. ether/schemas/web.py +172 -0
  63. ether_core-0.1.0.dist-info/METADATA +440 -0
  64. ether_core-0.1.0.dist-info/RECORD +104 -0
  65. ether_core-0.1.0.dist-info/WHEEL +4 -0
  66. ether_core-0.1.0.dist-info/entry_points.txt +2 -0
  67. ether_core-0.1.0.dist-info/licenses/LICENSE +21 -0
  68. tools/__init__.py +0 -0
  69. tools/dnspython/__init__.py +1 -0
  70. tools/dnspython/adapter.py +302 -0
  71. tools/dnspython/cli.py +202 -0
  72. tools/dnspython/manifest.toml +138 -0
  73. tools/ffuf/__init__.py +1 -0
  74. tools/ffuf/adapter.py +183 -0
  75. tools/ffuf/manifest.toml +121 -0
  76. tools/gobuster/__init__.py +0 -0
  77. tools/gobuster/adapter.py +90 -0
  78. tools/gobuster/manifest.toml +104 -0
  79. tools/http_probe/adapter.py +256 -0
  80. tools/http_probe/manifest.toml +40 -0
  81. tools/netexec/__init__.py +1 -0
  82. tools/netexec/adapter.py +163 -0
  83. tools/netexec/manifest.toml +83 -0
  84. tools/nikto/__init__.py +0 -0
  85. tools/nikto/adapter.py +145 -0
  86. tools/nikto/manifest.toml +108 -0
  87. tools/nmap/__init__.py +0 -0
  88. tools/nmap/adapter.py +97 -0
  89. tools/nmap/manifest.toml +159 -0
  90. tools/nuclei/__init__.py +1 -0
  91. tools/nuclei/adapter.py +171 -0
  92. tools/nuclei/manifest.toml +117 -0
  93. tools/searchsploit/__init__.py +1 -0
  94. tools/searchsploit/adapter.py +139 -0
  95. tools/searchsploit/manifest.toml +103 -0
  96. tools/sqlmap/__init__.py +1 -0
  97. tools/sqlmap/adapter.py +214 -0
  98. tools/sqlmap/manifest.toml +89 -0
  99. tools/subfinder/__init__.py +0 -0
  100. tools/subfinder/adapter.py +71 -0
  101. tools/subfinder/manifest.toml +104 -0
  102. tools/whois/__init__.py +0 -0
  103. tools/whois/adapter.py +80 -0
  104. tools/whois/manifest.toml +95 -0
ether/common/ssrf.py ADDED
@@ -0,0 +1,93 @@
1
+ """SSRF defense and destination verification primitives."""
2
+
3
+ import ipaddress
4
+ import socket
5
+ import urllib.parse
6
+ from typing import Set
7
+
8
+ from ether.common.algorithms import IPRadixTrie
9
+ from ether.common.exceptions import PolicyViolationError
10
+
11
+ BLOCKED_TARGET_NAMES: Set[str] = {
12
+ "metadata.google.internal",
13
+ "metadata.internal",
14
+ "instance-data",
15
+ }
16
+
17
+ BLOCKED_NETWORKS = [
18
+ ipaddress.ip_network("127.0.0.0/8"), # IPv4 Loopback
19
+ ipaddress.ip_network("::1/128"), # IPv6 Loopback
20
+ ipaddress.ip_network("169.254.0.0/16"), # IPv4 Link-Local / Cloud Metadata
21
+ ipaddress.ip_network("fe80::/10"), # IPv6 Link-Local
22
+ ipaddress.ip_network("fd00:ec2::/64"), # AWS IPv6 IMDSv2 metadata
23
+ ipaddress.ip_network("100.100.100.200/32"), # Alibaba Cloud metadata
24
+ ]
25
+
26
+ _BLOCKED_TRIE = IPRadixTrie()
27
+ for _net in BLOCKED_NETWORKS:
28
+ _BLOCKED_TRIE.insert(_net)
29
+
30
+
31
+ def parse_ip_or_host(target: str) -> str:
32
+ """Extract host/IP from URL, URI, or host:port string."""
33
+ target = target.strip()
34
+ if "://" in target:
35
+ parsed = urllib.parse.urlparse(target)
36
+ host = parsed.hostname or parsed.netloc
37
+ else:
38
+ host = target.split("/")[0].split("?")[0].split("#")[0]
39
+ if host.startswith("[") and "]" in host:
40
+ host = host[1 : host.index("]")]
41
+ elif ":" in host and host.count(":") == 1:
42
+ host = host.split(":")[0]
43
+ return host.strip("[]")
44
+
45
+
46
+ def is_ip_blocked(ip_obj: ipaddress.IPv4Address | ipaddress.IPv6Address) -> bool:
47
+ """Check if an IP object falls into any blocked subnet (loopback, metadata, link-local)."""
48
+ if hasattr(ip_obj, "ipv4_mapped") and ip_obj.ipv4_mapped:
49
+ ip_obj = ip_obj.ipv4_mapped
50
+ return _BLOCKED_TRIE.contains(ip_obj)
51
+
52
+
53
+ def check_ssrf_safety(target: str) -> None:
54
+ """Resolve target hostname/IP and enforce SSRF defense.
55
+
56
+ Raises:
57
+ PolicyViolationError: If destination resolves to loopback, link-local, or cloud metadata.
58
+ """
59
+ host = parse_ip_or_host(target).lower()
60
+ if not host:
61
+ raise PolicyViolationError("Empty or invalid target destination.")
62
+
63
+ if host in BLOCKED_TARGET_NAMES or any(b in host for b in ("169.254.", "metadata.")):
64
+ raise PolicyViolationError(
65
+ f"Target '{target}' blocked by SSRF policy (metadata keyword match)."
66
+ )
67
+
68
+ # Try direct IP parse
69
+ try:
70
+ ip_obj = ipaddress.ip_address(host)
71
+ if is_ip_blocked(ip_obj):
72
+ raise PolicyViolationError(f"Target '{target}' ({ip_obj}) blocked by SSRF policy.")
73
+ return
74
+ except ValueError:
75
+ pass
76
+
77
+ # Resolve hostname to all IP addresses
78
+ try:
79
+ addr_info = socket.getaddrinfo(host, None)
80
+ except socket.gaierror:
81
+ # If DNS cannot be resolved, let caller handle or reject
82
+ return
83
+
84
+ for _, _, _, _, sockaddr in addr_info:
85
+ resolved_ip_str = sockaddr[0]
86
+ try:
87
+ ip_obj = ipaddress.ip_address(resolved_ip_str)
88
+ if is_ip_blocked(ip_obj):
89
+ raise PolicyViolationError(
90
+ f"Target '{target}' resolved to blocked IP {resolved_ip_str} (SSRF defense)."
91
+ )
92
+ except ValueError:
93
+ continue
ether/core/__init__.py ADDED
@@ -0,0 +1,25 @@
1
+ """Core execution and process supervision engine."""
2
+
3
+ from ether.core.diagnostics import DiagnosticCheck, DiagnosticEngine, DiagnosticReport
4
+ from ether.core.executor import Executor, LogSpooler, sanitize_subprocess_env
5
+ from ether.core.sandbox import PromptInjectionSandbox
6
+ from ether.core.session import (
7
+ ActionValidator,
8
+ CommandRunner,
9
+ ExecutionSession,
10
+ TerminalSuspendContext,
11
+ )
12
+
13
+ __all__ = [
14
+ "ActionValidator",
15
+ "CommandRunner",
16
+ "DiagnosticCheck",
17
+ "DiagnosticEngine",
18
+ "DiagnosticReport",
19
+ "ExecutionSession",
20
+ "Executor",
21
+ "LogSpooler",
22
+ "PromptInjectionSandbox",
23
+ "TerminalSuspendContext",
24
+ "sanitize_subprocess_env",
25
+ ]
@@ -0,0 +1,368 @@
1
+ """Environmental diagnostics and system integrity auditing for Ether.
2
+
3
+ Audits runtime prerequisites, database schema integrity, file descriptor limits,
4
+ spooler storage permissions, and security tool binary discovery across Debian, Arch,
5
+ Fedora, and macOS.
6
+ """
7
+
8
+ import os
9
+ import platform
10
+ import resource
11
+ import shutil
12
+ import sys
13
+ from dataclasses import asdict, dataclass, field
14
+ from datetime import UTC, datetime
15
+ from typing import Any, Dict, List, Optional
16
+
17
+ from ether import paths
18
+ from ether.common.logging import get_recent_crash_summary
19
+ from ether.graph.store import GraphStore
20
+ from ether.registry.registry import ToolRegistry
21
+
22
+ INSTALLATION_HINTS: Dict[str, str] = {
23
+ "nmap": "sudo apt install nmap (or: pacman -S nmap / brew install nmap)",
24
+ "gobuster": "sudo apt install gobuster (or: go install github.com/OJ/gobuster/v3@latest)",
25
+ "nikto": "sudo apt install nikto (or: pacman -S nikto / brew install nikto)",
26
+ "subfinder": "go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest",
27
+ "whois": "sudo apt install whois (or: pacman -S whois / brew install whois)",
28
+ "dnspython": "pip install dnspython",
29
+ "ffuf": "sudo apt install ffuf (or: go install github.com/ffuf/ffuf/v2@latest)",
30
+ "nuclei": "go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest",
31
+ "searchsploit": "sudo apt install exploitdb (or: pacman -S exploitdb)",
32
+ "sqlmap": "sudo apt install sqlmap (or: pacman -S sqlmap / brew install sqlmap)",
33
+ "netexec": "pipx install netexec (or: sudo apt install netexec)",
34
+ "nxc": "pipx install netexec (or: sudo apt install netexec)",
35
+ }
36
+
37
+
38
+ @dataclass
39
+ class DiagnosticCheck:
40
+ name: str
41
+ category: str
42
+ status: str # "ok", "warning", "error", "info"
43
+ message: str
44
+ remedy: Optional[str] = None
45
+ details: Optional[Dict[str, Any]] = None
46
+
47
+
48
+ @dataclass
49
+ class DiagnosticReport:
50
+ timestamp: str = field(default_factory=lambda: datetime.now(UTC).isoformat())
51
+ system_info: Dict[str, Any] = field(default_factory=dict)
52
+ checks: List[DiagnosticCheck] = field(default_factory=list)
53
+ healthy: bool = True
54
+ tool_counts: Dict[str, int] = field(default_factory=dict)
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ return {
58
+ "timestamp": self.timestamp,
59
+ "system_info": self.system_info,
60
+ "healthy": self.healthy,
61
+ "tool_counts": self.tool_counts,
62
+ "checks": [asdict(c) for c in self.checks],
63
+ }
64
+
65
+ def summary(self) -> Dict[str, int]:
66
+ counts = {"ok": 0, "warning": 0, "error": 0, "info": 0}
67
+ for c in self.checks:
68
+ counts[c.status] = counts.get(c.status, 0) + 1
69
+ return counts
70
+
71
+
72
+ class DiagnosticEngine:
73
+ """Deep module managing environmental health auditing and system verification."""
74
+
75
+ def __init__(
76
+ self,
77
+ db_path: Optional[str] = None,
78
+ tools_dir: Optional[str] = None,
79
+ registry: Optional[ToolRegistry] = None,
80
+ ) -> None:
81
+ self.db_path = db_path or paths.get_default_db_path()
82
+ self.tools_dir = tools_dir
83
+ self.registry = registry or ToolRegistry(self.tools_dir)
84
+ if not self.registry.list_tools():
85
+ try:
86
+ self.registry.load_tools()
87
+ except Exception:
88
+ pass
89
+
90
+ async def run(self) -> DiagnosticReport:
91
+ """Run complete diagnostic audit and return structured report."""
92
+ report = DiagnosticReport()
93
+ self._check_system(report)
94
+ self._check_logs(report)
95
+ self._check_tools(report)
96
+ await self._check_database(report)
97
+ return report
98
+
99
+ def _check_system(self, report: DiagnosticReport) -> None:
100
+ """Evaluate Python runtime, platform, and process resource limits."""
101
+ py_version = sys.version_info
102
+ py_version_str = f"{py_version.major}.{py_version.minor}.{py_version.micro}"
103
+
104
+ # Resource limits: file descriptors
105
+ soft_fd, hard_fd = 1024, 4096
106
+ try:
107
+ soft_fd, hard_fd = resource.getrlimit(resource.RLIMIT_NOFILE)
108
+ except Exception:
109
+ pass
110
+
111
+ report.system_info = {
112
+ "python_version": py_version_str,
113
+ "platform": platform.platform(),
114
+ "executable": sys.executable,
115
+ "max_file_descriptors": {"soft": soft_fd, "hard": hard_fd},
116
+ }
117
+
118
+ # 1. Python runtime check
119
+ if py_version >= (3, 11):
120
+ report.checks.append(
121
+ DiagnosticCheck(
122
+ name="Python Runtime",
123
+ category="System",
124
+ status="ok",
125
+ message=f"Python {py_version_str} (>= 3.11 requirement satisfied)",
126
+ )
127
+ )
128
+ else:
129
+ report.checks.append(
130
+ DiagnosticCheck(
131
+ name="Python Runtime",
132
+ category="System",
133
+ status="error",
134
+ message=f"Python {py_version_str} is below minimum requirement 3.11",
135
+ remedy="Upgrade Python to 3.11 or newer",
136
+ )
137
+ )
138
+ report.healthy = False
139
+
140
+ # 2. File descriptor headroom
141
+ if soft_fd >= 1024:
142
+ report.checks.append(
143
+ DiagnosticCheck(
144
+ name="File Descriptor Limits",
145
+ category="System",
146
+ status="ok",
147
+ message=f"Soft limit: {soft_fd}, Hard limit: {hard_fd}",
148
+ )
149
+ )
150
+ else:
151
+ report.checks.append(
152
+ DiagnosticCheck(
153
+ name="File Descriptor Limits",
154
+ category="System",
155
+ status="warning",
156
+ message=f"Soft limit ({soft_fd}) is low for high-concurrency port scanning",
157
+ remedy="Increase file descriptor limits: ulimit -n 4096",
158
+ )
159
+ )
160
+
161
+ def _check_logs(self, report: DiagnosticReport) -> None:
162
+ """Verify centralized system logging directory and check for recent fatal crashes."""
163
+ data_dir = (
164
+ os.path.dirname(os.path.abspath(self.db_path)) if self.db_path != ":memory:" else None
165
+ )
166
+ logs_dir = paths.get_default_logs_dir(data_dir)
167
+ log_file = paths.get_system_log_path(data_dir)
168
+
169
+ is_writable = False
170
+ try:
171
+ if not os.path.exists(logs_dir):
172
+ os.makedirs(logs_dir, exist_ok=True)
173
+ is_writable = os.access(logs_dir, os.W_OK)
174
+ except Exception:
175
+ is_writable = False
176
+
177
+ if is_writable:
178
+ report.checks.append(
179
+ DiagnosticCheck(
180
+ name="Diagnostic Logs Directory",
181
+ category="Logging",
182
+ status="ok",
183
+ message=f"Logs directory '{logs_dir}' is writable",
184
+ )
185
+ )
186
+ else:
187
+ report.checks.append(
188
+ DiagnosticCheck(
189
+ name="Diagnostic Logs Directory",
190
+ category="Logging",
191
+ status="warning",
192
+ message=f"Logs directory '{logs_dir}' is not writable",
193
+ remedy=f"Grant write permissions: chmod 700 {logs_dir}",
194
+ )
195
+ )
196
+
197
+ crash = get_recent_crash_summary(data_dir)
198
+ if crash:
199
+ report.checks.append(
200
+ DiagnosticCheck(
201
+ name="Recent Crash Audit",
202
+ category="Logging",
203
+ status="warning",
204
+ message=f"Recent crash recorded [{crash['timestamp']}]: {crash['summary']}",
205
+ details=crash,
206
+ remedy="Inspect crash trace in system.log",
207
+ )
208
+ )
209
+ else:
210
+ report.checks.append(
211
+ DiagnosticCheck(
212
+ name="Recent Crash Audit",
213
+ category="Logging",
214
+ status="ok",
215
+ message=f"No unhandled crashes recorded in log ({log_file})",
216
+ )
217
+ )
218
+
219
+ async def _check_database(self, report: DiagnosticReport) -> None:
220
+ """Verify database directory permissions, SQLite schema integrity, and WAL mode."""
221
+ db_dir = (
222
+ os.path.dirname(os.path.abspath(self.db_path)) if self.db_path != ":memory:" else None
223
+ )
224
+ if db_dir:
225
+ try:
226
+ os.makedirs(db_dir, exist_ok=True)
227
+ is_writable = os.access(db_dir, os.W_OK)
228
+ except Exception:
229
+ is_writable = False
230
+
231
+ if is_writable:
232
+ report.checks.append(
233
+ DiagnosticCheck(
234
+ name="Storage Directory",
235
+ category="Database",
236
+ status="ok",
237
+ message=f"Directory '{db_dir}' is writable",
238
+ )
239
+ )
240
+ else:
241
+ report.checks.append(
242
+ DiagnosticCheck(
243
+ name="Storage Directory",
244
+ category="Database",
245
+ status="error",
246
+ message=f"Directory '{db_dir}' is not writable",
247
+ remedy=f"Grant write permissions: chmod 700 {db_dir}",
248
+ )
249
+ )
250
+ report.healthy = False
251
+
252
+ store = GraphStore(self.db_path)
253
+ try:
254
+ await store.initialize()
255
+ integrity_status, tables = await store.check_integrity()
256
+ if integrity_status == "ok":
257
+ report.checks.append(
258
+ DiagnosticCheck(
259
+ name="SQLite Integrity",
260
+ category="Database",
261
+ status="ok",
262
+ message=f"Database '{self.db_path}' verified ({len(tables)} tables present)",
263
+ details={"tables": tables},
264
+ )
265
+ )
266
+ else:
267
+ report.checks.append(
268
+ DiagnosticCheck(
269
+ name="SQLite Integrity",
270
+ category="Database",
271
+ status="error",
272
+ message=f"Database integrity check failed: {integrity_status}",
273
+ remedy="Rebuild or repair SQLite database",
274
+ )
275
+ )
276
+ report.healthy = False
277
+ except Exception as e:
278
+ report.checks.append(
279
+ DiagnosticCheck(
280
+ name="SQLite Database",
281
+ category="Database",
282
+ status="error",
283
+ message=f"Failed to initialize database: {e}",
284
+ remedy=f"Check permissions and path for '{self.db_path}'",
285
+ )
286
+ )
287
+ report.healthy = False
288
+ finally:
289
+ await store.close()
290
+
291
+ def _check_tools(self, report: DiagnosticReport) -> None:
292
+ """Check discovery and binary availability for all registered security tool adapters."""
293
+ available_count = 0
294
+ missing_count = 0
295
+
296
+ for tool_name in self.registry.list_tools():
297
+ tool_data = self.registry.get_tool(tool_name)
298
+ binary_name = tool_name
299
+ if tool_data and "manifest" in tool_data:
300
+ binary_name = getattr(tool_data["manifest"], "binary", tool_name)
301
+
302
+ bin_path = shutil.which(binary_name)
303
+ if bin_path:
304
+ available_count += 1
305
+ report.checks.append(
306
+ DiagnosticCheck(
307
+ name=f"Tool: {tool_name}",
308
+ category="Tools",
309
+ status="ok",
310
+ message=f"Binary '{binary_name}' found at {bin_path}",
311
+ details={"path": bin_path, "tool": tool_name},
312
+ )
313
+ )
314
+ else:
315
+ missing_count += 1
316
+ remedy = INSTALLATION_HINTS.get(tool_name, f"Install '{tool_name}' on host system")
317
+ report.checks.append(
318
+ DiagnosticCheck(
319
+ name=f"Tool: {tool_name}",
320
+ category="Tools",
321
+ status="info",
322
+ message=f"Binary '{binary_name}' is not installed",
323
+ remedy=remedy,
324
+ details={"tool": tool_name},
325
+ )
326
+ )
327
+
328
+ report.tool_counts = {
329
+ "available": available_count,
330
+ "missing": missing_count,
331
+ "total": available_count + missing_count,
332
+ }
333
+
334
+ @staticmethod
335
+ def format_terminal_report(report: DiagnosticReport) -> str:
336
+ """Format the diagnostic report for terminal display."""
337
+ lines = []
338
+ lines.append("=" * 60)
339
+ lines.append("Ether System & Environmental Diagnostic Report")
340
+ lines.append("=" * 60)
341
+ lines.append(f"Timestamp: {report.timestamp}")
342
+ lines.append(f"Python: {report.system_info.get('python_version', 'Unknown')}")
343
+ lines.append(f"Platform: {report.system_info.get('platform', 'Unknown')}")
344
+ lines.append(
345
+ f"Tools: {report.tool_counts.get('available', 0)} installed, {report.tool_counts.get('missing', 0)} missing"
346
+ )
347
+ lines.append("-" * 60)
348
+
349
+ current_category = None
350
+ for check in report.checks:
351
+ if check.category != current_category:
352
+ current_category = check.category
353
+ lines.append(f"\n[{current_category}]")
354
+
355
+ status_tag = f"[{check.status.upper()}]"
356
+ lines.append(f" {status_tag:<9} {check.name}: {check.message}")
357
+ if check.remedy:
358
+ lines.append(f" Remedy: {check.remedy}")
359
+
360
+ lines.append("-" * 60)
361
+ summary = report.summary()
362
+ status_line = (
363
+ f"Result: {'HEALTHY' if report.healthy else 'UNHEALTHY'} "
364
+ f"({summary.get('ok', 0)} passed, {summary.get('warning', 0)} warnings, {summary.get('error', 0)} errors)"
365
+ )
366
+ lines.append(status_line)
367
+ lines.append("=" * 60)
368
+ return "\n".join(lines)