Update report_to_abuseipdb

This commit is contained in:
Sefinek 2024-10-31 02:25:39 +01:00
parent 74d9f84df7
commit b51a3099d7

View file

@ -72,7 +72,7 @@ is_local_ip() {
} }
report_to_abuseipdb() { report_to_abuseipdb() {
local ip="$1" categories="$2" proto="$3" spt="$4" dpt="$5" ttl="$6" len="$7" tos="$8" warsaw_time="$9" local ip="$1" categories="$2" proto="$3" spt="$4" dpt="$5" ttl="$6" len="$7" tos="$8" timestamp="$9"
local comment="Blocked by UFW ($proto on port $dpt). local comment="Blocked by UFW ($proto on port $dpt).
Source port: $spt" Source port: $spt"
@ -87,7 +87,6 @@ Packet length: $len"
TOS: $tos" TOS: $tos"
comment+=" comment+="
Timestamp: $warsaw_time [Europe/Warsaw]
This report (for $ip) was generated by: This report (for $ip) was generated by:
https://github.com/sefinek24/UFW-AbuseIPDB-Reporter" # Please do not remove the URL to the repository of this script. I would be really grateful. 💙 https://github.com/sefinek24/UFW-AbuseIPDB-Reporter" # Please do not remove the URL to the repository of this script. I would be really grateful. 💙
@ -197,10 +196,9 @@ process_log_line() {
fi fi
categories=$(determine_categories "$proto" "$dpt") categories=$(determine_categories "$proto" "$dpt")
warsaw_time=$(TZ="Europe/Warsaw" date -d "$timestamp" '+%Y-%m-%d %H:%M:%S')
log "INFO" "Reporting IP $src_ip ($proto $dpt) with categories $categories..." log "INFO" "Reporting IP $src_ip ($proto $dpt) with categories $categories..."
if report_to_abuseipdb "$src_ip" "$categories" "$proto" "$spt" "$dpt" "$ttl" "$len" "$tos" "$warsaw_time"; then if report_to_abuseipdb "$src_ip" "$categories" "$proto" "$spt" "$dpt" "$ttl" "$len" "$tos" "$timestamp"; then
mark_ip_as_reported "$src_ip" mark_ip_as_reported "$src_ip"
save_reported_ips save_reported_ips
fi fi