update front end

This commit is contained in:
2025-09-28 09:05:27 +01:00
parent 843080e455
commit 58d870ba46
4 changed files with 163 additions and 72 deletions
+34
View File
@@ -0,0 +1,34 @@
{{ define "title" }}Honeypot Dashboard{{ end }}
{{ define "content" }}
<div class="space-y-8">
<h1 class="text-2xl font-semibold text-white">Honeypot Overview</h1>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="bg-gray-800 border border-gray-700 rounded-lg p-4">
<div class="text-sm text-gray-400">Total IPs</div>
<div class="text-3xl font-bold text-primary-400">{{ index .Stats "total_ips" }}</div>
</div>
<div class="bg-gray-800 border border-gray-700 rounded-lg p-4">
<div class="text-sm text-gray-400">Blacklisted</div>
<div class="text-3xl font-bold text-primary-400">{{ index .Stats "blacklisted_ips" }}</div>
</div>
<div class="bg-gray-800 border border-gray-700 rounded-lg p-4">
<div class="text-sm text-gray-400">Connections</div>
<div class="text-3xl font-bold text-primary-400">{{ index .Stats "total_connections" }}</div>
</div>
<div class="bg-gray-800 border border-gray-700 rounded-lg p-4">
<div class="text-sm text-gray-400">Auth Attempts</div>
<div class="text-3xl font-bold text-primary-400">{{ index .Stats "total_auth_attempts" }}</div>
</div>
</div>
<div>
<h2 class="text-xl font-semibold text-white mb-3">Quick Actions</h2>
<div class="flex flex-wrap gap-3">
<a class="px-4 py-2 bg-primary-600 hover:bg-primary-500 rounded text-white" href="/logs">View Recent Logs</a>
<a class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded text-white" href="/threats">View Top Threats</a>
<a class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded text-white" href="/blacklist">Manage Blacklist</a>
<a class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded text-white" href="/stats">Detailed Statistics</a>
</div>
</div>
</div>
{{ end }}
{{ define "index" }}{{ template "layout.html" . }}{{ end }}
+46
View File
@@ -0,0 +1,46 @@
<!doctype html>
<html class="dark h-full">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ block "title" . }}Honeypot Dashboard{{ end }}</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
primary: {
50: '#eff6ff', 100: '#dbeafe', 200: '#bfdbfe', 300: '#93c5fd', 400: '#60a5fa',
500: '#3b82f6', 600: '#2563eb', 700: '#1d4ed8', 800: '#1e40af', 900: '#1e3a8a'
}
}
}
}
}
</script>
</head>
<body class="h-full bg-gray-900 text-gray-100">
<div class="min-h-full">
<nav class="bg-gray-800 border-b border-gray-700">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div class="flex h-16 items-center justify-between">
<div class="flex items-center space-x-8">
<a href="/" class="text-primary-400 hover:text-primary-300 font-semibold">🍯 Honeypot</a>
<a href="/logs" class="text-gray-300 hover:text-white">Recent Logs</a>
<a href="/threats" class="text-gray-300 hover:text-white">Top Threats</a>
<a href="/blacklist" class="text-gray-300 hover:text-white">Blacklist</a>
<a href="/stats" class="text-gray-300 hover:text-white">Statistics</a>
</div>
<div class="text-xs text-gray-400">{{ .Now }}</div>
</div>
</div>
</nav>
<main class="mx-auto max-w-7xl py-6 sm:px-6 lg:px-8">
{{ block "content" . }}{{ end }}
</main>
<footer class="border-t border-gray-800 py-6 text-center text-gray-500 text-sm">Honeypot Dashboard</footer>
</div>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
{{ define "title" }}Recent Logs{{ end }}
{{ define "content" }}
<h1 class="text-2xl font-semibold text-white mb-4">Recent Logs</h1>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-700">
<thead class="bg-gray-800">
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Time</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Remote</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Service</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Details</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Payload</th>
</tr>
</thead>
<tbody class="bg-gray-900 divide-y divide-gray-800">
{{ range .Rows }}
<tr>
<td class="px-4 py-2 text-sm text-gray-300">{{ .Timestamp.Format "2006-01-02 15:04:05" }}</td>
<td class="px-4 py-2 text-sm text-gray-300">{{ .RemoteAddr }}:{{ .RemotePort }}</td>
<td class="px-4 py-2 text-sm text-gray-300">{{ .Service }}</td>
<td class="px-4 py-2 text-sm text-gray-300"><pre class="whitespace-pre-wrap max-w-xs overflow-auto">{{ .Details | toJSON }}</pre></td>
<td class="px-4 py-2 text-sm text-gray-300"><pre class="whitespace-pre-wrap max-w-xs overflow-auto">{{ .RawPayload }}</pre></td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ end }}
{{ define "logs" }}{{ template "layout.html" . }}{{ end }}