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..." echo "[*] Extracting rules by table..."
current_table="" current_table=""
while IFS= read -r line; do while IFS= read -r rule; do
if [[ "$line" =~ ^\* ]]; then if [[ -n "$rule" && "$rule" == -A* ]]; then
current_table="${line:1}" echo "$rule"
TABLE_RULES["$current_table"]="$TEMP_DIR/$current_table.rules" if ! eval "iptables -t $table $rule"; then
> "${TABLE_RULES[$current_table]}" echo "[!] Failed to apply: $rule"
elif [[ "$line" =~ ^-A ]]; then fi
echo "$line" >> "${TABLE_RULES[$current_table]}"
fi fi
done < "$BACKUP_FILE" done <<< "$DEDUPED"
for table in "${!TABLE_RULES[@]}"; do for table in "${!TABLE_RULES[@]}"; do
echo "[*] Processing table: $table" echo "[*] Processing table: $table"

Loading…
Cancel
Save