[精讚] [會員登入]
767

[shell script] 批次判斷domain name 正解設定

判斷dns 正解設定

分享此文連結 //n.sfs.tw/14790

分享連結 [shell script] 批次判斷domain name 正解設定@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2020-11-04 15:29:43 最後編修
2020-10-30 14:54:31 By igogo
 

 

 

這是一段描述如何找出名單中已成功設定domain name 指向 140.128.53.34 的script

ipv4

#!/bin/bash
filename='list.txt'

exec < $filename

while read line
do
        nslookup $line | grep 140.128.53.34
        if [ $? == 0 ]
        then
                echo $line >> ok_result.txt
        fi
        sleep 1
done

 

grep 符合字串成功的回傳值為 0

藉由 $?  可以得知回傳值

 

ipv6 使用dig

#!/bin/bash
filename="list.txt"
ipv6="2001:288:5400:d::34"

exec < $filename

while read line
do
        #dig lxes.tc.edu.tw AAAA | grep 2001:288:5400:d::34
        dig $line "AAAA"| grep $ipv6
        if [ $? == 0 ]
        then
                echo $line >> ok_result6.txt
        fi
        sleep 0.5
done

 

 

END

你可能感興趣的文章

臺中市校務雲端系統與Windows AD帳號整合(1) active directory,ldaps,雲端校務系統

使用expect 讀取外部資料存成陣列 使用expect 讀取外部資料存成陣列

利用expect script 查詢ap數量,再送到google sheet及line群組通知 利用expect script 查詢ap數量

如何在docker 的nginx 做另一個container的反向代理 環境 docker 中一container 跑 nginx 對外服務80 port, http://server 另一c

在docker裡跑spring boot+mongo(二) 使用docker-compose 管理多個container 前篇使用docker run 一次建一個container

使用expect及 openssl 產生SSL 憑證簽署要求 每年都要製做tls 憑證 二十幾張, 此語法利用expect 產生私錀及憑證請求檔 #!/usr/bin/expect

隨機好文

vue.js components 多個組件的呈現 vue.js 組件 component

centos 7 移机出現 dracut-initqueue timeout centos 7 移机出現 dracut-initqueue timeout 處理

編碼的順序 utf8 big5

雲端校務系統與OPENLDAP帳號整合(1) 本文件目標是為做單一帳號整合, 使用校端更改密碼服務, 將雲端校務系統的帳密同步至校內LDAP server, 並讓SA

題庫批次匯入google表單 請先建一新試算表, 將題目轉成格式如下 並將網址列記下來, 後續的題目就是從此試算表讀出 題目 答案 選項一 選項二 選