31.07.2015 г.

Search for ip and resolv with hostname for enybody file

#!/bin/bash

#Path to file with ip-s
FILE="/home/ips.txt"
#Command to resolv ip- with hostname
DIG="dig +short -x "
#Search for ip in file SEARCH=`cat $FILE | egrep -Eo '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | sort -t . -k 1,1n -k 2,2n -k3,3n -k4,4n`

#For clasuse
for i in $SEARCH;do
    echo -ne "$i\t-\t" "\e[1;33m `$DIG$i`\e[0m" "\n"
done

Няма коментари :

Публикуване на коментар