"""Custom Gradio tab for OpenRange — cybersecurity range dashboard. Renders a network topology visualization, live action feed, flag status, and reward dashboard as a custom tab alongside the default OpenEnv Playground. Signature matches the gradio_builder contract from OpenEnv. """ from __future__ import annotations from typing import Any, Dict, List, Optional import gradio as gr def _range_dashboard_html() -> str: """Static HTML for the OpenRange dashboard overview.""" return """

Network Topology

External
🖥
attacker
10.0.0.10
🛡
firewall
10.0.0.2
DMZ
🌐
web
10.0.1.10
mail
10.0.1.11
Internal
💾
db
10.0.2.20
📁
files
10.0.2.21
Management
🔑
ldap
10.0.3.20
📊
siem
10.0.3.21

Red Rewards

Flag Capture
0.0
Efficiency
0.8
Stealth
1.0
Anti-Halluc
0.0

Blue Rewards

Detection
0.0
Patch Valid
0.0
Availability
1.0
FP Penalty
0.0

Flags

🚩 FLAG{...} — Web Application pending
🚩 FLAG{...} — Database pending

Use the Playground tab to reset and interact. Flags update after submit_flag.

""" def build_openrange_gradio_app( web_manager: Any, action_fields: List[Dict[str, Any]], metadata: Any, is_chat_env: bool, title: str, quick_start_md: str, ) -> gr.Blocks: """Build the Custom tab for OpenRange: network topology + dashboard. Signature matches the gradio_builder contract (see OpenEnv docs). """ with gr.Blocks(title=f"{title} — Range Dashboard") as blocks: gr.Markdown("# Range Dashboard") gr.Markdown( "This tab shows the **network topology**, reward signals, and flag status. " "Use the **Playground** tab to Reset and Step with commands " "(e.g. `nmap -sV 10.0.1.0/24`)." ) gr.HTML(value=_range_dashboard_html()) return blocks