解析 whois 答案

发布于 2024-08-24 12:07:49 字数 598 浏览 8 评论 0 原文

我想创建这样的 whois 类

public class DomainInfo
{

     public string NameServer {get;set;}        
     public string CreationDate {get;set;}
     public string UpdatedDate {get;set;} 
     public string ExpirationDate {get;set;}
     public string Status {get;set;}        
     public string RegistrantName {get;set;}
     public string RegistrantOrganization {get;set;}
     public string Registrantemail {get;set;}        
     public static DomainInfo Parse(string inputData)
  {
     ......
  }
}

,但是我遇到了一些问题,因为不同的 DNS 服务器返回不同的答案,并且解析返回的答案是一项非常困难的任务。这怎么能做到呢?

I want to create whois class like that

public class DomainInfo
{

     public string NameServer {get;set;}        
     public string CreationDate {get;set;}
     public string UpdatedDate {get;set;} 
     public string ExpirationDate {get;set;}
     public string Status {get;set;}        
     public string RegistrantName {get;set;}
     public string RegistrantOrganization {get;set;}
     public string Registrantemail {get;set;}        
     public static DomainInfo Parse(string inputData)
  {
     ......
  }
}

But I have some problems because different DNS servers return different answers and it's a very difficult task to parse returned answers. How can this be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

要走就滚别墨迹 2024-08-31 12:07:49

如果不为您遇到的每个 whois 数据库实现解析器,就无法完成此任务。

Whois 没有标准化格式,大多数注册管理机构甚至没有通过 whois 提供的所有信息,而是为您提供一个句柄,您可以在填写验证码时通过 HTTP 检查:

$ whois google.no
% Kopibeskyttet, se http://www.norid.no/domenenavnbaser/whois/kopirett.html
% Rights restricted by copyright. See http://www.norid.no/domenenavnbaser/whois/kopirett.en.html

Domain Information

Domain Name................: google.no
Organization Handle........: GNA78O-NORID
Registrar Handle...........: REG466-NORID
Legal-c Handle.............: RH1355P-NORID
Tech-c Handle..............: JM722P-NORID
Zone-c Handle..............: JM722P-NORID
...

It can't be done without implementing a parser for every whois database you come across.

Whois has no standardized format, most registries don't even have all that info available over whois but instead give you a handle that you can check over HTTP while filling out a captcha:

$ whois google.no
% Kopibeskyttet, se http://www.norid.no/domenenavnbaser/whois/kopirett.html
% Rights restricted by copyright. See http://www.norid.no/domenenavnbaser/whois/kopirett.en.html

Domain Information

Domain Name................: google.no
Organization Handle........: GNA78O-NORID
Registrar Handle...........: REG466-NORID
Legal-c Handle.............: RH1355P-NORID
Tech-c Handle..............: JM722P-NORID
Zone-c Handle..............: JM722P-NORID
...
糖果控 2024-08-31 12:07:49

以下是博客文章的链接,其中包含一些可能有帮助的 C# 代码:

http://blog.flipbit.co.uk/2009/06/querying-whois-server-data-with-c.html

您可能可以调整解析代码,因为您遇到您无法获得所需数据的情况,但我认为没有一种万能的解决方案。

Here is a link to a blog post with some C# code that might help:

http://blog.flipbit.co.uk/2009/06/querying-whois-server-data-with-c.html

You could probably tweak the parsing code as you run into instances where you are not getting the data you need but I don't think there is a one shoe fits all solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文