-
-
Save fbion/66a47c22d1889bccf7826a2c7951518d to your computer and use it in GitHub Desktop.
script to dump PF status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment