突发奇想写的奇怪脚本(扫描设置dnspod ns却未注册的域名)

  • A+
所属分类:神兵利刃

创意源自:[link href="WooYun: DNSPod域名无验证所有权限(可导致域名被恶意接管使用)"]DNSPod域名无验证所有权限(可导致域名被恶意接管使用)[/link] 


#!/bin/bash 

# Downlaod domain list at: http://www.dailychanges.com/dnspod.net/ 


DAILYCHALES_DOMAINLIST_CSV="./domain.csv" 
DOMAIN_LIST="./domain.lst" 
DOMAIN_SAVE="./save.lst" 
DEFAULT_NS="F1G1NS1.DNSPOD.NET" 

WARN="\033[1;33m" 
ERR="\033[0;31m" 
SUCCESS="\033[1;32m" 
RST="\033[0m" 

function checkDomainCofniguredByWhois { 
        echo -n "checkDomainCofniguredByWhois: checking $1..." 
        NS=$(whois $1 | grep "Name Server" | awk -F":" '{print $2}' | head -n1) 
        [[ -z $NS ]] && echo " $WARN whois error$RST" && return 1 
        [[ ! -z $(nslookup $1 $NS | grep -E "NXDOMAIN|SERVFAIL|timed") ]] && echo -e "$SUCCESS unconfiged$RST" && echo "$1" >> $DOMAIN_SAVE || echo -e "$ERR configed$RST" 


function checkDomainCofniguredByNS { 
        echo -n "checkDomainCofniguredByNS: checking $1 in $2..." 
        [[ ! -z $(nslookup $1 $DEFAULT_NS | grep -E "NXDOMAIN|SERVFAIL|timed") ]] && echo -e "$SUCCESS unconfiged$RST" && echo "$1" >> $DOMAIN_SAVE || echo -e "$ERR configed$RST" 



function checkDomainList { 
        echo "checkDomainList: start check process" 
        for domain in $(cat $DOMAIN_LIST) 
        do 
                checkDomainCofniguredByNS $domain $DEFAULT_NS 
        done 


function processDomainList { 
        echo "processDomainList: processing $DAILYCHALES_DOMAINLIST_CSV" 
        cat $DAILYCHALES_DOMAINLIST_CSV | grep ,new, | sed -e "s/,new,//g" > $DOMAIN_LIST 
        dos2unix $DOMAIN_LIST 


processDomainList 
checkDomainList

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: