Package: whois21
whois21WHOIS21 is a simple and easy to use python package that lets you easily query whois information of a
domain.FeaturesWHOISQuery whois information of a TLD from various whois servers and parse the results.Get the Registration Information of a domain from different RDAP servers and parse the results.Get IP information from ip-api.com.Any idea? Feel free toopen an issueor submit
a pull request.InstallationWell, this is a python package so the first thing you need is python.If you don't have python installed, please visitPython.organd install the
latest version of python based on your OS.Then you can install whois21 using pip module:# Use this command to get the latest version from pypi.org and install it automaticallypython-mpipinstallwhois21-U# OR# Download the release file from GitHub: https://github.com/MPCodeWriter21/whois21/releases# And install it using this commandpipinstallwhois21-x.x.x.tar.gzOr you can clonethe repositoryand run:python-mbuild.Dependenciesrequests: Used for:Downloading list of whois and RDAP servers.Downloading RDAP information.importlib_resources: Used for:Getting the path to the whois21 package installation directory(for saving server lists).chardet: Used for:Detecting the encoding of the whois response.log21: Used for:Colorized Logging.Printing collected data in pprint or tree format.os(A core python module): Used for:Working with files and directories.socket(A core python module): Used for:Establishing TCP connection to the whois server.json(A core python module): Used for:Parsing JSON data from RDAP servers.Parsing RDAP server list.Saving collected whois or/and RDAP data to a file.Loading some package data from a file.datetime(A core python module): Used for:Converting Creation/Updated/Expiration date to a usable python datetime object.ipaddress(A core python module): Used for:Validating IPv4 and IPv6 addresses.typing(A core python module): Used for:Type checking.Type hinting.re(A core python module): Used for:Matching date-time strings with regular expressions.Changes1.4.5Updated DependenciesUsage Examples:CLI ExamplesExample 1: Query whois information of google.com# -v : verbose modewhois21-vgoogle.comExample 2: Query whois information of 3 domains and save the results to a directory# -R : saves the results as raw text# -np: avoids printing the results to the screen# -o results: saves the results to `./results` directorywhois21-R-np-oresultsgoogle.comfacebook.compinterest.comExample 3: Query whois information of 3 IPs and save the results to a directory# Options explained in the examples abovewhois21-R-np-v-oresults1.1.1.1157.240.20.17464.91.226.82Example 4: Query RDAP information of domains and IPs and save the results to a file# -r: Gets the RDAP information of the queried domains and IPswhois21-np-oresults-oresults-rmicrosoft.compython.org140.82.121.3185.147.178.13Python Code ExamplesExample 1: Query whois information of GitHub.com using WHOIS class.# First step is to import the packageimportwhois21query='github.com'# Second step is to create an instance of the WHOIS classwhois=whois21.WHOIS(query)# Third step is to check if the operation was successfulifnotwhois.success:print(whois.error)exit()# And basically you are done!# Now you can print the resultsimportlog21# I use log21 to print the results in a cool way 8D# Print the results in a nice way# PPrint the dictionarylog21.pprint(whois.whois_data)# Tree-Print the dictionarylog21.tree_print(whois.whois_data)# Or you can print the results in as raw textprint(whois.raw.decode('utf-8'))# Or you can access each part of the results individuallyprint(f'Creation date   :{whois.creation_date}')print(f'Expiration date :{whois.expires_date}')print(f'Updated date    :{whois.updated_date}')AboutAuthor: CodeWriter21 (Mehrad Pooryoussof)GitHub:MPCodeWriter21Telegram Channel:@CodeWriter21Aparat Channel:CodeWriter21Licenseapache-2.0DonateIn order to support this project you can donate some crypto of your choice 8DDonate AddressesOr if you can't, simply givethis projectone star on GitHub :)ReferencesWHOIS (Wikipedia):https://en.wikipedia.org/wiki/WHOISDomains:https://www.iana.org/domains/root/db/Registration Data Access Protocol (RDAP) (
Wikipedia):https://en.wikipedia.org/wiki/Registration_Data_Access_ProtocolRDAP Response Profile (
PDF):https://www.icann.org/en/system/files/files/rdap-response-profile-15feb19-en.pdfRFC 9224 Finding the Authoritative Registration Data Access Protocol (RDAP) Servicehttps://www.rfc-editor.org/rfc/rfc9224.htmlRegistration Data Access Protocol (RDAP) Query
Format:https://www.rfc-editor.org/rfc/rfc7482.htmlRegistration Data Access Protocol (RDAP) Object
Tagging:https://www.rfc-editor.org/rfc/rfc8521.htmlFinding the Authoritative Registration Data (RDAP)
Service:https://www.rfc-editor.org/rfc/rfc7484.htmlJSON Responses for the Registration Data Access Protocol (RDAP):https://www.rfc-editor.org/rfc/rfc7483Registration Data Access Protocol (RDAP) Partial
Response:https://www.rfc-editor.org/rfc/rfc8982.htmlvCard Format
Specification:https://www.rfc-editor.org/rfc/rfc6350.txtvCard (Wikipedia):https://en.wikipedia.org/wiki/VCardNotes on vCard, LDIF and mappings to
RDF:https://www.w3.org/2002/12/cal/vcard-notes.html