dnsruby - 错误提取TXT记录但不提取某些域的MX记录

时间:2018-04-10 20:20:54

标签: ruby-on-rails ruby dns

如何使用某些域名,我可以很好地获取MX记录,但是获取TXT记录我得到'Dnsruby :: NXDomain'错误?

示例:

这会抛出Dnsruby :: NXDomain错误:

DNS.new.getresources("kimcorealty.com", Types.TXT)

这适用于同一个域:

DNS.new.getresources("kimcorealty.com", Types.MX)

我该如何解决这个问题?

提前致谢。

更新

我发现Ruby源代码中发生了错误。

在这一行:https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L529

这是当我在那条线上时的响应状态。您可以看到我们失败了这个条件,返回错误。但是,如果我在此之前查看回复,我想要的所有TXT记录都在那里。

[7] pry(#<Resolv::DNS>)> reply

=> #<Resolv::DNS::Message:0x00007fd261cb28f8
 @aa=0,
 @additional=[],
 @answer=
  [[#<Resolv::DNS::Name: kimcorealty.com.>, 1020, #<Resolv::DNS::Resource::IN::TXT:0x00007fd261c89638 @strings=["MS=ms98433547"], @ttl=1020>],
   [#<Resolv::DNS::Name: kimcorealty.com.>, 1020, #<Resolv::DNS::Resource::IN::TXT:0x00007fd261c72578 @strings=["docusign=69340a61-0fcc-46b8-b7a9-2d49a40007c3"], @ttl=1020>],
   [#<Resolv::DNS::Name: kimcorealty.com.>,
    1020,
    #<Resolv::DNS::Resource::IN::TXT:0x00007fd261c5b490
     @strings=
      ["v=spf1 ip4:167.206.63.136 ip4:64.238.213.254 ip4:66.77.249.235 ip4:66.77.249.236 ip4:216.203.55.53 ip4:216.203.55.54 ip4:209.114.43.188 include:spf.protection.outlook.com include:spf-00297101.pphosted.com ~all"],
     @ttl=1020>],
   [#<Resolv::DNS::Name: kimcorealty.com.>,
    1020,
    #<Resolv::DNS::Resource::IN::TXT:0x00007fd261c483e0 @strings=["atlassian-domain-verification=vA/K8uyQPRi6pNbTDb5/Hu/yk900zY28QlEtwyrwRs8bKY/N7UG27xsGA8eLjS1V"], @ttl=1020>]],
 @authority=[],
 @id=27795,
 @opcode=0,
 @qr=1,
 @question=[[#<Resolv::DNS::Name: kimcorealty.com.>, Resolv::DNS::Resource::IN::TXT]],
 @ra=1,
 @rcode=0,
 @rd=1,
 @tc=1>


[8] pry(#<Resolv::DNS>)> reply.tc

=> 1

[9] pry(#<Resolv::DNS>)> requester

=> #<Resolv::DNS::Requester::UnconnectedUDP:0x00007fd262172708
 @nameserver_port=[["192.168.0.1", 53], ["192.168.0.1", 53]],
 @senders=
  {[["192.168.0.1", 53], 27795]=>
    #<Resolv::DNS::Requester::UnconnectedUDP::Sender:0x00007fd25ef3e200
     @data=#<Resolv::DNS::Name: kimcorealty.com.>,
     @host="192.168.0.1",
     @msg="l\x93\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\vkimcorealty\x03com\x00\x00\x10\x00\x01",
     @port=53,
     @sock=#<UDPSocket:fd 8, AF_INET, 0.0.0.0, 45796>>},
 @socks=[#<UDPSocket:fd 8, AF_INET, 0.0.0.0, 45796>],
 @socks_hash={"0.0.0.0"=>#<UDPSocket:fd 8, AF_INET, 0.0.0.0, 45796>}>

任何想法如何解决这个问题?

0 个答案:

没有答案