Update 'iptables.sh'
This commit is contained in:
15
iptables.sh
15
iptables.sh
@@ -11,15 +11,14 @@ declare -A TABLE_RULES
|
||||
echo "[*] Extracting rules by table..."
|
||||
|
||||
current_table=""
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" =~ ^\* ]]; then
|
||||
current_table="${line:1}"
|
||||
TABLE_RULES["$current_table"]="$TEMP_DIR/$current_table.rules"
|
||||
> "${TABLE_RULES[$current_table]}"
|
||||
elif [[ "$line" =~ ^-A ]]; then
|
||||
echo "$line" >> "${TABLE_RULES[$current_table]}"
|
||||
while IFS= read -r rule; do
|
||||
if [[ -n "$rule" && "$rule" == -A* ]]; then
|
||||
echo " → $rule"
|
||||
if ! eval "iptables -t $table $rule"; then
|
||||
echo "[!] Failed to apply: $rule"
|
||||
fi
|
||||
done < "$BACKUP_FILE"
|
||||
fi
|
||||
done <<< "$DEDUPED"
|
||||
|
||||
for table in "${!TABLE_RULES[@]}"; do
|
||||
echo "[*] Processing table: $table"
|
||||
|
||||
Reference in New Issue
Block a user