mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
Fix broken pipe
This commit is contained in:
parent
d19a3fbfd3
commit
0841f6f974
@ -14,12 +14,15 @@ dmesg | grep 'SRC=' | awk -F'SRC=' '{ print $2 }' | awk '{ print $1 }' | sort |
|
|||||||
# Initialize a counter for new IPs
|
# Initialize a counter for new IPs
|
||||||
new_ips=0
|
new_ips=0
|
||||||
|
|
||||||
|
# Store the output of ufw status in a variable
|
||||||
|
ufw_status=$(ufw status)
|
||||||
|
|
||||||
# Populate the UFW reject rule with the IP addresses collected from the kernel log
|
# Populate the UFW reject rule with the IP addresses collected from the kernel log
|
||||||
while IFS= read -r ip
|
while IFS= read -r ip
|
||||||
do
|
do
|
||||||
ip_prefix="${ip%.*}"
|
ip_prefix="${ip%.*}"
|
||||||
# Check if the IP is already in the UFW rules
|
# Check if the IP is already in the UFW rules
|
||||||
if ! ufw status | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ]
|
if ! echo "$ufw_status" | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ]
|
||||||
then
|
then
|
||||||
ufw reject from $ip
|
ufw reject from $ip
|
||||||
# Increment the counter
|
# Increment the counter
|
||||||
|
Loading…
Reference in New Issue
Block a user