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

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.1.0.tar.gz (5.8 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.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blocklist_aggregator-1.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for blocklist_aggregator-1.1.0.tar.gz
Algorithm Hash digest
SHA256 386e597a437ac965cdd134798979a22e8fffe24a9d9e0b6e7a39c10ab100e054
MD5 8e09f91ed70c1e7189a4906f17ad26b3
BLAKE2b-256 ef6a022a60c1cf8e4d00c2e7ce2f0684de356903f75db3258186ffea9c5b205a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blocklist_aggregator-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d3821d50a64de92564cbc1a5d0762f1bb37709b1239bdcc8c2c7ddb11ef9fd7
MD5 ea3c598b984e6f3ef3a8f97e55e3c1fd
BLAKE2b-256 a6e58d98c5406eaa4c043198c0476a51966e66a5ace1ab1b4c6470e6825a2617

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