Project

dns-sniper

0.0
Low commit activity in last 3 years
No release in over a year
dns-sniper generates DNS configuration files based on various user-defined blacklists online. Configuration files can be generated for use in Ruby applications or from the command line.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.2, < 7.0.3
~> 5.1
 Project Readme

dns-sniper

dns-sniper is a command line utility that combines online DNS blacklists and combines them into the desired configuration format.

Supported Formats

Input formats

  • HOSTS
  • plaintext (hostnames as newline-seperated list)

Output formats

  • bind 8
  • dnsmasq
  • HOSTS
  • plaintext (hostnames as newline-seperated list)
  • unbound

Installation

Using bundler, add to the Gemfile:

gem 'dns-sniper'

Or standalone:

$ gem install dns-sniper

Sample Usage

From within Ruby

require 'dns-sniper'

hostnames = DNSSniper::Hostnames.new

# Manually add blacklisted or whitelisted domains
hostnames.blacklist += 'ads.yahoo.com'
hostnames.whitelist += 'favoritewebsite.com'

# Use an Importer to process external lists
hostnames.blacklist += DNSSniper::DomainsImporter.new('https://raw.githubusercontent.com/brodyhoskins/dns-blocklists/master/tracking.list').hostnames
hostnames.blacklist += DNSSniper::HostsImporter.new('https://pgl.yoyo.org/as/serverlist.php?hostformat=hosts;showintro=0;mimetype=plaintext').hostnames

# Blocklist is accessible as an Array
hostnames.blocklist

# List available formats
DNSSniper::Exporters.all

# Convert to desired format
hostnames.to_unbound

From CLI

See dns-sniper --help

Using the CLI version makes it easy to update configuration formats automatically. For example:

#!/usr/bin/env bash

/path/to/dns-sniper --conf ~/.config/dns-sniper/dns-sniper.yml --output unbound > /etc/unbound/unbound.conf.d/blocklist.conf
service unbound reload