From 265507452c7fa76845e84b4167d649abc6fde70f Mon Sep 17 00:00:00 2001
From: Manuel Friedli <manuel@fritteli.ch>
Date: Tue, 4 Aug 2020 18:14:49 +0200
Subject: [PATCH] Omit empty lines.

---
 ddos-mitigator.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ddos-mitigator.sh b/ddos-mitigator.sh
index 30599a4..6dd5d7b 100755
--- a/ddos-mitigator.sh
+++ b/ddos-mitigator.sh
@@ -471,9 +471,9 @@ banned="$(exec_as_root fail2ban-client get "${jail}" banip)"
 connections=$(ss -HOn state established "( sport = :${port} )" | tr -s '[:blank:]' | cut -d' ' -f5)
 
 # IPv6-mapped-IPv4: [::ffff:192.168.0.1]:443
-echo "${connections}" | grep '^\[::ffff:' - | cut -d: -f4 | cut -d] -f1 > "${fileraw}"
+echo "${connections}" | grep '^\[::ffff:' - | cut -d: -f4 | cut -d] -f1 | grep -v '^$' > "${fileraw}"
 # Pure IPv4: 192.168.0.1:443
-echo "${connections}" | grep -v '^\[' - | cut -d: -f1 >> "${fileraw}"
+echo "${connections}" | grep -v '^\[' - | cut -d: -f1 | grep -v '^$' >> "${fileraw}"
 
 # Group and sort the data into the subnet-specific files.
 sort "${fileraw}" > "${file32}"