Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2864 → Rev 2865

/web/acc/manager/htdocs/security.php
11,15 → 11,30
$l_spoofing = "Adresse(s) MAC usurpée(s) (Watchdog)";
$l_virus = "Virus bloqué(s) (CLAMAV)";
$l_fail2ban = "Adresse(s) IP bloquée(s) (Fail2Ban)";
$l_ban_date = "Date de bloquage";
$l_unban_date = "Date de débloquage";
$l_ipAddress="Adresse IP";
$l_user = "L'utilisateur";
$l_empty="Vide";
$l_rule="Règle";
} else if ($language === 'es') {
$l_title = 'Seguridad';
$l_spoofing = "Direcciones MAC usurpadas (Watchdog)";
$l_virus = "Virus bloqueado (CLAMAV)";
$l_fail2ban = "Dirección(es) IP bloqueada(s) (Fail2Ban)";
$l_ban_date = "Fecha de bloqueo";
$l_unban_date = "Fecha de desembolso";
$l_ipAddress="Dirección ip";
$l_user = "El usuario";
$l_empty="Vacío";
$l_rule="Regla";
} else {
$l_title = 'Security';
$l_spoofing = "MAC address spoofed (Watchdog)";
$l_virus = "Virus blocked (CLAMAV)";
$l_fail2ban = "IP address blocked (Fail2Ban)";
$l_ban_date = "Lock date";
$l_unban_date = "Unlock date";
$l_ipAddress="IP address";
$l_user = "User";
$l_empty="Empty";
54,6 → 69,7
if ($file) {
while (!feof($file)) {
$line = fgets($file);
 
if (preg_match($regex, $line, $matches)) {
if (preg_match('/[0-9]{2}\/[0-9]{2}\/[0-9]{4}-[0-9]{2}:[0-9]{2}:[0-9]{2}/', $matches['date'], $matches_date)) {
$matches['date'] = DateTime::createFromFormat('d/m/Y-H:i:s', $matches['date'])->format('Y-m-d H:i:s');
125,12 → 141,11
<?php
} else if ($tab === 3) {
$bans = [];
$regex = '/^(?P<date>[0-9]{4}-[0-9]{2}-[0-9]{2}\ [0-9]{2}:[0-9]{2}:[0-9]{2}),[0-9]{3} fail2ban\.actions\[[0-9]+\]: NOTICE \[(?P<rule>[a-zA-Z0-9_-]+)\] (?P<type>Ban|Unban) (?P<ip>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$/';
$regex = '/^(?P<date>[0-9]{4}-[0-9]{2}-[0-9]{2}[ \t]+[0-9]{2}:[0-9]{2}:[0-9]{2}),[0-9]{3}[ \t]+fail2ban\.actions[ \t]+\[[0-9]+\]:[ \t]+NOTICE[ \t]+\[(?P<rule>[a-zA-Z0-9_-]+)\][ \t]+(?P<type>Ban|Unban)[ \t]+(?P<ip>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/';
$file = fopen('/var/log/fail2ban.log', 'r');
if ($file) {
while (!feof($file)) {
$line = fgets($file);
 
if (preg_match($regex, $line, $matches)) {
if ($matches['type'] === 'Ban') {
$bans[] = (object) [
158,10 → 173,10
<table class="table table-striped table-hover" border="1">
<tr >
<th>
Date
<?= $l_ban_date ?>
</th>
<th>
Date Unban
<?= $l_unban_date ?>
</th>
<th>
<?= $l_rule ?>