Update 'iptables.sh'

main
janderson 4 days ago
parent 4029ee8175
commit 57221e6589

@ -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"

Loading…
Cancel
Save