freebsd-ports/security/ossec-hids-local-config/files/command-open-ports.sh.in
Steve Wills 868061ef79 security/ossec-hids-server: update from 2.8.3 to 3.1.0
PR:		232794
Submitted by:	Dominik Lisiak <dominik.lisiak@bemsoft.pl> (maintainer)
2018-11-09 18:52:21 +00:00

19 lines
464 B
Bash

#!/bin/sh
# This script is part of FreeBSD port - report any issues to the port MAINTAINER
family=$1
protocol=$2
ports=$3
if [ -z "${ports}" ]; then
privileged_ports="1-$((`sysctl -n net.inet.ip.portrange.first` - 1))"
ossec_home="%%OSSEC_HOME%%"
. "${ossec_home}/etc/command.conf"
ports="privileged_${protocol}_ports"
eval ports=\$${ports}
fi
sockstat -l -${family} -P ${protocol} -p ${ports} | grep -Eo '[^[:space:]]+:[0-9]+' | sort -u