I ran the following command:
sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip `which nmap`
Now I'd like to add to my ~/.zshrc a line that detects such settings and exports NMAP_PRIVILEGED=1. How could I do that?
I ran the following command:
sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip `which nmap`
Now I'd like to add to my ~/.zshrc a line that detects such settings and exports NMAP_PRIVILEGED=1. How could I do that?
Just use getcap:
if nmap --version >/dev/null && getcap `which nmap` | grep -q cap_net_raw; then
export NMAP_PRIVILEGED="1"
else
echo "WARNING: No Nmap with cap_net_raw in \$PATH!" >&2
fi