⬢ DragonFlyBSD Kernel Audit
DF-3462 / addrscan.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-3462 scan (robust): one UDP datagram to each 127.0.0.X, read rule 104
# pcnt delta.  Works whether the set is disabled (leading "# DISABLED") or not.
first=$1; last=$2
pcnt() {
	ipfw3 -S show 104 | sed 's/^# DISABLED  *//' | awk '{print $2}'
}
printf "%6s %s\n" dst delta
p=$first
while [ $p -le $last ]; do
	c0=$(pcnt)
	/root/udp1shot 127.0.0.$p 44990 x 41000 >/dev/null 2>&1
	sleep 0.15
	c1=$(pcnt)
	printf "127.0.0.%d %d\n" $p $((c1 - c0))
	p=$((p + 1))
done