📄 checkdns.shar
字号:
#Date: Mon, 26 Apr 93 9:13:55 MET DST#From: Hans van Staveren <sater@cs.vu.nl>#To: bind@ucbarpa.berkeley.edu#Subject: Re: send me your tools#Message-Id: <9304260913.aa18851@sater.cs.vu.nl>##We daily call the following script to check forward/reverse mapping#consistency:##/usr/share/local/script/checkDNS\# cs.vu.nl am.cs.vu.nl 192.31.231\# 130.37.16 130.37.18 130.37.20 130.37.22\# 130.37.24 130.37.26 130.37.28 130.37.30>/tmp/chk.$$##No documentation I am afraid. Just run it and see what is reported.## Hans#: This is a shar archive. Extract with sh, not csh.: This archive ends with exit, so do not worry about trailing junk.echo 'Extracting checkDNS'sed 's/^X//' > checkDNS << '+ END-OF-FILE checkDNS'X#!/bin/shX# Script to check forward/reverse name mapping consistencyX# Author: Hans van Staveren <sater@cs.vu.nl>X#XPATH=/usr/local/bin:/usr/ucb:/usr/binXcase $# inX0) echo "Usage: $0 [-p] [domain or network] ...";exit;XesacXping=noXcase $1 inX-p*) ping=yes;shift;;XesacXfor domainXdoX case $domain inX *[A-Za-z]*)X host -l $domain|sort -u|grep 'has address'|X grep -v -e '-net[0-9]'|grep -v localhost|X while read hostname has address ipaddrX doX revname=`host $ipaddr 2>/dev/null|sed -n 's/^Name: //p'`X if [ -z "$revname" ]X then revname="black-hole"X fiX hostname=`echo $hostname|tr '[A-Z]' '[a-z]'`X revname=`echo $revname|tr '[A-Z]' '[a-z]'`X if [ $hostname != $revname -a $revname != localhost ]X then echo "$hostname -> $ipaddr -> $revname"X fiX case $ping inX yes)X if /usr/etc/ping $hostname 5 >/dev/null 2>&1X then : nothingX elseX echo $hostname does not respondX fiX ;;X esacX doneX ;;X *)X # Only class C style networks work currentlyX netdom=`echo $domain|sed 's/\(.*\)\.\(.*\)\.\(.*\)/\3.\2.\1/'`.in-addr.arpaX host -l $netdom|sort -u|grep '^[^0].* PTR '|X while read enc_ipaddr PTR hostnameX doX ipaddr=`echo $enc_ipaddr|sed 's/\(.*\)\.\(.*\)\.\(.*\)\.\(.*\)\.IN.*/\4.\3.\2.\1/'`X if host $hostname 2>/dev/null|grep -s "has address $ipaddr"X thenX : hunky doryX elseX echo "$ipaddr -> $hostname, but no A record"X fiX case $ping inX yes)X if /usr/etc/ping $hostname 5 >/dev/null 2>&1X then : nothingX elseX echo $hostname does not respondX fiX ;;X esacX doneX ;;X esacXdone+ END-OF-FILE checkDNSchmod 'u=rwx,g=rx,o=rx' 'checkDNS'echo 'SENT: -rwxr-xr-x 1 sater 1554 Mar 19 1992 checkDNS'echo -n 'RCVD: '/bin/ls -l checkDNSexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -