patchcenter/app/templates/audit_full_flowmap.html
Khalid MOUTAOUAKIL 20cd9c7d80 Audit complet: import JSON, carte flux, carte applicative
- server_audit_full_service.py: SSH PSMP/cle, parsing, stockage JSONB, flow map
- server_audit.sh: script bash avec sudo (compatible PSMP cybsecope)
- audit_full router: import JSON, liste, detail, carte flux
- Templates: liste audits, detail 8 onglets, carte flux + carte applicative
- Jointures: server_id via servers, dest_server via server_ips
- Sous-menu Audit > Complet dans la sidebar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 16:06:55 +02:00

71 lines
3.3 KiB
HTML

{% extends 'base.html' %}
{% block title %}Carte flux{% endblock %}
{% block content %}
<a href="/audit-full" class="text-xs text-gray-500 hover:text-gray-300">< Retour</a>
<h2 class="text-xl font-bold text-cyber-accent mb-4">Carte des flux reseau</h2>
{% if flows %}
<div class="card overflow-x-auto mb-4">
<div class="p-2 border-b border-cyber-border">
<span class="text-xs font-bold text-cyber-accent">{{ flows|length }} flux inter-serveurs</span>
</div>
<table class="w-full table-cyber text-xs">
<thead><tr>
<th class="p-2">Dir</th>
<th class="text-left p-2">Source</th>
<th class="p-2">IP source</th>
<th class="text-left p-2">Destination</th>
<th class="p-2">IP dest</th>
<th class="p-2">Port</th>
<th class="p-2">Process</th>
<th class="p-2">State</th>
<th class="p-2">Nb</th>
</tr></thead>
<tbody>
{% for f in flows %}
<tr class="{% if f.state == 'CLOSE-WAIT' %}bg-red-900/10{% endif %}">
<td class="p-2 text-center"><span class="badge {% if f.direction == 'IN' %}badge-green{% else %}badge-yellow{% endif %}">{{ f.direction }}</span></td>
<td class="p-2 font-mono text-cyber-accent">{{ f.source_hostname }}</td>
<td class="p-2 font-mono text-gray-500 text-center">{{ f.source_ip }}</td>
<td class="p-2 font-mono {% if f.dest_hostname %}text-cyber-accent{% else %}text-gray-400{% endif %}">{{ f.dest_hostname or '-' }}</td>
<td class="p-2 font-mono text-gray-500 text-center">{{ f.dest_ip }}</td>
<td class="p-2 text-center font-bold">{{ f.dest_port }}</td>
<td class="p-2 text-center">{{ f.process_name }}</td>
<td class="p-2 text-center"><span class="badge {% if f.state == 'ESTAB' %}badge-green{% elif f.state == 'CLOSE-WAIT' %}badge-red{% else %}badge-gray{% endif %}">{{ f.state }}</span></td>
<td class="p-2 text-center">{{ f.cnt }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="card p-8 text-center text-gray-500">Aucun flux. Importez des rapports JSON d'abord.</div>
{% endif %}
{% if app_map %}
<h3 class="text-lg font-bold text-cyber-accent mb-3">Carte applicative</h3>
<div class="grid grid-cols-2 gap-3">
{% for app_name, app in app_map.items() %}
<div class="card p-3">
<div class="flex justify-between items-center mb-2">
<span class="text-sm font-bold text-cyber-yellow">{{ app_name }}</span>
<span class="badge badge-blue">{{ app.servers|length }} serveur(s)</span>
</div>
{% if app.ports %}
<div class="text-xs text-gray-500 mb-2">Ports: {% for p in app.ports %}<span class="font-mono text-cyber-accent">{{ p }}</span>{% if not loop.last %}, {% endif %}{% endfor %}</div>
{% endif %}
<div class="space-y-1">
{% for s in app.servers %}
<div class="text-xs font-mono">
<span class="text-cyber-accent">{{ s.hostname }}</span>
<span class="text-gray-500">user={{ s.user }}</span>
<span class="text-gray-600">{{ s.cmdline[:50] }}</span>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}