Skip to main content

Domains blocklist aggregator

Project description

Testing Build Publish

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

python 3.13.x python 3.12.x python 3.11.x python 3.10.x python 3.9.x python 3.8.x

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


Download files

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

Source Distribution

blocklist_aggregator-1.6.0.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.

blocklist_aggregator-1.6.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file blocklist_aggregator-1.6.0.tar.gz.

File metadata

  • Download URL: blocklist_aggregator-1.6.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blocklist_aggregator-1.6.0.tar.gz
Algorithm Hash digest
SHA256 f9dd85dfd28aa7d224985493792336cb2ad5cc48b0afcf8012fbde92097e8f90
MD5 66b1d7c96e90cd37dae715d4a027fb6a
BLAKE2b-256 c9cf0d07eeb4becff30eadbdcdf0cf7e9f7cc831ef000aebd51e474372faee82

See more details on using hashes here.

Provenance

The following attestation bundles were made for blocklist_aggregator-1.6.0.tar.gz:

Publisher: publish.yml on dmachard/python-blocklist-aggregator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blocklist_aggregator-1.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for blocklist_aggregator-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7afca45958f97e4ca42111155704d6dd6285ea2d006c8e2c8f949cfe32edd20c
MD5 e91cd6755ef1d57e36d6fcd6ff24c722
BLAKE2b-256 1960f56cb4fa6a4bf5143957f43ad03f63f2677ab3fe82d30b0f30761122e0a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for blocklist_aggregator-1.6.0-py3-none-any.whl:

Publisher: publish.yml on dmachard/python-blocklist-aggregator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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