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 verbosity and thanks for your precious time.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x