mirror of
https://github.com/SubleXBle/Fail2Ban-Report.git
synced 2026-02-10 19:00:27 -06:00
Update blocklist-stats.php
wrong file fixed -reverted it back
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// Set correct path to your blocklist directory
|
||||
$blocklistDir = '/var/www/vhosts/suble.org/xbkupx/Fail2Ban-Report/archive/';
|
||||
$blocklistDir = dirname(__DIR__) . '/archive/';
|
||||
$stats = [];
|
||||
|
||||
foreach (glob($blocklistDir . '*.blocklist.json') as $filepath) {
|
||||
@@ -22,21 +22,14 @@ foreach (glob($blocklistDir . '*.blocklist.json') as $filepath) {
|
||||
$pending = 0;
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
// Count pending entries (pending === true)
|
||||
if (isset($entry['pending']) && $entry['pending'] === true) {
|
||||
$pending++;
|
||||
if (!isset($entry['active'])) continue;
|
||||
if ($entry['active'] === true) {
|
||||
$active++;
|
||||
} else {
|
||||
$pending++;
|
||||
}
|
||||
}
|
||||
|
||||
// Count active entries only if not pending
|
||||
if (
|
||||
isset($entry['active']) && $entry['active'] === true &&
|
||||
(!isset($entry['pending']) || $entry['pending'] === false)
|
||||
) {
|
||||
$active++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Store result
|
||||
$stats[$jail] = [
|
||||
'active' => $active,
|
||||
|
||||
Reference in New Issue
Block a user