whois21
=====
![version](https://img.shields.io/pypi/v/whois21)
![stars](https://img.shields.io/github/stars/MPCodeWriter21/whois21)
![forks](https://img.shields.io/github/forks/MPCodeWriter21/whois21)
![repo size](https://img.shields.io/github/repo-size/MPCodeWriter21/whois21)
[![CodeFactor](https://www.codefactor.io/repository/github/mpcodewriter21/whois21/badge)](https://www.codefactor.io/repository/github/mpcodewriter21/whois21)
WHOIS21 is a simple and easy to use python package that lets you easily query whois information of a
domain.
Features
--------
### WHOIS
+ Query 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 to [open an issue](https://github.com/MPCodeWriter21/whois21/issues) or submit
a pull request.
![issues](https://img.shields.io/github/issues/MPCodeWriter21/whois21)
![contributors](https://img.shields.io/github/contributors/MPCodeWriter21/whois21)
Installation
------------
Well, this is a python package so the first thing you need is python.
If you don't have python installed, please visit [Python.org](https://python.org) and install the
latest version of python based on your OS.
Then you can install whois21 using pip module:
```shell
# Use this command to get the latest version from pypi.org and install it automatically
python -m pip install whois21 -U
# OR
# Download the release file from GitHub: https://github.com/MPCodeWriter21/whois21/releases
# And install it using this command
pip install whois21-x.x.x.tar.gz
```
Or you can clone [the repository](https://github.com/MPCodeWriter21/whois21) and run:
```shell
python -m build .
```
### Dependencies
+ [requests](https://requests.readthedocs.io/en/master/): Used for:
- Downloading list of whois and RDAP servers.
- Downloading RDAP information.
+ [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/): Used for:
- Getting the path to the whois21 package installation directory(for saving server lists).
+ [chardet](https://pypi.org/project/chardet/): Used for:
- Detecting the encoding of the whois response.
+ [log21](https://github.com/MPCodeWriter21/log21): Used for:
- Colorized Logging.
- Printing collected data in pprint or tree format.
+ [os](https://docs.python.org/3/library/os.html) (A core python module): Used for:
- Working with files and directories.
+ [socket](https://docs.python.org/3/library/socket.html) (A core python module): Used for:
- Establishing TCP connection to the whois server.
+ [json](https://docs.python.org/3/library/json.html) (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](https://docs.python.org/3/library/datetime.html) (A core python module): Used for:
- Converting Creation/Updated/Expiration date to a usable python datetime object.
+ [ipaddress](https://docs.python.org/3/library/ipaddress.html) (A core python module): Used for:
- Validating IPv4 and IPv6 addresses.
+ [typing](https://docs.python.org/3/library/typing.html) (A core python module): Used for:
- Type checking.
- Type hinting.
+ [re](https://docs.python.org/3/library/re.html) (A core python module): Used for:
- Matching date-time strings with regular expressions.
Changes
-------
### 1.4.5
+ Updated Dependencies
Usage Examples:
---------------
### CLI Examples
+ Example 1: Query whois information of google.com
```shell
# -v : verbose mode
whois21 -v google.com
```
+ Example 2: Query whois information of 3 domains and save the results to a directory
```shell
# -R : saves the results as raw text
# -np: avoids printing the results to the screen
# -o results: saves the results to `./results` directory
whois21 -R -np -o results google.com facebook.com pinterest.com
```
+ Example 3: Query whois information of 3 IPs and save the results to a directory
```shell
# Options explained in the examples above
whois21 -R -np -v -o results 1.1.1.1 157.240.20.174 64.91.226.82
```
+ Example 4: Query RDAP information of domains and IPs and save the results to a file
```shell
# -r: Gets the RDAP information of the queried domains and IPs
whois21 -np -o results -o results -r microsoft.com python.org 140.82.121.3 185.147.178.13
```
### Python Code Examples
+ Example 1: Query whois information of GitHub.com using WHOIS class.
```python
# First step is to import the package
import whois21
query = 'github.com'
# Second step is to create an instance of the WHOIS class
whois = whois21.WHOIS(query)
# Third step is to check if the operation was successful
if not whois.success:
print(whois.error)
exit()
# And basically you are done!
# Now you can print the results
import log21 # I use log21 to print the results in a cool way 8D
# Print the results in a nice way
# PPrint the dictionary
log21.pprint(whois.whois_data)
# Tree-Print the dictionary
log21.tree_print(whois.whois_data)
# Or you can print the results in as raw text
print(whois.raw.decode('utf-8'))
# Or you can access each part of the results individually
print(f'Creation date : {whois.creation_date}')
print(f'Expiration date : {whois.expires_date}')
print(f'Updated date : {whois.updated_date}')
```
About
-----
Author: CodeWriter21 (Mehrad Pooryoussof)
GitHub: [MPCodeWriter21](https://github.com/MPCodeWriter21)
Telegram Channel: [@CodeWriter21](https://t.me/CodeWriter21)
Aparat Channel: [CodeWriter21](https://www.aparat.com/CodeWriter21)
### License
![License](https://img.shields.io/github/license/MPCodeWriter21/whois21)
[apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
### Donate
In order to support this project you can donate some crypto of your choice 8D
[Donate Addresses](https://github.com/MPCodeWriter21/whois21/blob/master/DONATE.md)
Or if you can't, simply give [this project](https://github.com/MPCodeWriter21/whois21)
one star on GitHub :)
References
----------
+ WHOIS (Wikipedia): [https://en.wikipedia.org/wiki/WHOIS](https://en.wikipedia.org/wiki/WHOIS)
+ Domains: [https://www.iana.org/domains/root/db/](https://www.iana.org/domains/root/db/)
+ Registration Data Access Protocol (RDAP) (
Wikipedia): [https://en.wikipedia.org/wiki/Registration_Data_Access_Protocol](https://en.wikipedia.org/wiki/Registration_Data_Access_Protocol)
+ RDAP Response Profile (
PDF): [https://www.icann.org/en/system/files/files/rdap-response-profile-15feb19-en.pdf](https://www.icann.org/en/system/files/files/rdap-response-profile-15feb19-en.pdf)
+ RFC 9224 Finding the Authoritative Registration Data Access Protocol (RDAP) Service
[https://www.rfc-editor.org/rfc/rfc9224.html](https://www.rfc-editor.org/rfc/rfc9224.html)
+ Registration Data Access Protocol (RDAP) Query
Format: [https://www.rfc-editor.org/rfc/rfc7482.html](https://www.rfc-editor.org/rfc/rfc7482.html)
+ Registration Data Access Protocol (RDAP) Object
Tagging: [https://www.rfc-editor.org/rfc/rfc8521.html](https://www.rfc-editor.org/rfc/rfc8521.html)
+ Finding the Authoritative Registration Data (RDAP)
Service: [https://www.rfc-editor.org/rfc/rfc7484.html](https://www.rfc-editor.org/rfc/rfc7484.html)
+ JSON Responses for the Registration Data Access Protocol (RDAP):
[https://www.rfc-editor.org/rfc/rfc7483](https://www.rfc-editor.org/rfc/rfc7483)
+ Registration Data Access Protocol (RDAP) Partial
Response: [https://www.rfc-editor.org/rfc/rfc8982.html](https://www.rfc-editor.org/rfc/rfc8982.html)
+ vCard Format
Specification: [https://www.rfc-editor.org/rfc/rfc6350.txt](https://www.rfc-editor.org/rfc/rfc6350.txt)
+ vCard (Wikipedia): [https://en.wikipedia.org/wiki/VCard](https://en.wikipedia.org/wiki/VCard)
+ Notes on vCard, LDIF and mappings to
RDF: [https://www.w3.org/2002/12/cal/vcard-notes.html](https://www.w3.org/2002/12/cal/vcard-notes.html)
Raw data
{
"_id": null,
"home_page": "",
"name": "whois21",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "python,python3,CodeWriter21,WHOIS,whois21,RDAP,Registration Data Access Protocol,DNS,ASN",
"author": "",
"author_email": "\"CodeWriter21(Mehrad Pooryoussof)\" <CodeWriter21@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/48/1e/c2652029a2737518eab4746db1d6c2f214376216bea9d67f0b67f75cda0f/whois21-1.4.5.tar.gz",
"platform": null,
"description": "whois21\n=====\n\n![version](https://img.shields.io/pypi/v/whois21)\n![stars](https://img.shields.io/github/stars/MPCodeWriter21/whois21)\n![forks](https://img.shields.io/github/forks/MPCodeWriter21/whois21)\n![repo size](https://img.shields.io/github/repo-size/MPCodeWriter21/whois21)\n[![CodeFactor](https://www.codefactor.io/repository/github/mpcodewriter21/whois21/badge)](https://www.codefactor.io/repository/github/mpcodewriter21/whois21)\n\nWHOIS21 is a simple and easy to use python package that lets you easily query whois information of a\ndomain.\n\nFeatures\n--------\n\n### WHOIS\n\n+ Query whois information of a TLD from various whois servers and parse the results.\n+ Get the Registration Information of a domain from different RDAP servers and parse the results.\n+ Get IP information from ip-api.com.\n+ Any idea? Feel free to [open an issue](https://github.com/MPCodeWriter21/whois21/issues) or submit\n a pull request.\n\n![issues](https://img.shields.io/github/issues/MPCodeWriter21/whois21)\n![contributors](https://img.shields.io/github/contributors/MPCodeWriter21/whois21)\n\nInstallation\n------------\n\nWell, this is a python package so the first thing you need is python.\n\nIf you don't have python installed, please visit [Python.org](https://python.org) and install the\nlatest version of python based on your OS.\n\nThen you can install whois21 using pip module:\n\n```shell\n# Use this command to get the latest version from pypi.org and install it automatically\npython -m pip install whois21 -U\n\n# OR\n# Download the release file from GitHub: https://github.com/MPCodeWriter21/whois21/releases\n# And install it using this command\npip install whois21-x.x.x.tar.gz\n```\n\nOr you can clone [the repository](https://github.com/MPCodeWriter21/whois21) and run:\n\n```shell\npython -m build .\n```\n\n### Dependencies\n\n+ [requests](https://requests.readthedocs.io/en/master/): Used for:\n - Downloading list of whois and RDAP servers.\n - Downloading RDAP information.\n+ [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/): Used for:\n - Getting the path to the whois21 package installation directory(for saving server lists).\n+ [chardet](https://pypi.org/project/chardet/): Used for:\n - Detecting the encoding of the whois response.\n+ [log21](https://github.com/MPCodeWriter21/log21): Used for:\n - Colorized Logging.\n - Printing collected data in pprint or tree format.\n+ [os](https://docs.python.org/3/library/os.html) (A core python module): Used for:\n - Working with files and directories.\n+ [socket](https://docs.python.org/3/library/socket.html) (A core python module): Used for:\n - Establishing TCP connection to the whois server.\n+ [json](https://docs.python.org/3/library/json.html) (A core python module): Used for:\n - Parsing JSON data from RDAP servers.\n - Parsing RDAP server list.\n - Saving collected whois or/and RDAP data to a file.\n - Loading some package data from a file.\n+ [datetime](https://docs.python.org/3/library/datetime.html) (A core python module): Used for:\n - Converting Creation/Updated/Expiration date to a usable python datetime object.\n+ [ipaddress](https://docs.python.org/3/library/ipaddress.html) (A core python module): Used for:\n - Validating IPv4 and IPv6 addresses.\n+ [typing](https://docs.python.org/3/library/typing.html) (A core python module): Used for:\n - Type checking.\n - Type hinting.\n+ [re](https://docs.python.org/3/library/re.html) (A core python module): Used for:\n - Matching date-time strings with regular expressions.\n\nChanges\n-------\n\n### 1.4.5\n\n+ Updated Dependencies\n\nUsage Examples:\n---------------\n\n### CLI Examples\n\n+ Example 1: Query whois information of google.com\n\n```shell\n# -v : verbose mode\nwhois21 -v google.com\n```\n\n+ Example 2: Query whois information of 3 domains and save the results to a directory\n\n```shell\n# -R : saves the results as raw text\n# -np: avoids printing the results to the screen\n# -o results: saves the results to `./results` directory \nwhois21 -R -np -o results google.com facebook.com pinterest.com\n```\n\n+ Example 3: Query whois information of 3 IPs and save the results to a directory\n\n```shell\n# Options explained in the examples above\nwhois21 -R -np -v -o results 1.1.1.1 157.240.20.174 64.91.226.82\n```\n\n+ Example 4: Query RDAP information of domains and IPs and save the results to a file\n\n```shell\n# -r: Gets the RDAP information of the queried domains and IPs\nwhois21 -np -o results -o results -r microsoft.com python.org 140.82.121.3 185.147.178.13\n```\n\n### Python Code Examples\n\n+ Example 1: Query whois information of GitHub.com using WHOIS class.\n\n```python\n# First step is to import the package\nimport whois21\n\nquery = 'github.com'\n\n# Second step is to create an instance of the WHOIS class\nwhois = whois21.WHOIS(query)\n\n# Third step is to check if the operation was successful\nif not whois.success:\n print(whois.error)\n exit()\n\n# And basically you are done!\n# Now you can print the results\nimport log21 # I use log21 to print the results in a cool way 8D\n\n# Print the results in a nice way\n# PPrint the dictionary\nlog21.pprint(whois.whois_data)\n# Tree-Print the dictionary\nlog21.tree_print(whois.whois_data)\n\n# Or you can print the results in as raw text\nprint(whois.raw.decode('utf-8'))\n\n# Or you can access each part of the results individually\nprint(f'Creation date : {whois.creation_date}')\nprint(f'Expiration date : {whois.expires_date}')\nprint(f'Updated date : {whois.updated_date}')\n\n```\n\nAbout\n-----\nAuthor: CodeWriter21 (Mehrad Pooryoussof)\n\nGitHub: [MPCodeWriter21](https://github.com/MPCodeWriter21)\n\nTelegram Channel: [@CodeWriter21](https://t.me/CodeWriter21)\n\nAparat Channel: [CodeWriter21](https://www.aparat.com/CodeWriter21)\n\n### License\n\n![License](https://img.shields.io/github/license/MPCodeWriter21/whois21)\n\n[apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\n### Donate\n\nIn order to support this project you can donate some crypto of your choice 8D\n\n[Donate Addresses](https://github.com/MPCodeWriter21/whois21/blob/master/DONATE.md)\n\nOr if you can't, simply give [this project](https://github.com/MPCodeWriter21/whois21)\none star on GitHub :)\n\nReferences\n----------\n\n+ WHOIS (Wikipedia): [https://en.wikipedia.org/wiki/WHOIS](https://en.wikipedia.org/wiki/WHOIS)\n+ Domains: [https://www.iana.org/domains/root/db/](https://www.iana.org/domains/root/db/)\n+ Registration Data Access Protocol (RDAP) (\n Wikipedia): [https://en.wikipedia.org/wiki/Registration_Data_Access_Protocol](https://en.wikipedia.org/wiki/Registration_Data_Access_Protocol)\n+ RDAP Response Profile (\n PDF): [https://www.icann.org/en/system/files/files/rdap-response-profile-15feb19-en.pdf](https://www.icann.org/en/system/files/files/rdap-response-profile-15feb19-en.pdf)\n+ RFC 9224 Finding the Authoritative Registration Data Access Protocol (RDAP) Service\n [https://www.rfc-editor.org/rfc/rfc9224.html](https://www.rfc-editor.org/rfc/rfc9224.html)\n+ Registration Data Access Protocol (RDAP) Query\n Format: [https://www.rfc-editor.org/rfc/rfc7482.html](https://www.rfc-editor.org/rfc/rfc7482.html)\n+ Registration Data Access Protocol (RDAP) Object\n Tagging: [https://www.rfc-editor.org/rfc/rfc8521.html](https://www.rfc-editor.org/rfc/rfc8521.html)\n+ Finding the Authoritative Registration Data (RDAP)\n Service: [https://www.rfc-editor.org/rfc/rfc7484.html](https://www.rfc-editor.org/rfc/rfc7484.html)\n+ JSON Responses for the Registration Data Access Protocol (RDAP):\n [https://www.rfc-editor.org/rfc/rfc7483](https://www.rfc-editor.org/rfc/rfc7483)\n+ Registration Data Access Protocol (RDAP) Partial\n Response: [https://www.rfc-editor.org/rfc/rfc8982.html](https://www.rfc-editor.org/rfc/rfc8982.html)\n+ vCard Format\n Specification: [https://www.rfc-editor.org/rfc/rfc6350.txt](https://www.rfc-editor.org/rfc/rfc6350.txt)\n+ vCard (Wikipedia): [https://en.wikipedia.org/wiki/VCard](https://en.wikipedia.org/wiki/VCard)\n+ Notes on vCard, LDIF and mappings to\n RDF: [https://www.w3.org/2002/12/cal/vcard-notes.html](https://www.w3.org/2002/12/cal/vcard-notes.html)\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "A simple and easy to use Python package that lets you query whois/RDAP information of a domain/IP.",
"version": "1.4.5",
"project_urls": {
"Donations": "https://github.com/MPCodeWriter21/whois21/blob/master/DONATE.md",
"Homepage": "https://github.com/MPCodeWriter21/whois21",
"Source": "https://github.com/MPCodeWriter21/whois21"
},
"split_keywords": [
"python",
"python3",
"codewriter21",
"whois",
"whois21",
"rdap",
"registration data access protocol",
"dns",
"asn"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5b23f1d5668dff569d8ac812215180b5eff24c639959199882531482b6a27c7f",
"md5": "61d92d99869e49c0907f3259ea29cccd",
"sha256": "3a097a03f784ed7d6e0a2b318ae72f093b78da7f0ace47f7858347883f243f55"
},
"downloads": -1,
"filename": "whois21-1.4.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "61d92d99869e49c0907f3259ea29cccd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 25626,
"upload_time": "2023-11-04T13:05:05",
"upload_time_iso_8601": "2023-11-04T13:05:05.013977Z",
"url": "https://files.pythonhosted.org/packages/5b/23/f1d5668dff569d8ac812215180b5eff24c639959199882531482b6a27c7f/whois21-1.4.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "481ec2652029a2737518eab4746db1d6c2f214376216bea9d67f0b67f75cda0f",
"md5": "984a4067e310ceb838219076f7aa1413",
"sha256": "6a1845c70c940d17c3ba25fc3c162c52ef92fd11c2a9f78f1b8ae9d5a7506f22"
},
"downloads": -1,
"filename": "whois21-1.4.5.tar.gz",
"has_sig": false,
"md5_digest": "984a4067e310ceb838219076f7aa1413",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 23544,
"upload_time": "2023-11-04T13:05:06",
"upload_time_iso_8601": "2023-11-04T13:05:06.986459Z",
"url": "https://files.pythonhosted.org/packages/48/1e/c2652029a2737518eab4746db1d6c2f214376216bea9d67f0b67f75cda0f/whois21-1.4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-04 13:05:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MPCodeWriter21",
"github_project": "whois21",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "whois21"
}