Sign inSign up

sanghaklee/iptables-graph

By sanghaklee

Updated 11 months ago

Visualize iptables packet flow as Graphviz diagrams.

Image
0

389

sanghaklee/iptables-graph repository overview

iptables-graph

Visualize iptables packet flow as Graphviz diagrams. Convert iptables-save output to DOT, SVG, or PNG formats.

PyPI Docker

Features

  • 📊 Visualize packet flow through all iptables tables (raw, mangle, nat, filter)
  • 🎨 Color-coded tables and chains for easy understanding
  • 🔗 Show custom chains and jump targets
  • 📤 Multiple output formats: DOT, SVG, PNG
  • 🐳 Docker-based (no host dependencies!)
  • 📦 PyPI package (pipx install)

Quick Start

No installation required! Just pull and run:

# Pull from Docker Hub
docker pull sanghaklee/iptables-graph

# Use it
sudo iptables-save | docker run --rm -i sanghaklee/iptables-graph

# Generate SVG
sudo iptables-save | docker run --rm -i sanghaklee/iptables-graph -f svg > graph.svg

# Generate PNG
sudo iptables-save | docker run --rm -i sanghaklee/iptables-graph -f png > example.png

Create an alias for convenience:

# Add to ~/.bashrc or ~/.zshrc
alias iptables-graph='docker run --rm -i sanghaklee/iptables-graph'

# Now use it like a regular command
sudo iptables-save | iptables-graph
sudo iptables-save | iptables-graph -f svg > graph.svg
Using with Docker Volumes
# For file input/output with Docker
docker run --rm sanghaklee/iptables-graph \
  -v $(pwd):/data
  -i /data/iptables-save.txt 
  -f svg 
  -o /data/diagram.svg

Command Line Options

usage: iptables-graph [-h] [-i INPUT] [-o OUTPUT] [-f {dot,svg,png}]

iptables-save output → Graphviz converter (dot/svg/png)

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input file (default: stdin)
  -o OUTPUT, --output OUTPUT
                        Output file (default: stdout)
  -f {dot,svg,png}, --format {dot,svg,png}
                        Output format: dot (default), svg, or png

Tag summary

Content type

Image

Digest

sha256:77537b3c7

Size

88.9 MB

Last updated

11 months ago

docker pull sanghaklee/iptables-graph