No description
Find a file
2026-06-15 15:47:21 +02:00
iptui.py Initial commit 2026-06-15 15:47:21 +02:00
LICENSE Initial commit 2026-06-15 15:47:21 +02:00
README.md Initial commit 2026-06-15 15:47:21 +02:00

iptui — IPTABLES Rule Manager TUI

Python TUI License

A terminal UI for browsing and editing iptables rules, written as a single-file Python 3 script using curses. Drills down through tables → chains → rules, with full create/read/update/delete support for rules and chains.

Features

  • Browse all standard tables (filter, nat, mangle, raw, security), their chains (built-in policies and user-defined chains), and the rules within each chain — with live packet/byte counters
  • Add, edit, delete, and reorder rules
  • Rule editor with fields for protocol, source/destination, interfaces, ports, jump target, target options, and comment, plus a free-text "extra match arguments" field for any match module not covered by the form (e.g. -m conntrack --ctstate ESTABLISHED,RELATED) — a live preview shows the exact rule that will be applied
  • Chain management: create, delete, rename, flush, set policy (ACCEPT/DROP), and zero counters
  • All changes are applied immediately via iptables and the view is re-read from the live ruleset, so what you see always matches iptables -S

Requirements

  • Python 3.8+
  • iptables
  • Root privileges (reading and modifying iptables rules requires CAP_NET_ADMIN)

Usage

chmod +x iptui.py
sudo ./iptui.py

Key bindings

Tables screen

Key Action
/k, /j Move selection
Enter Open table's chains
q / Esc Quit

Chains screen

Key Action
/k, /j Move selection
Enter View chain's rules
n New chain
d Delete chain (user-defined only)
r Rename chain (user-defined only)
p Set policy ACCEPT/DROP (built-in only)
f Flush chain
z Zero counters
Esc Back to tables
q Quit

Rules screen

Key Action
/k, /j Move selection
a Append new rule
i Insert new rule before selection
Enter / e Edit selected rule
d Delete selected rule
K / J Move selected rule up / down
z Zero counters
Esc Back to chains
q Quit

Rule editor

Key Action
Tab / , Shift+Tab / Move between fields
(typing) Edit current field
Enter Save rule
Esc Cancel