Search code examples
language-agnosticwhois

How to implement your own WHOIS server?


How would you get the WHOIS information to provide in the first place?

Note that I'm not actually intending to do this; I'm just interested in how it would work!


Solution

  • Simply implement the whois protocol https://www.rfc-editor.org/rfc/rfc3912

    You get a query, you look it up in your database and you send your answer. That's it. Have a look at the example:

       open TCP   ---- (SYN) ------------------------------>
                  <---- (SYN+ACK) -------------------------
       send query ---- "Smith<CR><LF>" -------------------->
       get answer <---- "Info about Smith<CR><LF>" ---------
                  <---- "More info about Smith<CR><LF>" ----
       close      <---- (FIN) ------------------------------
                  ----- (FIN) ----------------------------->
    

    How to build your own database, it depends on what information you want to provide.