开发者

Fast concurrent checking of SOA DNS records for .co.za domains

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 v开发者_StackOverflow中文版erbosity and thanks for your precious time.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜