local iface_info=$(ip -o -f inet addr show | awk '/scope global/ {print $2, $4}' | head -1) local iface=$(echo $iface_info | awk '{print $1}') local subnet=$(echo $iface_info | awk '{print $2}') if [ -z "$subnet" ]; then echo "❌ No active network connection found." return 1 fi echo "🔍 Scanning subnet \033[33m$subnet\033[0m on \033[33m$iface\033[0m..." doas nmap -sn -n "$subnet" | grep -E "Nmap scan|MAC Address" | sed -e 's/Nmap scan report for /IP: /g' -e 's/MAC Address: /MAC: /g'