parent
8058f9b814
commit
530faf6b45
|
|
@ -157,7 +157,7 @@ class Fail2BanJailModal extends ModalComponent
|
|||
return ['permanent', $banAt ? ('seit '.$this->fmtTs($banAt)) : '—', $rose];
|
||||
}
|
||||
if ($remaining === -2) {
|
||||
return ['~ '.$this->fmtSecs($this->getApproxBantime()), '—', $amber];
|
||||
return ['~ '.$this->fmtSecs($this->getBantime($this->jail)), '—', $amber];
|
||||
}
|
||||
if (is_int($remaining)) {
|
||||
if ($remaining > 0) {
|
||||
|
|
@ -171,8 +171,7 @@ class Fail2BanJailModal extends ModalComponent
|
|||
return ['—', '—', $muted];
|
||||
}
|
||||
|
||||
private function getApproxBantime(): int { return 600; }
|
||||
|
||||
private function getApproxBantime(): int { return $this->getBantime($this->jail); }
|
||||
private function f2b(string $args): array
|
||||
{
|
||||
$sudo = $this->bin('sudo');
|
||||
|
|
@ -206,7 +205,7 @@ class Fail2BanJailModal extends ModalComponent
|
|||
ORDER BY timeofban DESC LIMIT 1",
|
||||
$this->sql($jail), $this->sql($ip)
|
||||
);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
|
||||
$out = trim((string)@shell_exec($cmd));
|
||||
if ($out === '') return null;
|
||||
[$timeofban, $expire] = array_map('intval', explode('|', $out)) + [null, null];
|
||||
|
|
@ -220,7 +219,7 @@ class Fail2BanJailModal extends ModalComponent
|
|||
ORDER BY timeofban DESC LIMIT 1",
|
||||
$this->sql($jail), $this->sql($ip)
|
||||
);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
|
||||
$out = trim((string)@shell_exec($cmd));
|
||||
if ($out === '') return null;
|
||||
[$timeofban, $bantime] = array_map('intval', explode('|', $out)) + [null, null];
|
||||
|
|
@ -235,7 +234,7 @@ class Fail2BanJailModal extends ModalComponent
|
|||
ORDER BY timeofban DESC LIMIT 1",
|
||||
$this->sql($jail), $this->sql($ip)
|
||||
);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
|
||||
$out = trim((string)@shell_exec($cmd));
|
||||
if ($out === '') return null;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue