Spamhaus DROP and eDROP became a single list

Started by thatso, April 23, 2024, 12:43:20 AM

Previous topic - Next topic


Spamhaus.org are also publishing the files as json data.
Bash script to convert the json to text. You can then host this on a web server and update your alias content links.

(Modify the variables to suit your needs)


#!/usr/bin/env bash

#
# Script to download Spamhaus IPv4 and IPv6 DROP list
# This script converts the json to a text file.
#

main() {
    local url="https://www.spamhaus.org/drop/drop_v4.json"
    local urlv6="https://www.spamhaus.org/drop/drop_v6.json"
    local output_file="/www/opnsense/spamhaus-drop_v4.txt"
    local output_filev6="/www/opnsense/spamhaus-drop_v6.txt"

    curl -s $url | jq -r 'select(.cidr != null) | .cidr' >$output_file
    curl -s $urlv6 | jq -r 'select(.cidr != null) | .cidr' >$output_filev6
}

main

# Optional
# echo -e "IP addresses have been extracted:\nIPv4: $output_file\nIPv6: $output_filev6"


Hopefully, someone will find this useful.


Cheers!