AsusWRTPurity/Autoupdate_dnscrypt_blocklist.sh at master · rugabunda/AsusWRTPurity
DoD blocklist, Speed up browsing upto 10x, remove all PUP's (Potentially unwanted probes) + Much more - rugabunda/AsusWRTPurity
This script automatically updates dnscrypt blocked-names.txt while allowing your custom rules to be maintained. Recommended: update to at least dnscrypt 2.1.9 and enable hot reloading in dnscrypt-proxy.toml so changes to blocklist are applied instantly without having to restart dnscrypt.
Download/Install
Code:
wget -O /jffs/scripts/update_dnscrypt.sh https://github.com/rugabunda/AsusWRTPurity/raw/refs/heads/master/Autoupdate_dnscrypt_blocklist.sh && chmod 755 /jffs/scripts/update_dnscrypt.sh
Add cron job to services-start: update blocklist every 6 hours
Code:
echo 'cru a update_dnscrypt "0 */6 * * * /jffs/scripts/update_dnscrypt.sh"' >> /jffs/scripts/services-start
Enable in current session without reboot
Code:
cru a update_dnscrypt "0 */6 * * * /jffs/scripts/update_dnscrypt.sh"
Ensure code matches blocked-names.txt path in dnscrypt-proxy.toml & preferred log path.
Important: If using custom entries at top of blocklist, you may change sed line number accordingly, if none, you may use 1. Reserve space by inserting empty lines eg. up to line 1000; update sed to match.
Code:
#!/bin/sh
# Script to update DNSCrypt blocklist
# Downloads latest domain list and replaces blocked-names.txt content after line 345
# Define file paths
BLOCKLIST="/jffs/addons/dnscrypt/blocked-names.txt" # blocklist location
BACKUP_FILE="${BLOCKLIST}.backup" # Fixed backup name (will overwrite previous backup)
DOWNLOADED_FILE="/jffs/addons/dnscrypt/oisd_big_domainswild.txt"
# Create a backup first (overwriting any previous backup)
cp "$BLOCKLIST" "$BACKUP_FILE"
if [ $? -ne 0 ]; then
echo "Failed to create backup on $(date)" >> /jffs/addons/dnscrypt/update_dnscrypt.log
exit 1
fi
# Download the latest blocklist
curl -s -o "$DOWNLOADED_FILE" "https://big.oisd.nl/domainswild"
# Check if download was successful
if [ $? -ne 0 ]; then
echo "Failed to download blocklist on $(date)" >> /jffs/addons/dnscrypt/update_dnscrypt.log
exit 1
fi
# Delete everything in blocked-names.txt after line 345 and append downloaded content
sed -i '346,$d' "$BLOCKLIST"
cat "$DOWNLOADED_FILE" >> "$BLOCKLIST"
# Reload DNSCrypt (uneeded after 2.1.9 if Hot-reloading is enabled, changes apply instantly)
#/jffs/dnscrypt/manager dnscrypt-start
echo "DNSCrypt blocklist updated successfully on $(date)" >> /jffs/addons/dnscrypt/update_dnscrypt.log
Last edited: