Skip to main content

Async dnsbl lists checker based on asyncio/aiodns.

Project description

Pydnsbl

pytest workflow

Async dnsbl lists checker based on asyncio/aiodns. Checks if ip is listed in anti-spam dns blacklists. Multiple dns blacklists supported. Use aiodns for async dns requests. Usually ip check run for 50+ lists takes less than one second. Also allow to check domains.

Installation

pip install pydnsbl

Requirements

  • python >= 3.5
  • aiodns

Usage

Check ip

>>> import pydnsbl
>>> ip_checker = pydnsbl.DNSBLIpChecker()
>>> ip_checker.check('8.8.8.8')
<DNSBLResult: 8.8.8.8  (0/52)>
>>> ip_checker.check('68.128.212.240')
<DNSBLResult: 68.128.212.240 [BLACKLISTED] (6/52)>

Check domain

>>> import pydnsbl
>>> domain_checker = pydnsbl.DNSBLDomainChecker()
>>> domain_checker.check('google.com')
<DNSBLResult: google.com  (0/4)>
>>> domain_checker.check('belonging708-info.xyz')
<DNSBLResult: belonging708-info.xyz [BLACKLISTED] (2/4)>

DNSBLResult properties

  • DNSBLResult.addr - ip address or domain that was checked
  • DNSBLResult.blacklisted - boolean, True if ip/domain detected by at least one provider
  • DNSBLResult.detected_by - dictionary containing providers hosts detected this ip/domain as keys and their category verdicts
  • DNSBLResult.categories - combined categories from all providers for this ip/domain
  • DNSBLResult.providers - list of providers that was performing the check
  • DNSBLResult.failed_providers - list of providers that was unable to check this ip properly (possibly provider was down)
>>> result = domain_checker.check('belonging708-info.xyz')
>>> result.addr
'belonging708-info.xyz'
>>> result.blacklisted
True
>>> result.detected_by
{'multi.surbl.org': ['unknown'], 'dbl.spamhaus.org': ['spam']}
>>> result.categories
{'unknown', 'spam'}
>>> result.providers
[<Provider: uribl.spameatingmonkey.net>, <Provider: multi.surbl.org>, <Provider: rhsbl.sorbs.net >, <Provider: dbl.spamhaus.org>]
>>> result.failed_providers
[]

Extending/overriding providers

Basic

from pydnsbl import DNSBLIpChecker, providers
from pydnsbl.providers import BASE_PROVIDERS, Provider
providers = BASE_PROVIDERS + [Provider('yourprovider1.com'), ...]
checker = DNSBLIpChecker(providers=providers)

Advanced

Take a look into providers.py file.

  • Use Provider class to create your custom providers.
  • Override process_response method of Provider class to map providers response codes (127.0.0.x) to DNSBL categories.

Contact

Feel free to contact me: ippolitov87 at gmail.com

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

pydnsbl-1.1.5.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

pydnsbl-1.1.5-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pydnsbl-1.1.5.tar.gz.

File metadata

  • Download URL: pydnsbl-1.1.5.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for pydnsbl-1.1.5.tar.gz
Algorithm Hash digest
SHA256 471b378bdb375fe378234d9b90622365edc954fe52ed00fbd6022b6806289e6b
MD5 a37d4076329013477a5c7752879b54dd
BLAKE2b-256 c46f41b1e7a7fee59732caf65cbaaa0bf2ef17aac731c32e7966489c61d04f89

See more details on using hashes here.

File details

Details for the file pydnsbl-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: pydnsbl-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for pydnsbl-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1d7b83fc7bed6621c5e94268723df76e9ace45e2310c4f0d44d63095d538ede9
MD5 bcfc358dfcb53c1c08fbcdf1f9bb5c32
BLAKE2b-256 9aba5afcf6c8d0f90da8db472883e54854eb4dbe3cab9db7e8d7a3e0695feaad

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