e2guardian/getut1.sh
2023-12-22 15:41:12 -05:00

26 lines
1 KiB
Bash
Executable file

#!/bin/bash
echo "Fetching UT1 blocklists"
if ! command -v curl >/dev/null; then
echo 'curl is required for this script to work.'
exit 1
fi
if ! command -v tar >/dev/null; then
echo 'tar is required for this script to work.'
exit 1
fi
if ! command -v sed >/dev/null; then
echo 'sed is required for this script to run.'
exit 1
fi
categories=("adult" "dating" "lingerie" "remote-control" "sexual_education" "vpn" "redirector")
for category in "${categories[@]}"; do
mkdir -p "ut1/${category}"
curl "https://dsi.ut-capitole.fr/blacklists/download/${category}.tar.gz" -o "ut1/${category}.tar.gz"
tar xzf "ut1/${category}.tar.gz" -C ut1/
sed -i "1s|^|#listcategory: \"UT1 ${category} (Report False Block: https://dsi.ut-capitole.fr/cgi-bin/squidguard_modify.cgi)\"\n|" "ut1/${category}/domains"
if [ -f "ut1/${category}/urls" ]; then
sed -i "1s|^|#listcategory: \"UT1 ${category} (Report False Block: https://dsi.ut-capitole.fr/cgi-bin/squidguard_modify.cgi)\"\n|" "ut1/${category}/urls"
fi
rm "ut1/${category}.tar.gz"
done