Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The shell script determines whether the domain name has a resolution record.

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The shell script implements to find out which domain names still have resolution records from a pile of domain names in

Record generation requirements: find out which domain names still have resolution records from the pile of domain names provided by the IDC computer room

Sort first to remove duplicate domain names:

Cat 2.txt | sort-rn | uniq-c | awk'{print $2}'> test

Execute script sh 2.sh m or sh 2.sh e or sh 2.sh unknown corresponding generation file m.log e.log wujilu.log

[root@intf-06 ~] # cat 2.sh #! / bin/shlist=$ (cat / root/test) for n in $listdo echo $n | tee-a 1.log & ping-C1-I 0.1$ n-Q 2 > & 1 | tee-a 1.logdone if [$1 = = "m"]; thensed-e'/ Done/ {d}'- e'/\ [1\] / {d} '1.log | grep-B 1' PING' | grep "^ $1" > m.logecho "> 1.log elif [$1 =" e "] Thensed-e'/ Done/ {d}'- e'/\ [1\] / {d} '1.log | grep-B1' PING' | grep "^ $1" > e.logecho "> 1.log elif [$1 =" unknown "]; thensed-e'/ Done/ {d}'- e'/\ [1\] / {d} '1.log | grep" $1 "| awk-F' [:] +'{print $2}'> wujilu.logecho" > 1.logfi

The obtained results are as follows:

Secondary domain name [root@intf-06 ~] # cat m.log m.qxwfc.cnm.qldua.cnm.wstzk.cnm.gsnon.cnm.fzhxzm.cnm.ew740.cn with resolution record beginning with m [root@intf-06 ~] # cat e.log e.gsnon.cne.fzhxzm.cne.ew740.cn with resolution record [root@intf-06 ~] # cat wujilu.log m.0v43q.cne.x51se.cn without resolution record

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report