Omit empty lines.
This commit is contained in:
parent
11c246b02c
commit
265507452c
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
connections=$(ss -HOn state established "( sport = :${port} )" | tr -s '[:blank:]' | cut -d' ' -f5)
|
||||||
|
|
||||||
# IPv6-mapped-IPv4: [::ffff:192.168.0.1]:443
|
# 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
|
# 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.
|
# Group and sort the data into the subnet-specific files.
|
||||||
sort "${fileraw}" > "${file32}"
|
sort "${fileraw}" > "${file32}"
|
||||||
|
|
Loading…
Reference in a new issue