nnposter · GitHub

@ali-keys

Nmap previously required root (geteuid()==0) for any scan type that uses
raw sockets. On Linux, setcap(8) can grant the necessary access without
a full root UID:
  sudo setcap cap_net_raw=ep /usr/bin/nmap
Add have_net_capabilities() to nbase/nbase_misc.c, which reads CapEff
from /proc/self/status and tests for CAP_NET_RAW (bit 13). Both
NmapOps::Initialize() and NpingOps::Initialize() now set isr00t when
either geteuid()==0 or CAP_NET_RAW is effective, suppressing the
"You requested a scan type which requires root privileges." error.
CAP_NET_RAW is sufficient for raw sockets and promiscuous capture via
PACKET_MR_PROMISC on an AF_PACKET socket. The capability check is
Linux-only (#ifdef __linux__); all other platforms retain their
existing behaviour.

Read the original on github.com ↗