Created
November 30, 2016 14:18
-
-
Save vitaly/cd0024d232a3a134b00e5496e4e779b8 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
Great tool to work with PF