MCPcopy Index your code
hub / github.com/TKCERT/pfFocus

github.com/TKCERT/pfFocus @0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1 ↗ · + Follow
120 symbols 281 edges 8 files 1 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pfFocus

pfFocus

Build Status

This simple tool allows you to convert a full configuration backup of a pfSense firewall into some meaningful output format, like Markdown or YAML. It enables you to focus on the important parts of your firewall configuration and allows you to get a quick overview of the most important settings.

Requirements

  • Python 3.5+
    • defusedxml==0.5.0
    • PyYAML==3.12

or

  • Docker

Screenshots

Before: Configuration backup as XML

Configuration backup as XML

After: Markdown documentation

System and Interfaces Filter rules

Features

pfFocus currently supports the following configuration sections:

  • Basic system information
  • List of interfaces, VLANs, bridges, gateways and static mappings
  • List of DHCP ranges and aliases
  • NAT rules with alias and interface resolution
  • Outbound NAT rules with alias and interface resolution
  • Filter rules with alias and interface resolution
  • DNS forwarder (DNSmasq) configuration
  • OpenVPN server and client configurations
  • Syslog and sysctl configuration

Usage

Main formatting tool: pf-format

pf-format

Examples:

pf-format -i config-backup.xml -f md -o test.md
pf-format -i config-backup.xml -f yaml -o test.yaml

Test parsing tool: pf-parse

pf-parse [-h] input_path

Examples:

pf-parse config-backup.xml

Usage with Docker

When using pfFocus via Docker, you don't need to download it from Github, and you don't need to install Python or any libraries. Only Docker is required.

It runs this command inside Docker: pf-format -q -f md -i - -o -, which means it works with STDIN and STDOUT instead of files.

docker run --rm -i hugojosefson/pffocus < input.xml > output.md

If you want you can set up an alias for it in bash:

alias pffocus="docker run --rm -i hugojosefson/pffocus"

Then you can use it like a normal Unix command, with pipes and redirects:

pffocus < input.xml > output.md

Roadmap

Some ideas for the future development of pfFocus:

  • Producing additional output formats, especially structured formats like CSV.
  • Using these structured formats to enable easy diff'ing of configurations.
  • Maybe functionality to correlate rule configurations of different firewalls.

Credits

  • Thomas Patzke (@thomaspatzke) for
    • valuable suggestions and feedback
  • Florian Roth (@Cyb3rOps) for
    • giving it the name pfFocus
    • the very nice and gorgeous logo

Core symbols most depended-on inside this repo

hasattr_r
called by 42
pf_focus/util.py
obj_to_list
called by 26
pf_focus/util.py
output_bbcode_table
called by 21
pf_focus/bbcode.py
output_markdown_table
called by 21
pf_focus/markdown.py
h2
called by 17
pf_focus/bbcode.py
obj_to_dict
called by 14
pf_focus/util.py
h3
called by 7
pf_focus/bbcode.py
dict_to_list
called by 5
pf_focus/util.py

Shape

Class 53
Function 36
Method 31

Languages

Python100%

Modules by API surface

pf_focus/pfsense.py68 symbols
pf_focus/bbcode.py13 symbols
pf_focus/parse.py10 symbols
pf_focus/util.py9 symbols
pf_focus/format.py8 symbols
pf_focus/markdown.py6 symbols
pf_focus/progress.py5 symbols
setup.py1 symbols

For agents

$ claude mcp add pfFocus \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact