parent
2f390af9ed
commit
a3a4ec4d06
|
|
@ -248,23 +248,16 @@ class Fail2BanJailModal extends ModalComponent
|
|||
|
||||
private function isStillBanned(string $jail, string $ip): bool
|
||||
{
|
||||
// 1) Direkt: banip
|
||||
// 1) Direktcheck: liefert 1/0 je nach Version, ist harmlos wenn 0
|
||||
[, $out1] = $this->f2b('get '.escapeshellarg($jail).' banip '.escapeshellarg($ip));
|
||||
if (preg_match('/\b1\b/', $out1)) return true;
|
||||
|
||||
// 2) Liste: banlist (Rohliste, whitespace-separiert)
|
||||
[, $out2] = $this->f2b('get '.escapeshellarg($jail).' banlist');
|
||||
if ($out2 !== '') {
|
||||
$list = array_filter(array_map('trim', preg_split('/\s+/', trim($out2))));
|
||||
if (in_array($ip, $list, true)) return true;
|
||||
}
|
||||
|
||||
// 3) Notfall: status-Parsing
|
||||
// 2) Fallback: aus `status <jail>` die Liste parsen (das hast du ohnehin)
|
||||
[, $out3] = $this->f2b('status '.escapeshellarg($jail));
|
||||
$ipList = $this->firstMatch('/Banned IP list:\s*(.+)$/mi', $out3) ?: '';
|
||||
return $ipList !== '' && preg_match('/(^|\s)'.preg_quote($ip,'/').'(\s|$)/', $ipList) === 1;
|
||||
}
|
||||
|
||||
|
||||
private function getBantime(string $jail): int
|
||||
{
|
||||
[, $out] = $this->f2b('get '.escapeshellarg($jail).' bantime');
|
||||
|
|
|
|||
Loading…
Reference in New Issue