#/bin/bash DMZ_LAN=192.168.5.* nmap -sP -T5 $DMZ_LAN | awk ' /appears to be up/ { NAME = $2 IP = $3 gsub(/[()]/, "", IP) if (IP == "appears") { IP = NAME } print NAME " " IP }' | \ while read HOSTNAME IP ; do fwbedit new -f test.fwb -t Host -n $HOSTNAME \ -p /User/Objects/Hosts fwbedit new -f test.fwb -t Interface \ -a external,regular,no -n eth0 \ -p /User/Objects/Hosts/$HOSTNAME fwbedit new -f test.fwb -t IPv4 \ -a $IP4,24 -n $HOSTNAME:eth0:ip \ -p /User/Objects/Hosts/$HOSTNAME/eth0 done