Skip to content

Instantly share code, notes, and snippets.

@vitaly
Created November 30, 2016 14:18
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save vitaly/cd0024d232a3a134b00e5496e4e779b8 to your computer and use it in GitHub Desktop.
Save vitaly/cd0024d232a3a134b00e5496e4e779b8 to your computer and use it in GitHub Desktop.
script to dump PF status
#!/bin/bash
function pfprint() {
if [ -n "$1" ];then
sudo pfctl -a "$2" -s"$1" 2>/dev/null
else
sudo pfctl -s"$1" 2>/dev/null
fi
}
function print_all() {
local p=$(printf "%-40s" $1)
(
pfprint r "$1" | sed "s,^,r ,"
pfprint n "$1" | sed "s,^,n ,"
pfprint A "$1" | sed "s,^,A ,"
) | sed "s,^,$p,"
for a in `pfprint A "$1"`; do
print_all "$a"
done
}
print_all
@dazuelos
Copy link

dazuelos commented Aug 1, 2020

Great tool to work with PF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment