Re: domainhack

From NAT, 6 Years ago, written in Bash, viewed 777 times. This paste is a reply to domainhack from NAT - view diff
URL https://code.nat.moe/view/334fcbdc Embed
Download Paste or View Raw
  1. #!/bin/bash
  2. #
  3. # domainhack: Find the registered domains with no handle on nameservers.
  4. # Currently, the script is configured to capture dnspod's domains.
  5. #
  6.  
  7. DAILYCHALES_DOMAINLIST_CSV="./domain.csv"
  8. DOMAIN_LIST="./domain.lst"
  9. DOMAIN_SAVE="./save.lst"
  10. DEFAULT_NS="f1g1ns1.dnspod.net"
  11. DOWNLOAD_NS="dnspod.net"
  12.  
  13. WARN="\033[1;33m"
  14. ERR="\033[0;31m"
  15. SUCCESS="\033[1;32m"
  16. RST="\033[0m"
  17.  
  18. DATE="$(date +%Y-%m-%d)"
  19.  
  20. function checkDomainCofniguredByWhois {
  21.         echo -n "checkDomainCofniguredByWhois: checking $1..."
  22.         NS=$(whois $1 | grep "Name Server" | awk -F":" '{print $2}' | head -n1)
  23.         [[ -z $NS ]] && echo "$WARN whois error$RST" && return 1
  24.         [[ ! -z $(nslookup $1 $NS | grep -E "NXDOMAIN|SERVFAIL|timed") ]] && echo -e "$SUCCESS unconfiged$RST" && echo "$1" >> $DOMAIN_SAVE || echo -e "$ERR configed$RST"
  25. }
  26.  
  27. function checkDomainCofniguredByNS {
  28.         echo -n "checkDomainCofniguredByNS: checking $1 in $2..."
  29.         [[ ! -z $(nslookup $1 $DEFAULT_NS | grep -E "NXDOMAIN|SERVFAIL|could|timed") ]] && echo -e "$SUCCESS unconfiged$RST" && echo "$1" >> $DOMAIN_SAVE || echo -e "$ERR configed$RST"
  30. }
  31.  
  32.  
  33. function checkDomainList {
  34.         echo "checkDomainList: start check procrss"
  35.         for domain in $(cat $DOMAIN_LIST)
  36.         do
  37.                 checkDomainCofniguredByNS $domain $DEFAULT_NS
  38.         done
  39. }
  40.  
  41. function processDomainList {
  42.         echo "processDomainList: processing $DAILYCHALES_DOMAINLIST_CSV"
  43.         cat $DAILYCHALES_DOMAINLIST_CSV | grep ,new, | sed -e "s/,new,//g" > $DOMAIN_LIST
  44.         dos2unix $DOMAIN_LIST
  45. }
  46.  
  47. function downloadDomainList {
  48.         echo "downloadDomainList: downloading latest domains list..."
  49.         curl -s -A "Mozilla Firefox" -e "http://www.dailychanges.com/$DOWNLOAD_NS/$DATE/" "http://www.dailychanges.com/export/$DOWNLOAD_NS/$DATE/export.csv" > $DAILYCHALES_DOMAINLIST_CSV 2> /dev/null
  50. }
  51.  
  52. function main {
  53.         echo "main: process start at $(date), processing domains for $DATE"
  54.         downloadDomainList
  55.         processDomainList
  56.         checkDomainList
  57.         echo "main: process end at $(date), finish processing jobs for $DATE."
  58. }
  59.  
  60. main

Replies to Re: domainhack rss

Title Name Language When
Re: Re: domainhack NAT bash 6 Years ago.

Reply to "Re: domainhack"

Here you can reply to the paste above

captcha