Easter Hacker Tip of the Day: deepdns – bashscript to pull DNS records

Listen to this Post

This handy bash function uses a 3rd-party site (dnsrecords.io) to pull all DNS records from the target.

URL:

Usage:

Paste the following at the end of `~/.bashrc` (as root and primary user):

deepdns () 
{ 
( echo "grabbing current DNS for $1";
echo;
curl -sL "https://dnsrecords.io/$1" | html2text | awk "/./" | grep --color=auto -v '[comman|type';
echo )
}

To execute:

deepdns <target.com>

You Should Know:

Prerequisites

1. Ensure `curl` is installed:

sudo apt install curl -y  Debian/Ubuntu
sudo yum install curl -y  CentOS/RHEL

2. Install `html2text` for parsing HTML responses:

sudo apt install html2text -y  Debian/Ubuntu
sudo yum install html2text -y  CentOS/RHEL

Alternative DNS Recon Commands

  • Using `dig` for DNS records:
    dig ANY target.com +noall +answer
    

  • Using nslookup:

    nslookup -type=ANY target.com
    

  • Using host:

    host -a target.com
    

  • Using `whois` for domain info:

    whois target.com
    

Automating DNS Enumeration

Save this as `dns_enum.sh`:

!/bin/bash
target=$1
echo "[] Running DNS enumeration on $target"
echo "[] Using deepdns..."
deepdns $target
echo "[] Using dig..."
dig ANY $target +noall +answer
echo "[] Using host..."
host -a $target

Make it executable:

chmod +x dns_enum.sh
./dns_enum.sh target.com

Windows Equivalent (PowerShell)

Resolve-DnsName -Name "target.com" -Type ALL

What Undercode Say

DNS reconnaissance is critical for penetration testers and security analysts. The `deepdns` function simplifies bulk DNS lookups, but combining it with traditional tools (dig, nslookup, host) ensures comprehensive coverage. Always verify results from multiple sources to avoid relying on a single point of failure.

For advanced users, consider integrating this into automated recon scripts or combining with tools like dnsrecon:

sudo apt install dnsrecon -y 
dnsrecon -d target.com -t std,axfr,bing 

Expected Output:

[/bash]

grabbing current DNS for target.com

A 192.0.2.1

MX mail.target.com

TXT “v=spf1 include:_spf.target.com ~all”

[bash]

References:

Reported By: Activity 7319801998562779136 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image