scripts-root/libvirt/list_ips.sh

13 lines
348 B
Bash
Executable File

#!/bin/bash
NSLOOKUP="nslookup %s"
while read -r ip
do
if [ "${1}" == "-d" ];
then
DN=`nslookup ${ip} | head -1 | cut -d'=' -f2 | sed 's/\.$//'`;
echo -e "${ip} ${DN}";
else
echo -e "${ip}";
fi
done < <(nmap -sn 192.168.42.0/24 2>/dev/null |grep "Nmap scan report"| rev |cut -d" " -f1|sed 's/(\|)//g'|rev |sort -t '.' -n -k 4);