0

I'm developing a simple app in c#, that can check if a domain name is available to puchase for a specific tld. The method: I downloaded a whois-server list, I send the domain name to its whois server with a TCP client on the protocol 43, and check the servers answer. The problem: more countries has the same whois server: "whois.ripe.net" . If I send the full domain name(with tld), the server's answer is always "No entries found in source RIPE.". If I send the domain name without tld, I dont get any tld specific data about the status of the domain name.

The method I use:

private string GetWhoisInformation(string whoisServer, string url)
    {
        try
        {
            StringBuilder stringBuilderResult = new StringBuilder();
            TcpClient tcpClinetWhois = new TcpClient(whoisServer, 43);
            NetworkStream networkStreamWhois = tcpClinetWhois.GetStream();
            BufferedStream bufferedStreamWhois = new BufferedStream(networkStreamWhois);
            StreamWriter streamWriter = new StreamWriter(bufferedStreamWhois);

            streamWriter.WriteLine(url);
            streamWriter.Flush();

            StreamReader streamReaderReceive = new StreamReader(bufferedStreamWhois);

            while (!streamReaderReceive.EndOfStream)
                stringBuilderResult.AppendLine(streamReaderReceive.ReadLine());
            return stringBuilderResult.ToString();
        }
        catch
        {
            return "lekérdezés sikertelen";
        }
    }

Example: I do:

GetWhoisInformation("whois.ripe.net", "pokerstars.hu")

The server's answer:

%ERROR:101: no entries found
%
% No entries found in source RIPE.

for the next command:

GetWhoisInformation("whois.ripe.net", "pokerstars")

the result contains several blocks like this:

% Information related to '80.65.254.128 - 80.65.254.159'

inetnum:        80.65.254.128 - 80.65.254.159
netname:        Pokerstars
descr:          Hosting
country:        GB
admin-c:        DC77-RIPE
tech-c:         JM2352-RIPE
status:         assigned PA
mnt-by:         manx-telecom-mnt
changed:        bill.hogg@manx-telecom.com 20101123
source:         RIPE

There's no information about the domain name "pokerstars.hu". Of course, I get exactly the same answers if I want to check pokerstars.va. Pokerstars.hu is a registred domain, pokerstars.va is not.

How can I find the correct status of a domain name?

  • 1
    Doesn't the RIPE whois server have nothing to do with domain names? It's for IP addresses and network resources (like ASNs, etc...). Are you sure you are supposed to be using this whois server for ccTLD queries? – Celada Oct 03 '12 at 01:34
  • It is in the same list with good, working whois servers. It is supposed to work. At some countries, I dont find alternative whois servers. Every 'up to date' whois server list contains a lot of RIPE records. –  Oct 03 '12 at 01:49
  • @Celada I can't argue with you never having heard of RIPE till this question but the server he uses describes itself as WHOIS2 in responses. – Peter Wone Oct 03 '12 at 04:24
  • The proper server for `.hu` domains is `whois.nic.hu`. You will only get a response redirecting to http://www.domain.hu/domain/English/domainsearch/ though. – tripleee Oct 03 '12 at 16:15
  • The response you got is (indirectly) for `pokerstars.com` aka `pokerstars.co.uk` FWIW, because your query was interpreted as requesting a netname, and the name of the 80.65.254.128/27 network is indeed "pokerstars", just like the output shows. – tripleee Oct 03 '12 at 16:20

2 Answers2

1

RIPE does not serve as a ccTLD whois server for any domains; like ARIN, it contains only netblock information. Each ccTLD has its own root whois server (or, that is, some of them don't have a proper whois service -- for example, the Spanish .es registry requires that you use a web client, with an obnoxious CAPTCHA you have to fill in every time).

See also http://www.ripe.net/data-tools/db although it is not very explicit about what the database does not contain.

You can get the address of the authoritative whois server by requesting the ccTLD's information from whois.iana.org.

vnix$ whois -h whois.iana.org hu | fgrep whois:
whois:        whois.nic.hu

See also http://www.iana.org/domains/root/db/

tripleee
  • 175,061
  • 34
  • 275
  • 318
0

I tried your code against whois.melbourneit.net and it found one of my domains no trouble. I was able to reproduce your problem running against RIPE and so I tried the same query interactively on their website - and had the same result. There's nothing wrong with your code.

tripleee is right about whois.nic.hu, I successfully used it to resolve pokerstars.hu - which leaves me wondering what the blazes is purpose of the RIPE whois server.

Thanks to triplee for showing us how to obtain the whois server friendly-name for a ccTLD.


You may find this useful:

using System;
using System.IO;
using System.Net.Sockets;
using System.Text;

namespace Whois
{
  class Program
  {
    static void Main(string[] args)
    {
      string tldWhoisServer = "whois.iana.org";
      string ccTldServer, query = null;
      Console.Write("Query> ");
      while ((query = Console.ReadLine()) != string.Empty)
      {
        string tld = query.Substring(query.LastIndexOf('.') + 1);
        string foo = GetWhoisInformation(tldWhoisServer, tld);
        foo = foo.Remove(0, foo.IndexOf("whois:") + 6).TrimStart();
        ccTldServer = foo.Substring(0, foo.IndexOf('\r'));
        Console.WriteLine(GetWhoisInformation(ccTldServer, query));
        Console.Write("Query> ");
      } 
    }
    static string GetWhoisInformation(string whoisServer, string url)
    {
      try
      {
        StringBuilder stringBuilderResult = new StringBuilder();
        TcpClient tcpClinetWhois = new TcpClient(whoisServer, 43);
        NetworkStream networkStreamWhois = tcpClinetWhois.GetStream();
        BufferedStream bufferedStreamWhois = new BufferedStream(networkStreamWhois);
        StreamWriter streamWriter = new StreamWriter(bufferedStreamWhois);

        streamWriter.WriteLine(url);
        streamWriter.Flush();

        StreamReader streamReaderReceive = new StreamReader(bufferedStreamWhois);

        while (!streamReaderReceive.EndOfStream)
          stringBuilderResult.AppendLine(streamReaderReceive.ReadLine());
        return stringBuilderResult.ToString();
      }
      catch
      {
        return "Query failed";
      }
    }
  }
}
Peter Wone
  • 17,965
  • 12
  • 82
  • 134
  • Nice speculation, but unfortunately not correct. See my answer. (^: – tripleee Oct 03 '12 at 06:31
  • So what exactly is the RIPE database *for* if you can't use it to get details of domain name registrations? Who would use it and for what? – Peter Wone Oct 05 '12 at 03:50
  • It shows IP range allocations. For example, you might want to know whom the IP address 212.58.246.94 belongs to. The information shows the netblock owner, routing information, upstream, etc. – tripleee Oct 05 '12 at 04:18
  • @PeterWone RIPE is a RIR, that is an IP registry. ISPs go to it to request IP blocks and hence their database show which IP block was allocated to whom (oversimplifying things). It has nothing to do with domain name registries, which are one per TLD and where any end user could go to register a domain name. – Patrick Mevzek Jan 03 '18 at 23:01