Advertisement
martypete

MartyDig-V2: A Multi-Purpose Email+DNS Lookup Script

Apr 13th, 2024 (edited)
883
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 21.30 KB | Cybersecurity | 0 0
  1. #   __  ______   ___  ________  _____  _________   _   _____  #
  2. #  /  |/  / _ | / _ \/_  __/\ \/ / _ \/  _/ ___/__| | / /_  | #
  3. # / /|_/ / __ |/ , _/ / /    \  / // // // (_ /___/ |/ / __/  #
  4. #/_/  /_/_/ |_/_/|_| /_/     /_/____/___/\___/    |___/____/  #
  5. ########## MULTI-PURPOSE EMAIL+DNS LOOKUP SCRIPT ##############
  6. ###############################################################
  7.  
  8. # MartyDig is a comprehensive tool for querying various DNS and WHOIS records related to a domain.
  9. # Execute with './mdig-v2 example.com' or bind to an alias in /.bashrc
  10.  
  11. ###################################################################################################
  12. # -Whois Domain Info: Retrieves WHOIS information for the specified domain (Registrar info, nameservers, organization details)
  13. # ---------------------
  14. # -NS Records: Fetches and displays the NS (Nameserver) records for the domain.
  15. # ---------------------
  16. # -MX Records: Retrieves MX (Mail Exchange) records for the domain, showing both the mail server hostname and associated IP address.
  17. # -Whois for Mail IP Address: Retrieves ARIN information for the IP address of the mail server.
  18. # ---------------------
  19. # -Propagated A Record: Retrieves and displays the A record (IPv4 address) for the domain and associated PTR record.
  20. # -Whois for A Record IP Address: Retrieves ARIN information for the IP address of the domain.
  21. # ---------------------
  22. # -SPF Records: Retrieves and displays SPF (Sender Policy Framework) records for the domain.
  23. # ---------------------
  24. # -DMARC Records: Retrieves and displays DMARC records for the domain.
  25. # ---------------------
  26. # -Google and Microsoft DKIM Records: Retrieves and displays DKIM records for Google and Microsoft services.
  27. # -Mailgun DKIM Records: Retrieves and displays DKIM records for Mailgun.
  28. # -SendGrid DKIM Records: Retrieves and displays DKIM records for SendGrid.
  29. # -Mailchimp DKIM Records: Retrieves and displays DKIM records for Mailchimp.
  30. # -Klaviyo DKIM Records: Retrieves and displays DKIM records for Klaviyo.
  31. # ---------------------
  32. # -Mail.Domain.com A Record: Retrieves and displays the A record for the mail subdomain (mail.domain.com) and associated PTR record.
  33. # -Whois for Mail.Domain.com IP Address: Retrieves ARIN information for the IP address of the mail subdomain.
  34. # ---------------------
  35. # -Autodiscover Records: Retrieves and displays autodiscover records for the domain.
  36. # -Whois for Autodiscover IP Address: Retrieves ARIN information for the IP address of the autodiscover subdomain.
  37. ###################################################################################################
  38. COLOR='\033[1;33m'
  39. BOLD='\033[1;37m'
  40. NC='\033[0m' # No Color
  41. RED='\033[1;31m'
  42. BLUE='\033[1;34m'
  43. YELLOW='\033[1;33m'
  44. GREY='\033[1;30m'
  45. GREEN='\033[1;32m'
  46. CYAN='\033[1;36m'
  47. PURPLE='\033[1;35m'
  48. #============== TOP-LEVEL DOMAIN A-RECORD ===========================
  49. IP=$( dig $1 +short | grep [0-9][0-9] | sort -nr | head -n 1 )
  50. PTR=$( dig -x $IP +short | grep -v "in-addr" | grep -v "Truncated" | head -n 1)
  51. #=================== MAIL.DOMAIN.COM SUBDOMAIN ========================
  52. MAILSUBIP=$( dig mail.$1 +short | grep [0-9][0-9] | sort -nr | head -n 1 )
  53. MAILSUBPTR=$( dig -x $MAILSUBIP +short | grep -Ev 'in-addr|Truncated' | head -n 1)
  54. #===============  DMARC RECORD  ==========================
  55. DMARCRECORD=$(dig _dmarc.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort)
  56. SPFRECORD=$(dig $1 txt +short | grep -E -v '\.root-servers\.net|Truncated' | grep 'v=spf1')
  57. #===============  MX RECORD HOSTNAME ================================
  58. MAILMX=$( dig mx $1 +short | grep -v ".root-servers.net" | grep -v "CNAME" | sort -n | head -n 1 )
  59. MAILMXLONG=$( dig mx $1 +short | grep -v ".root-servers.net" | sort -nr )
  60. #================  MX RECORD IP ADDRESS INFO  ====================
  61. MAILIP=$( dig $MAILMX +short | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -n 1 )
  62. MAILPTR=$( dig -x $MAILIP +short | grep -v "in-addr" | head -n 1 )
  63. #==============  AUTODISCOVER  =============================
  64. ADRECORD=$( dig autodiscover.$1 +nostats +noquestion +nocomments | grep IN | grep -v SOA | grep -v "RedHat" | grep -v ".root-servers.net" | grep -v "autodiscover.geo.outlook.com" | grep -v "autodiscover.outlook.com.g.outlook.com" | grep -v "autodiscover.geo.outlook.com" | grep -v "autodiscover-namcentral" | head -n 6 )
  65. ADIP=$( dig autodiscover.$1 +short | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -n 1 )
  66. #==============  GOOGLE + MICROSOFT DKIM KEYS  ==========================
  67. GOOGLEDKIM=$( dig google._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort)
  68. MSDKIM1=$( dig selector1._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort)
  69. MSDKIM2=$(dig selector2._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort)
  70. #============== MAILGUN DKIMS ==========================
  71. MAILGUNDKIMSMTP=$( dig smtp._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  72. MAILGUNDKIMKRS=$( dig krs._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  73. MAILGUNDKIMMAILO=$( dig mailo._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  74. #============== SENDGRID DKIMS ==========================
  75. SENDGRIDDKIMS1=$( dig s1._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort)
  76. SENDGRIDDKIMS2=$( dig s2._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort)
  77. #============== MAILCHIMP DKIMS ==========================
  78. MAILCHIMPDKIMK2=$( dig k2._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  79. MAILCHIMPDKIMK3=$( dig k3._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  80. #============== KLAVIYO DKIMS ==========================
  81. KLAVIYODKIMKL=$( dig kl._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  82. KLAVIYODKIMKL2=$( dig kl2._domainkey.$1 txt +nostats +noquestion +nocomments | grep -E 'IN.*(CNAME|TXT)' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net' | sort -r)
  83. #========================================
  84. clear
  85. echo -e "${BLUE}|${BOLD}    __  ______    ____  ________  ______  __________    _    _____ ${BLUE}|${NC}"
  86. echo -e "${BLUE}|${BOLD}   /  |/  /   |  / __ \/_  __/\ \/ / __ \/  _/ ____/   | |  / /__ |${BLUE}|${NC}"
  87. echo -e "${BLUE}|${BOLD}  / /|_/ / /| | / /_/ / / /    \  / / / // // / _______| | / /__/ /${BLUE}|${NC}"
  88. echo -e "${BLUE}|${BOLD} / /  / / ___ |/ _, _/ / /     / / /_/ // // /_/ /_____/ |/ // __/ ${BLUE}|${NC}"
  89. echo -e "${BLUE}|${BOLD}/_/  /_/_/  |_/_/ |_| /_/     /_/_____/___/\____/      |___//____/ ${BLUE}|${NC}"
  90. echo -e "${BLUE} ___________________________________________________________________${NC}"  
  91. echo -e "${BLUE}[#] whois $1 (REGISTRAR INFO) ${NC}"
  92. #=================================================================
  93. #===============  WHOIS DOMAIN  ===================================
  94. #==================================================================
  95. echo -e ""
  96. whois "$1" |
  97. egrep -i "(Server|Nameserver:|Registrar:|Registrar URL|Organization:|Admin|Comment:|Email|nameservers:|Hold|Expiration|Expiry|Reseller|URL:|Transfer|Name:|No match|NS[1-4]|NOT FOUND|abuse-mailbox:|Name servers:|NET)" |
  98. grep -vE "(created|updated|The data in|information purposes only|makes this information available|that apply to|prior written consent|BRST|This server accepts|reserves the right|clientTransferProhibited|modify existing registrations|support questions|Redirected|Querying|\[whois\.|follow the instructions|Unconditional Guarantee|reserves the right|Billing|Registrar Abuse Contact Email|dest IP \(your IP\)|Intensity/frequency|Without these|NetName:|Domain Name:|Tech|NOCEmail|Administrative Contact Postal Code|Administrative Contact Phone Number|Administrative Contact Facsimile Number|Administrative Contact ID|Administrative Contact Address|Administrative Contact City|Administrative Contact Country|Administrative Contact State/Province|Administrative Contact Country Code|Admin Phone Ext|Admin Fax|Domain ID:|Admin Fax Ext|Admin Phone|Admin Country|Invalid option:|Admin Postal Code|Admin State/Province|Admin City|Admin Street|Admin ID|Registry Admin ID|has collected this|Last Transferred Date:|Administrative Application Purpose:|Administrative Nexus Category:|Parent|NetHandle:|Ref:|StateProv:|WHOIS Server:|Please register your domains|network:In-Addr-Server;|network:Network-Name:|Comments to|network:Tech-Contact;|OrgNOCName:|global Web hosting|DreamHost is|websites and apps hosted|Dedicated Server Hosting|Registrar Registration Expiration Date|high-value domains|DreamCompute|contains ONLY .COM|for more information|Connection refused|Withheld for Privacy|Redacted for Privacy)" |
  99. awk '!x[$0]++' |
  100. sed -e 's/^[ \t]*//'
  101. #========================================================================
  102. #=========================== NS RECORDS ===============================
  103. #=======================================================================
  104. echo -e "${GREEN}_______________________________________________________________${NC}"
  105. echo -e "${GREEN}[#] dig $1 ns (PROPAGATED NS RECORD) ${NC}"
  106. echo -e ""
  107. dig $1 ns +nostats +noquestion +nocomments | grep -E 'IN.*NS' | grep -Ev 'SOA|RedHat|AAAA|.root-servers.net'
  108. #======================================================================
  109. #=========================== MX RECORDS ===============================
  110. #=======================================================================
  111. echo -e "${RED}_______________________________________________________________${NC}"
  112. echo -e "${RED}[#] dig $1 mx (MX RECORD) ${NC}"
  113. echo -e ""
  114. if [[ ! -z $MAILMX  ]] #Checks to see if there is an MX record propagated
  115.     then
  116.         printf "$MAILMXLONG"
  117.     else
  118.         :
  119.     fi
  120. if [[ ! -z $MAILIP  ]] #Checks to see what IP the MX record resolves to, if any.
  121.     then
  122.         echo -e " ${RED}=>${NC} $MAILIP ${RED}=>${NC} $MAILPTR"
  123.     else
  124.         echo -e ""
  125.     fi
  126. #======================================================================
  127. #===============  WHOIS mail IP ADDRESS  ===================================
  128. #======================================================================
  129. echo -e ""
  130. echo -e "${RED}[#] whois ${MAILIP} (MX RECORD IP INFO) ${NC}"
  131. echo -e ""
  132. if [[ ! -z $MAILIP  ]] #Checks to SEE THE IP INFO FOR THE TOP MX RECORD
  133.     then
  134.         whois "$MAILIP" |
  135.         grep -Ei "(Server|Registrar:|Registrar URL|OrgTechEmaiL|Organization:|Network-Name|Org-Name|OrgName|NetName|Status:|Registrant Name|org-name:|Registrant Org|Email|Registrant Street|Registrant City|Registrant Country|Registrant Phone:|Expiration|Expiry|Reseller|Organization Name|\(|netname:|descr:|remarks:|person:|abuse-mailbox:|country|network:Org-name:|OrgAbuseEmail:|network:Updated-By|network:Organization|network:Tech-Contact|network:Admin-Contact|e-mail:|StateProv:|City:|ns[1-2])" |
  136.         grep -vE "(Parent|served|RTechEmail|Invalid option:|RNOCEmail|\(BRST|This server accepts|RAbuseEmail|%rwhois|dest IP \(your IP\)|Intensity/frequency|Without these|NetName:|NOCEmail|Organization:|remarks:|OrgTechEmail:|contact details|network:In-Addr-Server;|City:|StateProv:|network:Network-Name:|Comments to|network:Tech-Contact;|OrgNOCName:|Country:|connect: Connection refused|Connection refused)" |
  137.         sort -u |
  138.         sed -e 's/^[ \t]*//'
  139.     else
  140.         :
  141.     fi
  142. #=================================================================
  143. #===============  PROPAGATED A RECORD  ============================
  144. #==================================================================
  145. echo -e "${COLOR}_______________________________________________________________${NC}"
  146. echo -e "${COLOR}[#] dig $1 (WEBSITE/TLD) ${NC}"
  147. echo -e ""
  148. if [[ ! -z $IP  ]] #Checks to see if there is an A record propagated.
  149.     then
  150.         printf "$IP"
  151.     else
  152.         :
  153.     fi
  154. if [[ ! -z $PTR  ]] #Checks to see if the A record IP has a PTR record.
  155.     then
  156.         echo -e " ${COLOR}=>${NC} $PTR"
  157.     else
  158.         echo -e ""
  159.     fi
  160. #======================================================================
  161. #===============  WHOIS IP ADDRESS  ===================================
  162. #======================================================================
  163. echo -e ""
  164. echo -e "${COLOR}[#] whois ${IP} (A RECORD IP INFO) ${NC}"
  165. echo -e ""
  166. if [[ ! -z $IP  ]] #Checks to see if there is an A record propagated for the given domain.
  167.     then
  168.         whois "$IP" |
  169.         grep -Ei "(Server|Registrar:|Registrar URL|OrgTechEmaiL|Organization:|Network-Name|Org-Name|OrgName|NetName|Status:|Registrant Name|org-name:|Registrant Org|Email|Registrant Street|Registrant City|Registrant Country|Registrant Phone:|Expiration|Expiry|Reseller|Organization Name|\(|netname:|descr:|remarks:|person:|abuse-mailbox:|country|Country|network:Org-name:|OrgAbuseEmail:|network:Updated-By|network:Organization|network:Tech-Contact|network:Admin-Contact|e-mail:|StateProv:|City:|ns[1-2])" |
  170.         grep -vE "(Parent|served|RTechEmail|Invalid option:|RNOCEmail|\(BRST|This server accepts|RAbuseEmail|dest IP \(your IP\)|Intensity/frequency|Without these|NetName:|NOCEmail|Organization:|remarks:|StateProv:|City:|OrgTechEmail:|contact details|network:In-Addr-Server;|network:Network-Name:|Comments to|%rwhois|network:Tech-Contact;|OrgNOCName:|Country:|connect: Connection refused|Comment:)" |
  171.         sort -u |
  172.         sed -e 's/^[ \t]*//'
  173.     else
  174.         :
  175.     fi
  176. dig -x mail.$1 | grep "PTR" | grep "in-addr" | grep -v ";" | grep -v "Invalid option:"
  177. #======================================================================
  178. #===============  SPF records  ===================================
  179. #======================================================================
  180. echo -e "${PURPLE}_______________________________________________________________${NC}"
  181. echo -e "${PURPLE}[#] dig $1 txt (SPF RECORD) ${NC}"
  182. echo -e ""
  183. if [[ ! -z $SPFRECORD  ]] #Checks to see if there is an SPF record propagated.
  184.     then
  185.         echo -e "$SPFRECORD"
  186.     else
  187.         :
  188.     fi
  189. #=================================================================
  190. #========  PROPAGATED DMARC + GOOGLE DKIM RECORDs  =================
  191. #==================================================================
  192. echo -e "${GREY}_______________________________________________________________${NC}"
  193. echo -e "${GREY}[#] dig _.dmarc.$1 (DMARC RECORD) ${NC}"
  194. echo -e ""
  195. if [[ ! -z $DMARCRECORD  ]] #Checks to see if there is a record propagated.
  196.     then
  197.         echo -e "$DMARCRECORD"
  198.     else
  199.         :
  200.     fi
  201. echo -e "${GREEN}_______________________________________________________________${NC}"
  202. echo -e "${GREEN}[#] (GOOGLE / MS365 DKIMS) ${NC}"
  203. echo -e ""
  204. if [[ ! -z $GOOGLEDKIM  ]] #Checks to see if there is a record propagated.
  205.     then
  206.         echo -e "$GOOGLEDKIM"
  207.     else
  208.         :
  209.     fi
  210. if [[ ! -z $MSDKIM1  ]] #Checks to see if there is a record propagated.
  211.     then
  212.         echo -e "$MSDKIM1"
  213.         echo -e ""
  214.     else
  215.         :
  216.     fi
  217. if [[ ! -z $MSDKIM2  ]] #Checks to see if there is a record propagated.
  218.     then
  219.         echo -e "$MSDKIM2"
  220.     else
  221.         :
  222.     fi
  223. echo -e "${RED}_______________________________________________________________${NC}"
  224. echo -e "${RED}[#] (MAILGUN DKIMS) ${NC}"
  225. echo -e ""
  226. if [[ ! -z $MAILGUNDKIMKRS  ]] #Checks to see if there is a record propagated.
  227.     then
  228.         echo -e "$MAILGUNDKIMKRS"
  229.         echo -e ""
  230.     else
  231.         :
  232.     fi
  233. if [[ ! -z $MAILGUNDKIMMAILO  ]] #Checks to see if there is a record propagated.
  234.     then
  235.         echo -e "$MAILGUNDKIMMAILO"
  236.         echo -e ""
  237.     else
  238.         :
  239.     fi
  240. if [[ ! -z $MAILGUNDKIMSMTP  ]] #Checks to see if there is a record propagated.
  241.     then
  242.         echo -e "$MAILGUNDKIMSMTP"
  243.     else
  244.         :
  245.     fi
  246. echo -e "${BLUE}_______________________________________________________________${NC}"
  247. echo -e "${BLUE}[#] (SENDGRID DKIMS) ${NC}"
  248. echo -e ""
  249. if [[ ! -z $SENDGRIDDKIMS1  ]] #Checks to see if there is a record propagated.
  250.     then
  251.         echo -e "$SENDGRIDDKIMS1"
  252.         echo -e ""
  253.     else
  254.         :
  255.     fi
  256. if [[ ! -z $SENDGRIDDKIMS2  ]] #Checks to see if there is a record propagated.
  257.     then
  258.         echo -e "$SENDGRIDDKIMS2"
  259.     else
  260.         :
  261.     fi
  262. echo -e "${COLOR}_______________________________________________________________${NC}"
  263. echo -e "${COLOR}[#] (MAILCHIMP DKIMS) ${NC}"
  264. echo -e ""
  265. if [[ ! -z $MAILCHIMPDKIMK2  ]] #Checks to see if there is a record propagated.
  266.     then
  267.         echo -e "$MAILCHIMPDKIMK2"
  268.         echo -e ""
  269.     else
  270.         :
  271.     fi
  272. if [[ ! -z $MAILCHIMPDKIMK3  ]] #Checks to see if there is a record propagated.
  273.     then
  274.         echo -e "$MAILCHIMPDKIMK3"
  275.     else
  276.         :
  277.     fi
  278. echo -e "${COLOR}_______________________________________________________________${NC}"
  279. echo -e "${COLOR}[#] (KLAVIYO DKIMS) ${NC}"
  280. echo -e ""
  281. if [[ ! -z $KLAVIYODKIMKL  ]] #Checks to see if there is a record propagated.
  282.     then
  283.         echo -e "$KLAVIYODKIMKL"
  284.         echo -e ""
  285.     else
  286.         :
  287.     fi
  288. if [[ ! -z $KLAVIYODKIMKL2  ]] #Checks to see if there is a record propagated.
  289.     then
  290.         echo -e "$KLAVIYODKIMKL2"
  291.     else
  292.         :
  293.     fi
  294. echo -e "${COLOR}_______________________________________________________________${NC}"
  295. #=================================================================
  296. #===============  PROPAGATED MAIL.DOMAIN.COM A RECORD  ===========
  297. #=================================================================
  298. echo -e "${GREY}_______________________________________________________________${NC}"
  299. echo -e ""
  300. echo -e "${GREY}[#] dig ${RED}mail.$1 ${GREY}(mail.$1 A RECORD) ${NC}"
  301. echo -e ""
  302. if [[ ! -z $MAILSUBIP  ]] #Checks to see if there is an A record propagated for mail.domain.com.
  303.     then
  304.         printf "$MAILSUBIP"
  305.     else
  306.         :
  307.     fi
  308. if [[ ! -z $MAILSUBPTR  ]] #Checks to see if the A record IP for mail.domain.com has a PTR record.
  309.     then
  310.         echo -e " ${GREY}=>${NC} $MAILSUBPTR"
  311.     else
  312.         echo -e ""
  313.     fi
  314. # ======================================================================
  315. # ===============  WHOIS MAIL.DOMAIN.COM IP ADDRESS  ===================
  316. # ======================================================================
  317. echo -e ""
  318. echo -e "${GREY}[#] whois ${RED}${MAILSUBIP} ${GREY}(A RECORD IP INFO) ${NC}"
  319. echo -e ""
  320. if [[ ! -z $MAILSUBIP  ]] #Checks to see if there is an A record propagated for the given domain.
  321.     then
  322.         whois "$MAILSUBIP" |
  323.         grep -Ei "(Server|Registrar:|Registrar URL|OrgTechEmaiL|Organization:|Network-Name|Org-Name|OrgName|NetName|Status:|Registrant Name|org-name:|Registrant Org|Email|Registrant Street|Registrant City|Registrant Country|Registrant Phone:|Expiration|Expiry|Reseller|Organization Name|\(|netname:|descr:|remarks:|person:|abuse-mailbox:|country|Country|network:Org-name:|OrgAbuseEmail:|network:Updated-By|network:Organization|network:Tech-Contact|network:Admin-Contact|e-mail:|StateProv:|City:|ns[1-2])" |
  324.         grep -vE "(Parent|served|RTechEmail|Invalid option:|RNOCEmail|\(BRST|This server accepts|RAbuseEmail|dest IP \(your IP\)|Intensity/frequency|Without these|NetName:|NOCEmail|Organization:|remarks:|StateProv:|City:|OrgTechEmail:|contact details|network:In-Addr-Server;|network:Network-Name:|Comments to|%rwhois|network:Tech-Contact;|OrgNOCName:|Country:|connect: Connection refused|Comment:)" |
  325.         sort -u |
  326.         sed -e 's/^[ \t]*//'
  327.     else
  328.         :
  329.     fi
  330. dig -x mail.$1 | grep "PTR" | grep "in-addr" | grep -v ";" | grep -v "Invalid option:"
  331. # =================================================================
  332. # ===============  PROPAGATED autodiscover record==================
  333. # =================================================================
  334. echo -e "${GREY}_______________________________________________________________${NC}"
  335. echo -e "${GREY}[#] dig autodiscover.$1 (AUTODISCOVER RECORD) ${NC}"
  336. echo -e ""
  337. if [[ ! -z $ADRECORD  ]] #Checks to see if there is a record propagated.
  338.     then
  339.        
  340.         echo -e "$ADRECORD"
  341.     else
  342.         :
  343.     fi
  344. echo -e ""
  345. #======================================================================
  346. #===============  WHOIS AUTODISCOVER IP ADDRESS  ======================
  347. #======================================================================
  348. echo -e "${GREY}[#] whois ${ADIP} (AUTODISCOVER RECORD IP INFO) ${NC}"
  349. echo -e ""
  350. if [[ ! -z $ADIP  ]] #Checks to see if there is an A record propagated for the given autodisover subdomain.
  351.     then       
  352.         whois "$ADIP" |
  353.         grep -Ei "(Server|Registrar:|Registrar URL|OrgTechEmaiL|Organization:|Network-Name|Org-Name|OrgName|NetName|Status:|Registrant Name|org-name:|Registrant Org|Email|Registrant Street|Registrant City|Registrant Country|Registrant Phone:|Expiration|Expiry|Reseller|Organization Name|\(|netname:|descr:|remarks:|person:|abuse-mailbox:|country|Country|network:Org-name:|OrgAbuseEmail:|network:Updated-By|network:Organization|network:Tech-Contact|network:Admin-Contact|e-mail:|StateProv:|City:|ns[1-2])" |
  354.         grep -vE "(Parent|served|RTechEmail|Invalid option:|RNOCEmail|\(BRST|This server accepts|RAbuseEmail|dest IP \(your IP\)|Intensity/frequency|Without these|NetName:|NOCEmail|Organization:|remarks:|City:|OrgTechEmail:|contact details|network:In-Addr-Server;|StateProv:|network:Network-Name:|Comments to|%rwhois|network:Tech-Contact;|OrgNOCName:|Country:|connect: Connection refused|Connection refused|OrgRoutingEmail)" |
  355.         sort -u |
  356.         sed -e 's/^[ \t]*//'
  357.  
  358.     else
  359.         :
  360.     fi
  361. echo -e "${GREY}_______________________________________________________________${NC}"
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement