Domains blocklist aggregator
Project description
Blocklist aggregator
This python module does the aggregation of several ads/tracking/malware lists, and merges them into a unified list with duplicates removed. Create your own list from several sources.
See the blocklist-domains repository for an implementation.
Default sources are defined on the configuration file
Table of contents
Installation
If you want to generate your own unified blocklist, install this module with the pip command.
pip install blocklist_aggregator
Get started
This basic example enable to get a unified list of domains. You can save-it in a file or do what you want.
import blocklist_aggregator
unified = blocklist_aggregator.fetch()
print(unified)
[ "doubleclick.net", ..., "telemetry.dropbox.com" ]
print(len(unified))
152978
Custom configuration
See the default configuration file
The configuration contains:
- the ads/tracking/malware URL lists with the pattern (regex) to use
- the domains list to exclude (whitelist)
- additionnal domains list to block (blacklist)
The configuration can be overwritten at runtime.
cfg_yaml = "verbose: true"
unified = blocklist_aggregator.fetch(cfg_update=cfg_yaml)
or loaded from external config file
unified = blocklist_aggregator.fetch(cfg_filename="/home/custom-blocklist.conf")
Fetch and save-it to files
This module can be used to export the list in several format:
- text
- hosts
- CDB (key/value database)
import blocklist_aggregator
# fetch domains
unified = blocklist_aggregator.fetch()
# save to a text file
blocklist_aggregator.save_raw(filename="/tmp/unified_list.txt")
# save to hosts file
blocklist_aggregator.save_hosts(filename="/tmp/unified_hosts.txt", ip="0.0.0.0")
# save to CDB
blocklist_aggregator.save_cdb(filename="/tmp/unified_domains.cdb")
For developpers
INstall prerequisites
sudo apt install python3-venv python3.13-dev
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
Run test units
python3 -m unittest discover tests/ -v
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blocklist_aggregator-1.4.2.tar.gz.
File metadata
- Download URL: blocklist_aggregator-1.4.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efe15001a671e69fdc74feb27539e99032e76410f381d2410447736099bb51fb
|
|
| MD5 |
e67ee871c81ae5b29715d267b6d918ba
|
|
| BLAKE2b-256 |
2f8b07df3e82552f1be84f445f6478d888f5f48fd85fbac48d8c9610394a40f3
|
Provenance
The following attestation bundles were made for blocklist_aggregator-1.4.2.tar.gz:
Publisher:
publish.yml on dmachard/python-blocklist-aggregator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blocklist_aggregator-1.4.2.tar.gz -
Subject digest:
efe15001a671e69fdc74feb27539e99032e76410f381d2410447736099bb51fb - Sigstore transparency entry: 804370495
- Sigstore integration time:
-
Permalink:
dmachard/python-blocklist-aggregator@88ab61a5d5596b6c09dc64130063df4c38299590 -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/dmachard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88ab61a5d5596b6c09dc64130063df4c38299590 -
Trigger Event:
release
-
Statement type:
File details
Details for the file blocklist_aggregator-1.4.2-py3-none-any.whl.
File metadata
- Download URL: blocklist_aggregator-1.4.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68bd655113d6d597aa7616806f54e5ea25a2bb2bd4f411610df2b4b0a6dca69f
|
|
| MD5 |
08ec5e35577ebda16bcdb8dc517e1c37
|
|
| BLAKE2b-256 |
e2a41f7646076439f7051c579c45ab1f43fe7d266d08ba074234d420f0c419da
|
Provenance
The following attestation bundles were made for blocklist_aggregator-1.4.2-py3-none-any.whl:
Publisher:
publish.yml on dmachard/python-blocklist-aggregator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blocklist_aggregator-1.4.2-py3-none-any.whl -
Subject digest:
68bd655113d6d597aa7616806f54e5ea25a2bb2bd4f411610df2b4b0a6dca69f - Sigstore transparency entry: 804370500
- Sigstore integration time:
-
Permalink:
dmachard/python-blocklist-aggregator@88ab61a5d5596b6c09dc64130063df4c38299590 -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/dmachard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88ab61a5d5596b6c09dc64130063df4c38299590 -
Trigger Event:
release
-
Statement type: