-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathheader.php
More file actions
161 lines (135 loc) · 4.43 KB
/
header.php
File metadata and controls
161 lines (135 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en">
<head>
<?php require_once __DIR__ . '/auth.php'; ?>
<meta charset="UTF-8" />
<title>Fail2Ban Report</title>
<meta name="viewport" content="width=device-width, initial-scale=0.8">
<link rel="stylesheet" href="assets/css/style.css" />
<link rel="icon" href="assets/images/favicon1.png" type="image/png">
<script>
const availableFiles = <?php echo $filesJson; ?>;
</script>
<script>
const statsFile = 'fail2ban-events-<?php echo date("Ymd"); ?>.json';
</script>
<script src="assets/js/jsonreader.js" defer></script>
<script src="assets/js/notifications.js"></script>
<script src="assets/js/action-collector.js" defer></script>
<script src="assets/js/action.js" defer></script>
<script src="assets/js/blocklist-overlay.js" defer></script>
<script src="assets/js/fail2ban-logstats.js" defer></script>
<script src="assets/js/blocklist-stats.js"></script>
<script src="assets/js/warnings.js"></script>
<script src="assets/js/table-export.js"></script>
<script src="assets/js/ufw-report.js"></script>
<!-- Auth -->
<?php
if (!isset($_SESSION['user_role'])) {
die("Session not active. Please login.");
}
?>
<!-- Auth -->
</head>
<body>
<div class="sessionheader">
<div>
<h1>Fail2Ban-Report</h1>
<h2>Let's catch the bad guys!</h2>
<div>
<span title="Beta 5.0"><small>Version : 0.5.0</small> 🕵️</span></div>
</div>
<!-- Show User and Server -->
<!--
<div>
<?php
if (isset($_SESSION['username'])) {
echo "<h3>".$_SESSION['username']." @ ".$activeServer."</h3>";
} else {
echo "<h4>viewer @ ".$activeServer."</h4>";
}
?>
</div>
-->
<!-- Show User and Server -->
<!-- Log in/out -->
<?php if (!isset($_SESSION['username'])) : ?>
<div>
<form method="post" action="">
<small>
<label for="login_user">User:</label>
<input type="text" name="login_user" id="login_user" required>
<label for="login_pass">Password:</label>
<input type="password" name="login_pass" id="login_pass" required>
</small>
<button class="button-reset" type="submit">Login</button>
</form>
</div>
<?php else : ?>
<div>
<form method="post" action="">
<button class="button-reset" type="submit" name="logout" value="1">Logout</button>
</form>
</div>
<?php endif; ?>
<!-- Log in/out -->
<!-- Serverselect -->
<div>
<form method="post" style="margin-bottom: 1em;">
<label for="server">
<?php
if (isset($_SESSION['username'])) {
echo "<span style='color: #d4af37; font-weight: bold;'>".$_SESSION['username']."</span> @";
} else {
echo "guest @";
}
?>
</label>
<select name="server" id="server" onchange="this.form.submit()">
<?php
foreach ($SERVERS as $key => $name) {
$selected = ($key === $activeServer) ? "selected" : "";
echo "<option value='$key' $selected>$name</option>";
}
?>
</select>
</form>
</div>
<!-- Serverselect -->
</div>
<!- Second row here -->
<div class="inline-headlines">
<div id="fail2ban-alerts-container">
<div class="headhead"><span title="Shows Jail | Events | Unique IPs">DoS/Scan/BF:</span></div>
<div id="fail2ban-warning-status" class="fail2ban-status">
<span class="status-dot yellow" id="warning-dot" title="No warnings">🟡</span>
<span class="status-label" id="warning-label">none</span>
</div>
<div id="fail2ban-critical-status" class="fail2ban-status">
<span class="status-dot red" id="critical-dot" title="No criticals">🔴</span>
<span class="status-label" id="critical-label">none</span>
</div>
</div>
<div class="fail2ban-alerts-container">
<div class="headhead">Top 3 Bans/Jails:</div>
<div id="fail2ban-top3-jails" class="toplist"></div>
</div>
<div id="fail2ban-stats">
<div class="headhead">Fail2Ban Today:</div>
<div>🚫 Bans: <span id="fail2ban-bans">--</span></div>
<div>🟢 Unbans: <span id="fail2ban-unbans">--</span></div>
<div>📊 Total: <span id="fail2ban-total">--</span></div>
</div>
<div class="history-stats">
<div class="headhead">Fail2Ban History:</div>
<div class="headstat">🕓 Yesterd: <span id="fail2ban-yesterday">--</span></div>
<div class="headstat">📅 7 Days : <span id="fail2ban-last7">--</span></div>
<div class="headstat">📆 30 Days: <span id="fail2ban-last30">--</span></div>
</div>
<div id="blocklist-stats">
<div class="headhead">Fail2Ban-Report Blocklists:</div>
<div id="blocklist-stats-container">
<!-- JS render Jails here -->
</div>
</div>
</div>