From bc4924738ca2efad82f577b93b4f374579028489 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Sat, 27 Aug 2022 19:10:01 +0300 Subject: [PATCH] add hostnames processing --- update_ru_routes.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/update_ru_routes.sh b/update_ru_routes.sh index bf523c6..99630a8 100644 --- a/update_ru_routes.sh +++ b/update_ru_routes.sh @@ -15,6 +15,7 @@ function ProgressBar { #Variables file_raw="russian_subnets_list_raw.txt" file_user="subnets_user_list.txt" +file_user_hostnames="hosts_user_list.txt" file_for_calc="russian_subnets_list_raw_for_calc.txt" file_processed="russian_subnets_list_processed.txt" gateway_for_internal_ip=`ip route | awk '/default/ {print $3; exit}'` @@ -29,7 +30,15 @@ cat $file_raw |grep "-" > $file_for_calc cat $file_raw |grep -v "-" > $file_processed for line in $(cat $file_for_calc); do ipcalc $line |grep -v "deaggregate" >> $file_processed; done -if [ -e $file_user ]; then echo "Add user subnets..."; cat $file_user |grep -v "#" >> $file_processed; fi +if [ -e $file_user ] +then echo "Add user subnets..." + cat $file_user |grep -v "#" >> $file_processed +fi + +if [ -e $file_user_hostnames ] +then echo "Add user hostnames..." + for line in $(cat $file_user_hostnames); do nslookup line |grep "Address" |grep -v "#" |awk '{print $2"/32"}' >> $file_processed; done +fi #Flush route table echo "Flush route table (down interface $interface)..."