summaryrefslogtreecommitdiffstats
path: root/security/ossec-hids-local-config/files/command-open-ports.sh.in
blob: d5ba047999228f7ba15175d6d60346e86b002417 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/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