Async dnsbl lists checker based on asyncio/aiodns.
Project description
Pydnsbl
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.6
- 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 checkedDNSBLResult.blacklisted
- boolean, True if ip/domain detected by at least one providerDNSBLResult.detected_by
- dictionary containing providers hosts detected this ip/domain as keys and their category verdictsDNSBLResult.categories
- combined categories from all providers for this ip/domainDNSBLResult.providers
- list of providers that was performing the checkDNSBLResult.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pydnsbl-1.1.7.tar.gz
.
File metadata
- Download URL: pydnsbl-1.1.7.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
720aa8529922d827886a614a8c1e96b3a132f65d8d81ccc3ddd0abc6d973c1e3
|
|
MD5 |
7ad0909961f70e625fa3461a7a33a296
|
|
BLAKE2b-256 |
ff2263bf5580d81e363e7cbb13c3cdf789d203514bbd774476601e260bd1b418
|
Provenance
The following attestation bundles were made for pydnsbl-1.1.7.tar.gz
:
Publisher:
pypi.yml
on dmippolitov/pydnsbl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
pydnsbl-1.1.7.tar.gz
-
Subject digest:
720aa8529922d827886a614a8c1e96b3a132f65d8d81ccc3ddd0abc6d973c1e3
- Sigstore transparency entry: 187601637
- Sigstore integration time:
-
Permalink:
dmippolitov/pydnsbl@3aae73b8c2ca0c426b3d2fd2ca30c95849622477
-
Branch / Tag:
refs/tags/v1.1.7
- Owner: https://github.com/dmippolitov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
pypi.yml@3aae73b8c2ca0c426b3d2fd2ca30c95849622477
-
Trigger Event:
push
-
Statement type:
File details
Details for the file pydnsbl-1.1.7-py3-none-any.whl
.
File metadata
- Download URL: pydnsbl-1.1.7-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f443c14d5352e443de1d38d272fa09d4caaf9c4736ab412836934611fff58ae5
|
|
MD5 |
5b632611f37deec79519a71b9424d544
|
|
BLAKE2b-256 |
bb237b6ac0ec8393b2fdecc550e6d86b429f2dac27099e29bcee9e05fafb5746
|
Provenance
The following attestation bundles were made for pydnsbl-1.1.7-py3-none-any.whl
:
Publisher:
pypi.yml
on dmippolitov/pydnsbl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
pydnsbl-1.1.7-py3-none-any.whl
-
Subject digest:
f443c14d5352e443de1d38d272fa09d4caaf9c4736ab412836934611fff58ae5
- Sigstore transparency entry: 187601638
- Sigstore integration time:
-
Permalink:
dmippolitov/pydnsbl@3aae73b8c2ca0c426b3d2fd2ca30c95849622477
-
Branch / Tag:
refs/tags/v1.1.7
- Owner: https://github.com/dmippolitov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
pypi.yml@3aae73b8c2ca0c426b3d2fd2ca30c95849622477
-
Trigger Event:
push
-
Statement type: