快速并发检查 .co.za 域的 SOA DNS 记录

发布于 2024-08-11 19:20:59 字数 1515 浏览 5 评论 0原文

我想通过检查 SOA是否存在来尽可能准确地对 .co.za 域名实施批量可用性检查使用 C# ASP.NET 的 MX 记录。

我正在寻找一种解决方案,可以通过正确利用线程一次检查至少 10 个域的方式来检查相关 DNS 记录。

“为什么不直接使用 API?”

检查 .co.za 域可用性的唯一真正准确的方法是使用 http://co.za/whois.shtml,但过时的 WHOIS 服务不允许批量检查并限制对给定 IP 的连续检查。

之前的工作

迄今为止,我通过使用古老的经典 ASP 脚本(利用 Emmanuel Kartmann 称为“简单 DNS 解析器”的旧 DNS 库)获得了相当准确的结果。但是,这种方法无法很好地扩展,我需要能够通过正确线程化的 ASP.NET 实现来处理更多用户。

我现在使用的顽皮代码看起来像这样:

Dim oDNS, pDomain, found_names

Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")

oDNS.ServerAddresses = "127.0.0.1" // Set DNS server to use
oDNS.Separator = "," // Set separator for found_names multiple outputs

对每个域执行以下操作:

Err.Clear // Reset error flag. I know, I hate it too.

oDNS.Resolve pDomain, found_names, "C_IN", "T_SOA" // Look for SOA records for domain

If Err <> 0 Then // No SOA records could be found.
    Err.Clear // Reset error flag
    oDNS.GetEmailServers pDomain, found_names // Look for MX records
    If Err <> 0 Then // No MX records found either
        AssumeDomainIsAvailable(pDomain);
    Else // Found some MX records
        DomainUnavailable(pDomain);
    End If

Else // Found some SOA records
    DomainUnavailable(pDomain);
End If

任何改进检测的建议都会受到赞赏。这是我关于 SO 的第一个问题,所以请原谅我的冗长,并感谢您宝贵的时间。

I want to implement bulk availability checking of .co.za domain names as accurately as possible by checking for the existence of SOA or MX records using C# ASP.NET.

I am looking for a solution that can check for the relevant DNS records in a way that properly utilises threading to check at least 10 domains at a time.

"Why don't you just use an API?"

The only truly accurate way of checking the availibility of a .co.za domain is to use http://co.za/whois.shtml, but the archaic WHOIS service does not allow bulk checking and limits consecutive checks for a given IP.

Previous Work

To date, I have gotten fairly accurate results by using my ancient classic ASP script utilising an old DNS library called "Simple DNS Resolver" by Emmanuel Kartmann. However, this approach does not scale well and I need to be able to handle more users with a properly threaded ASP.NET implementation.

The naughty code I'm using right now looks something like this:

Dim oDNS, pDomain, found_names

Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")

oDNS.ServerAddresses = "127.0.0.1" // Set DNS server to use
oDNS.Separator = "," // Set separator for found_names multiple outputs

Execute the following for each domain:

Err.Clear // Reset error flag. I know, I hate it too.

oDNS.Resolve pDomain, found_names, "C_IN", "T_SOA" // Look for SOA records for domain

If Err <> 0 Then // No SOA records could be found.
    Err.Clear // Reset error flag
    oDNS.GetEmailServers pDomain, found_names // Look for MX records
    If Err <> 0 Then // No MX records found either
        AssumeDomainIsAvailable(pDomain);
    Else // Found some MX records
        DomainUnavailable(pDomain);
    End If

Else // Found some SOA records
    DomainUnavailable(pDomain);
End If

Any recommendation for improving detection is appreciated. This is my first question on SO, so forgive my verbosity and thanks for your precious time.

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

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

发布评论

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

评论(2

暗地喜欢 2024-08-18 19:20:59

非常容易:

var Response = JHSoftware.DnsClient.Lookup("example.com", 
                              JHSoftware.DnsClient.RecordType.SOA);

使用 JH Software 的 适用于 .NET 的 DNS 客户端库,这将 还支持异步查找的 BeginLookup / EndLookup 方法。

This would be very easy using JH Software's DNS Client Library for .NET:

var Response = JHSoftware.DnsClient.Lookup("example.com", 
                              JHSoftware.DnsClient.RecordType.SOA);

It also supports BeginLookup / EndLookup methods for asynchronous lookups.

风柔一江水 2024-08-18 19:20:59

如果在网络上提供服务
“限制对给定 IP 的连续检查”,这可能是有充分理由的(既是为了保护系统,也是为了让投机者的生活变得更加困难)。称其为“过时”当然无济于事。

此外,许多 DNS 请求可能被视为违反服务条款和/或字典攻击,并且可能(免责声明:我不知道 co.za 的政策)导致列入黑名单。

If the service offered on the Web
"limits consecutive checks for a given IP", it is probably for good reasons (both to preserve the system and to make life more difficult for speculators). Calling it "archaic" certainly will not help.

Also, a lot of DNS requests may be seen as a violation of the terms of service and/or as a dictionary attack and may (disclaimer: I do not know the policies of co.za) lead to blacklisting.

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