#!/bin/sh # list directories in path $1 f_dls () { ls -l $1|egrep "^d"|awk '{print $9}' } ifdir="/etc/pf" ifs=$(f_dls $ifdir) for f in $ifs; do for g in incoming outgoing; do gg=$(echo $g|cut -c1) protos=$(f_dls $ifdir/$f/$gg) for h in $protos; do base="$f/$gg/$h" abase="anchors/$base" fbase="$ifdir/$base" if [ -f $fbase/.a ]; then for i in $(pfctl -a $abase -s Anchors|awk -F/ '{print $NF}'); do ports=$(head -1 $fbase/$i) echo $f: $g: $h: $i: $ports for j in $(pfctl -a $abase/$i -s Tables); do table=$(pfctl -a $abase/$i -t $j -Ts) if [[ ! $table = "" ]]; then echo '\t'$j: for k in $table; do echo '\t\t'$k done fi done done fi done done done