How to integrate whois in my web application
Posted by File-Big@reddit | learnprogramming | View on Reddit | 2 comments
I want to create a web application similar to HackerTarget's Autonomous System Lookup. The thing is that I don't want to use any external API's for the lookup, instead I want to use whois and I don't know how to integrate that, any help would be greatly appreciated.
I have created a Python script using Flask, installed whois. I want a really minimalist application with a search bar where I can insert several IP Addresses and get their ASN.
teraflop@reddit
I assume you mean you installed the
whois
command-line tool? If so, you can run it from your Python program and capture its output using the built-insubprocess
module.There are also Python modules that will act as a client for the WHOIS protocol directly, without requiring a separate subprocess, e.g. python-whois.
Or, if you want, you could implement the protocol yourself using sockets by reading and following the RFC 3912 specification.
grantrules@reddit
Yeah, WHOIS is pretty much the simplest protocol out there. Connect to port 43, send domain name followed by \n and then read the results.