domainhack

From NAT, 7 Years ago, written in Bash, viewed 730 times.
URL https://code.nat.moe/view/b664e462 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.  
  12. WARN="\033[1;33m"
  13. ERR="\033[0;31m"
  14. SUCCESS="\033[1;32m"
  15. RST="\033[0m"
  16.  
  17. DATE="$(date +%Y-%m-%d)"
  18.  
  19. function checkDomainCofniguredByWhois {
  20.         echo -n "checkDomainCofniguredByWhois: checking $1..."
  21.         NS=$(whois $1 | grep "Name Server" | awk -F":" '{print $2}' | head -n1)
  22.         [[ -z $NS ]] && echo "$WARN whois error$RST" && return 1
  23.         [[ ! -z $(nslookup $1 $NS | grep -E "NXDOMAIN|SERVFAIL|timed") ]] && echo -e "$SUCCESS unconfiged$RST" && echo "$1" >> $DOMAIN_SAVE || echo -e "$ERR configed$RST"
  24. }
  25.  
  26. function checkDomainCofniguredByNS {
  27.         echo -n "checkDomainCofniguredByNS: checking $1 in $2..."
  28.         [[ ! -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"
  29. }
  30.  
  31.  
  32. function checkDomainList {
  33.         echo "checkDomainList: start check procrss"
  34.         for domain in $(cat $DOMAIN_LIST)
  35.         do
  36.                 checkDomainCofniguredByNS $domain $DEFAULT_NS
  37.         done
  38. }
  39.  
  40. function processDomainList {
  41.         echo "processDomainList: processing $DAILYCHALES_DOMAINLIST_CSV"
  42.         cat $DAILYCHALES_DOMAINLIST_CSV | grep ,new, | sed -e "s/,new,//g" > $DOMAIN_LIST      
  43.         dos2unix $DOMAIN_LIST
  44. }
  45.  
  46. function downloadDomainList {
  47.         echo "downloadDomainList: downloading latest domains list..."
  48.         curl -s -A "Mozilla Firefox" -e "http://www.dailychanges.com/$DEFAULT_NS/$DATE/" "http://www.dailychanges.com/export/$DEFAULT_NS/$DATE/export.csv" > $DOMAIN_LIST 2> /dev/null
  49. }
  50.  
  51. function main {
  52.         echo "main: process start at $(date), processing domains for $DATE"
  53.         downloadDomainList
  54.         processDomainList
  55.         checkDomainList
  56.         echo "main: process end at $(date), finish processing jobs for $DATE."
  57. }
  58.  
  59. main

Replies to domainhack rss

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

Reply to "domainhack"

Here you can reply to the paste above

captcha