mirror of https://github.com/fail2ban/fail2ban
parent
00bb41b864
commit
f8a269eaad
|
@ -268,7 +268,6 @@ check_ip_in_abuseipdb() {
|
||||||
http_status="${response##*${delimiter}}"
|
http_status="${response##*${delimiter}}"
|
||||||
body="${response%"${delimiter}${http_status}"}"
|
body="${response%"${delimiter}${http_status}"}"
|
||||||
|
|
||||||
|
|
||||||
if [[ ! "${http_status}" =~ ^[0-9]+$ ]]; then
|
if [[ ! "${http_status}" =~ ^[0-9]+$ ]]; then
|
||||||
log_message "ERROR: Invalid HTTP status in Response: ${response}"
|
log_message "ERROR: Invalid HTTP status in Response: ${response}"
|
||||||
return 2
|
return 2
|
||||||
|
@ -291,10 +290,7 @@ check_ip_in_abuseipdb() {
|
||||||
}
|
}
|
||||||
|
|
||||||
convert_bantime() {
|
convert_bantime() {
|
||||||
local bantime=$1
|
local bantime=$1 time_value time_unit
|
||||||
local time_value
|
|
||||||
local time_unit
|
|
||||||
|
|
||||||
if [[ "${bantime}" =~ ^[0-9]+$ ]]; then
|
if [[ "${bantime}" =~ ^[0-9]+$ ]]; then
|
||||||
echo "${bantime}"
|
echo "${bantime}"
|
||||||
return 0
|
return 0
|
||||||
|
@ -304,15 +300,14 @@ convert_bantime() {
|
||||||
time_unit="${bantime#${time_value}}"
|
time_unit="${bantime#${time_value}}"
|
||||||
|
|
||||||
[[ -z "$time_unit" ]] && time_unit="s"
|
[[ -z "$time_unit" ]] && time_unit="s"
|
||||||
|
|
||||||
case "$time_unit" in
|
case "$time_unit" in
|
||||||
s) return $time_value ;;
|
s) echo "$time_value" ;;
|
||||||
m) return $((time_value * 60)) ;;
|
m) echo "$((time_value * 60))" ;;
|
||||||
h) return $((time_value * 3600)) ;;
|
h) echo "$((time_value * 3600))" ;;
|
||||||
d) return $((time_value * 86400)) ;;
|
d) echo "$((time_value * 86400))" ;;
|
||||||
w) return $((time_value * 604800)) ;;
|
w) echo "$((time_value * 604800))" ;;
|
||||||
y) return $((time_value * 31536000)) ;;
|
y) echo "$((time_value * 31536000))" ;;
|
||||||
*) return $time_value ;;
|
*) echo "${time_value}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue