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..."
|
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
|
|
||||||
echo "$line" >> "${TABLE_RULES[$current_table]}"
|
|
||||||
fi
|
fi
|
||||||
done < "$BACKUP_FILE"
|
fi
|
||||||
|
done <<< "$DEDUPED"
|
||||||
|
|
||||||
for table in "${!TABLE_RULES[@]}"; do
|
for table in "${!TABLE_RULES[@]}"; do
|
||||||
echo "[*] Processing table: $table"
|
echo "[*] Processing table: $table"
|
||||||
|
|||||||
Reference in New Issue
Block a user