bash 是否有 unix 命令可以从域中检索 NS 记录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3899607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a unix command to retrieve NS records from domain?
提问by Zenet
I am looking for a way to get the primary and secondary NS records of a given domain name, and the IP addresses associated with them.
我正在寻找一种方法来获取给定域名的主要和次要 NS 记录,以及与它们关联的 IP 地址。
Now this kind of information is available from websites like intodns.com, but I am working on a huge list of domains and would like to automate this process with a bash script (probably not the best choice for this...).
现在这类信息可以从像 intodns.com 这样的网站上获得,但我正在处理一个庞大的域列表,并希望使用 bash 脚本自动化这个过程(可能不是最好的选择......)。
I tried nslookup domain.com, which gives me the primary NS IP address.
我试过了nslookup domain.com,这给了我主要的 NS IP 地址。
hostname domain.comreturns nothing...
hostname domain.com什么都不回...
I also tested dig domain.com TYPE NSwhich doesn't add much info.
我还测试了dig domain.com TYPE NS哪些不会添加太多信息。
At this point I am thinking of a wgetof the intodns.com page and parsing the html to get what I need...
在这一点上,我正在考虑wgetintodns.com 页面并解析 html 以获得我需要的内容......
Do you know of any better way for doing this?
你知道这样做的更好方法吗?
Thanks a lot!
非常感谢!
回答by Chris
$ dig example.com NS
works just fine for me. No, it doesn't resolve the IP addresses of the nameservers, but that's not part of the NS record. You'll have to do that yourself. Unlike the output of whois, it's in a standardized format, so it'll be easier to parse.
对我来说很好用。不,它不解析名称服务器的 IP 地址,但这不是 NS 记录的一部分。你必须自己做。与 whois 的输出不同,它采用标准化格式,因此更容易解析。
回答by ghostdog74
nslookup -query=ns <server.com>

