Skip to main content

A domain validation package, written by CYREBRO's Innovation team.

Project description

Powered by CYREBRO

CYREBRO's Domain Validator

During an internal development, we noticed that existing domain validation Python packages are not deeply validating domains.
Most of the time these packages only check the domain validity using regex, which mostly is not enough.
That is why we at CYREBRO decided to create one that takes a deeper look into domains and provides a more reliable result.


Validations

CYREBRO's domain validator checks for:

  1. regex validity - deep regex, includes a list of known TLDs.
  2. HTTP(/s) availability.
  3. nslookup.
  4. whois.
  5. dkim records.
  6. spf records.

Installation

Through pip

To install the package, simply type:

pip install cyrebro-domain-validator
Through GitHub

Firstly, clone the repository and extract the files.
Export the files and navigate to the directory using the terminal/command line window.
Lastly, once in an activated venv, enter the following command in the terminal/command line window:

Windows

python .\setup.py install

Linux

python3 ./setup.py install

Dependencies

The dependencies will be installed automatically once installing the package.


Usage

Input Parameters

  • domain_name: str -> mandatory.
  • dkim_selector: str -> optional.
  • raw_data: bool -> optional.

Using The Package

CYREBRO's Domain Validator allows you to receive the scan results in both boolean expression and dictionary formats.

Importing

from cyrebro_domain_validator import DomainValidator, validate_domain

Basic Usage

The basic usage will provide you with a simple True or False answer, it allows for easy check within a condition.
The function will return True if the answer is positive for one of the validity checks mentioned above.
Example:

if validate_domain(domain_name="github.com"):
    do_work()
Advanced Usage

If a True or False answer does not match your needs, a dictionary is automatically generated upon run.
The dictionary allows one to view the result of each validation separately, for more advanced usage in the code.
To access the dictionary, simply provide True as the raw_data flag, a dictionary object will be returned.
Example:

domain_validation_details = validate_domain(domain_name="github.com", raw_data=True)
print(domain_validation_details, type(domain_validation_details))

Output:

{
"regex": True,
"http": True,
"https": True,
"nslookup": True,
"whois": True,
"dkim": True,
"spf": True
}

<class 'dict'>

The dictionary is available even if the domain is not valid.

Note: the package requires internet connection to work properly.


DKIM Clarification

In order to retrieve the DKIM record of a domain, a specific query is used with a domain-specific selector.
Due to the nature of this package, we are unable to know in advance the selectors that are used by each domain.
We gathered some common DKIM selectors and the package tries querying with all of them.

However, if you know the DKIM selector in advance (by extracting it from an email for example), the package accepts an arbitrary DKIM selector:
domain_validator = DomainValidator("github.com", dkim_selector="some_selector")
If a specific selector is passed, it will be firstly queried by the package.
If for some reason, a result is unavailable, a fallback was implemented to try all common selectors.


Development

Contributing is more than welcome and even encouraged by us.
For any suggestions an email can be sent to: innovation@cyrebro.io.
Pull requests are an option as well :blush: :hugs:.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cyrebro_domain_validator-0.3.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cyrebro_domain_validator-0.3.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file cyrebro_domain_validator-0.3.2.tar.gz.

File metadata

File hashes

Hashes for cyrebro_domain_validator-0.3.2.tar.gz
Algorithm Hash digest
SHA256 c721ac97e15738b992f8bfb911441106a4d4333a604c97d7f0716f5e30dcb5f2
MD5 738833353ff1d7c39501fac68a8ee5ef
BLAKE2b-256 c2781d2e84eb3fdbafa896ea85e8243961a6235f6d62f0edc1c0baf43a57828e

See more details on using hashes here.

File details

Details for the file cyrebro_domain_validator-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cyrebro_domain_validator-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e38e94f6fe119454f6cdb9ac463c958918990a2ff2980283af15a61b6defa3
MD5 c02f50191f6c9f80c191d29bc68cc952
BLAKE2b-256 db30e4bc8ede59dabbdd5e61442eea967936a6859f2509cfa5a1c6633bcb7f0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page