207 lines
5.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Network MCP Hosts</title>
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #0f172a;
color: #e2e8f0;
margin: 0;
padding: 0 1.5rem 2rem;
}
header {
padding: 2rem 0 1rem;
}
h1 {
margin: 0;
}
.metrics {
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin: 1rem 0 2rem;
}
.metric-card {
background: #1e293b;
padding: 1rem 1.5rem;
border-radius: 0.75rem;
border: 1px solid #334155;
min-width: 160px;
}
.metric-card h3 {
margin: 0;
font-size: 0.9rem;
color: #94a3b8;
}
.metric-card p {
margin: 0.4rem 0 0;
font-size: 1.5rem;
font-weight: bold;
color: #f1f5f9;
}
.hosts-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1rem;
}
.host-card {
background: #1e293b;
border-radius: 0.75rem;
border: 1px solid #334155;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.host-card h2 {
margin: 0;
font-size: 1.1rem;
color: #f8fafc;
display: flex;
justify-content: space-between;
align-items: center;
}
.sources span {
display: inline-block;
font-size: 0.7rem;
padding: 0.15rem 0.4rem;
margin-right: 0.3rem;
border-radius: 0.4rem;
background: #0f766e;
}
.hosts-card ul {
margin: 0;
padding-left: 1.2rem;
}
.port-list {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
}
.port-chip {
background: #0f172a;
border: 1px solid #334155;
border-radius: 9999px;
padding: 0.2rem 0.6rem;
font-size: 0.8rem;
}
.notes {
font-size: 0.9rem;
color: #cbd5f5;
}
.source-tag-inventory {
background: #a855f7;
}
.source-tag-opnsense {
background: #0284c7;
}
.source-tag-nmap {
background: #ea580c;
}
.source-tag-discovery {
background: #0ea5e9;
}
.section-title {
font-size: 0.9rem;
color: #94a3b8;
margin: 0;
}
.ips, .notes, .last-seen {
font-size: 0.9rem;
}
</style>
</head>
<body>
<header>
<h1>Network MCP Overview</h1>
<p class="last-seen">Elasticsearch: {{ es_url }}</p>
</header>
<section class="metrics">
<div class="metric-card">
<h3>Total Hosts</h3>
<p>{{ total }}</p>
</div>
<div class="metric-card">
<h3>With Port Data</h3>
<p>{{ with_ports }}</p>
</div>
<div class="metric-card">
<h3>Inventory Entries</h3>
<p>{{ inventory_hosts }}</p>
</div>
</section>
<section class="hosts-grid">
{% for host in hosts %}
<article class="host-card">
<h2>{{ host.name }}
{% if host.notes %}
<span title="Inventory notes available">📝</span>
{% endif %}
</h2>
<div class="sources">
{% for source in host.sources %}
{% set tag_class = "" %}
{% if source == "inventory" %}
{% set tag_class = "source-tag-inventory" %}
{% elif source.startswith("opnsense") %}
{% set tag_class = "source-tag-opnsense" %}
{% elif source == "nmap" %}
{% set tag_class = "source-tag-nmap" %}
{% elif source == "nmap-discovery" %}
{% set tag_class = "source-tag-discovery" %}
{% endif %}
<span class="{{ tag_class }}">{{ source }}</span>
{% endfor %}
</div>
<div class="ips">
<strong>IPs:</strong> {{ host.ips|join(", ") if host.ips else "—" }}
</div>
{% if host.macs %}
<div class="ips">
<strong>MACs:</strong> {{ host.macs|join(", ") }}
</div>
{% endif %}
{% if host.hostnames %}
<div class="ips">
<strong>Hostnames:</strong> {{ host.hostnames|join(", ") }}
</div>
{% endif %}
<div class="last-seen">
<strong>Last seen:</strong> {{ host.last_seen or "unknown" }}
</div>
{% if host.notes %}
<div class="notes">
<strong>Notes:</strong> {{ host.notes }}
</div>
{% endif %}
{% if host.expected_ports %}
<div>
<p class="section-title">Expected Ports</p>
<div class="port-list">
{% for port in host.expected_ports %}
<span class="port-chip">{{ port }}</span>
{% endfor %}
</div>
</div>
{% endif %}
{% if host.ports %}
<div>
<p class="section-title">Observed Ports</p>
<div class="port-list">
{% for port in host.ports %}
<span class="port-chip">{{ port.port }} {{ port.service or "" }}</span>
{% endfor %}
</div>
</div>
{% endif %}
</article>
{% endfor %}
</section>
</body>
</html>