在一般的渗透测试中个人还是比较倾向于Dnsenum的,原因很简单——强大,Dnsenum可以通过google和字典文件猜测可能存在域名,还能对网段进行方向查询,除了基本的枚举内容(主机地址、域名服务器、MX……)以外,在域名服务器上执行axfr请求,通过谷歌脚本得到扩展域名信息(google hacking),提取自域名并查询,计算C类地址并执行whois查询,执行反向查询,把地址段写入文件。
还是先看其帮助文档
root@kali:~# dnsenum -help
dnsenum.pl VERSION:1.2.3
Usage: dnsenum.pl [Options] <domain>
[Options]:
Note: the brute force -f switch is obligatory.
GENERAL OPTIONS:
–dnsserver  <server>
Use this DNS server for A, NS and MX queries.
–enum Shortcut option equivalent to –threads 5 -s 15 -w.
-h, –help Print this help message.
–noreverse Skip the reverse lookup operations.
–nocolor Disable ANSIColor output.
–private Show and save private ips at the end of the file domain_ips.txt.
–subfile <file> Write all valid subdomains to this file.
-t, –timeout <value> The tcp and udp timeout values in seconds (default: 10s).
–threads <value> The number of threads that will perform different queries.
-v, –verbose Be verbose: show all the progress and all the error messages.
GOOGLE SCRAPING OPTIONS:
-p, –pages <value> The number of google search pages to process when scraping names,
the default is 5 pages, the -s switch must be specified.
-s, –scrap <value> The maximum number of subdomains that will be scraped from Google (default 15).
BRUTE FORCE OPTIONS:
-f, –file <file> Read subdomains from this file to perform brute force.
-u, –update <a|g|r|z>
Update the file specified with the -f switch with valid subdomains.
a (all) Update using all results.
g Update using only google scraping results.
r Update using only reverse lookup results.
z Update using only zonetransfer results.
-r, –recursion Recursion on subdomains, brute force all discovred subdomains that have an NS record.
WHOIS NETRANGE OPTIONS:
-d, –delay <value> The maximum value of seconds to wait between whois queries, the value is defined randomly, default: 3s.
-w, –whois Perform the whois queries on c class network ranges.
**Warning**: this can generate very large netranges and it will take lot of time to performe reverse lookups.
REVERSE LOOKUP OPTIONS:
-e, –exclude <regexp>
Exclude PTR records that match the regexp expression from reverse lookup results, useful on invalid hostnames.
OUTPUT OPTIONS:
-o –output <file> Output in XML format. Can be imported in MagicTree (www.gremwell.com)
===========================================================

–dnsserver 指定一个DNS服务器来查询A,NS,或MX.

–enum 快捷设置,等同于 –threads 5 -s 15 -w.

-h –help 打印帮助消息。

–noreverse 跳过反向解析设置。

–nocolor 不用ANSIColor 颜色输出。(输出的字体只剩白色了)

–private

–subfile <file> 把所有有效的子域写到一个文件。

-t,–timeout <value> TCP和UDP请求超时的时间。默认(10s)

–thread <value> 执行线程。

-v,–verbose 详细信息:显示所有的进展和所有错误信息。

google收集设置:

-p,–pages <value> 当进行google收集子域信息是,google 搜索页面的数量,默认是5个页面,必须使用-s参数。

-s –scrap <value> 从google收集子域的最大数量。默认(15个)。

暴力破解的设置:

-f ,–file <file> 指定暴力破解的字典。

-u,–update <a|g|r|z>

更新-f指定的字典文件,把有效的子域信息都追加到这个字典里。

a(all) 所有的结果。

g google搜索的结果。

r 反向解析的结果。(PS:反向解析其实用dig/nslookup更加的方便~)

z 域传送的结果。

-r –recursion 递归子域,暴力破解所有发现的有一个NS记录的子域。

WHOIS 网络范围设置:

-d,–delay <value> 最多等待的秒数,关于whois查询。默认是3秒。

-w,–whois 执行whois查询在C段网络范围内。警告:这个可以生成非常大的网络范围和将会花费很大时间执行反向查询。

反向查询设置:

-e –exclude<regexp> 通过正则表达式来排除PTR记录,这个是对无效主机是有用的。

-o –output <file> 输出XML格式。

帮助文档依旧很友好,我们可以轻松的看到使用的方法为“dnsenum.pl [Options] <domain> ”而中间可以跟的参数也很多,一般来说在渗透过程中比较常用的参数是-danserver 和、-enum、-f 和-e,这里需要注意的是一般来说-f是要取决字典的强大,如果没有强大的字典,效果也不是很好。
我们还是以查询xushine.net为例
root@kali:~# dnsenum -enum  -f dns.txt -dnsserver 114.114.114.114 xushine.net
dnsenum.pl VERSION:1.2.3
Warning: can’t load Net::Whois::IP module, whois queries disabled.

—–   xushine.net   —–

Host’s addresses:
__________________

xushine.net.                             3600     IN    A        103.224.80.92

Name Servers:
______________

ns6.ezdnscenter.com.                     30       IN    A        120.52.19.210
ns6.ezdnscenter.com.                     30       IN    A        101.226.167.172
ns5.ezdnscenter.com.                     30       IN    A        101.226.167.172
ns5.ezdnscenter.com.                     30       IN    A        120.52.19.210
ns2.ezdnscenter.com.                     30       IN    A        101.226.167.172
ns2.ezdnscenter.com.                     30       IN    A        120.52.19.210
ns1.ezdnscenter.com.                     204      IN    A        120.52.19.210
ns1.ezdnscenter.com.                     204      IN    A        101.226.167.172
ns3.ezdnscenter.com.                     30       IN    A        120.52.19.210
ns3.ezdnscenter.com.                     30       IN    A        101.226.167.172
ns4.ezdnscenter.com.                     30       IN    A        101.226.167.172
ns4.ezdnscenter.com.                     30       IN    A        120.52.19.210

Mail (MX) Servers:
___________________

Trying Zone Transfers and getting Bind Versions:
_________________________________________________

Trying Zone Transfer for xushine.net on ns6.ezdnscenter.com …
AXFR record query failed: connection failed

Trying Zone Transfer for xushine.net on ns5.ezdnscenter.com …
AXFR record query failed: connection failed

Trying Zone Transfer for xushine.net on ns2.ezdnscenter.com …
AXFR record query failed: connection failed

Trying Zone Transfer for xushine.net on ns1.ezdnscenter.com …
AXFR record query failed: connection failed

Trying Zone Transfer for xushine.net on ns3.ezdnscenter.com …
AXFR record query failed: connection failed

Trying Zone Transfer for xushine.net on ns4.ezdnscenter.com …
AXFR record query failed: connection failed

Scraping xushine.net subdomains from Google:
_____________________________________________

Error GETing http://www.google.com/ncr: Can’t connect to www.google.com:80 (timeout) at /usr/bin/dnsenum line 909