Mul*_*lot 1 security domain-name-system spoofing dig
我正在尝试找到一种方法来获取域名的真实 IP 地址。我正在使用iptables和tc对路由器进行流量整形。然后我需要设置iptables规则来标记来自某些域的数据包,使用它们的 ip 地址。
我第一次使用 dig命令,查询域的名称服务器,如下所示:
nbNameServer=`$dig NS $url +short | wc -l`
# If there is NS for the given domain
if [ $nbNameServer -gt 0 ]; then
for i in $($dig NS $url +short $TOdig); do
ipDom=`$dig @$i $url +short $TOdig`
# Ip found on the $i name server, no need to consult the others
if [ -n "$ipDom" ]; then
failed=`echo -e "$ipDom" | egrep "no servers could be reached"`
if [ ! -n "$failed" ]; then
break
else
ipDom=""
fi
fi
done
fi
Run Code Online (Sandbox Code Playgroud)
如果 /etc/resolv.conf 文件中的路由器让我们说 8.8.8.8 google DNS,有没有办法使用我所做的方式使 ip 或域中的一个不是最新的或欺骗?
我实际上不知道路由器是否会处于使用本地 DNS 服务器的环境中。
是否可以使用 host命令?
我唯一想确定的是,对于给定的域 mydomain.com,DNS 查找将返回所有最新的 IP 地址(我只需要 A 或 AAAA 记录)。
我对所有的 DNS 机制仍然有点困惑,所以当然欢迎任何评论/评论/建议。