Fixed misspelling and blocklist menu loop

This commit is contained in:
Phil Connor 2024-06-26 16:53:53 -05:00
parent 6cee4da2c1
commit ba7fa334ed

View File

@ -1,116 +1,140 @@
#! /bin/bash #! /bin/bash
function bdsatib() { function bdsatib() {
{ {
ufw-blocklist -l "bdsatib https://www.binarydefense.com/banlist.txt" ufw-blocklists.sh -l "bdsatib https://www.binarydefense.com/banlist.txt"
if ! crontab -l | grep -q "bdsatib"; then if ! crontab -l | grep -q "bdsatib"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "bdsatib https://www.binarydefense.com/banlist.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "bdsatib https://www.binarydefense.com/banlist.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function f2ball() { function f2ball() {
{ {
ufw-blocklist -l "f2ball https://lists.blocklist.de/lists/all.txt" ufw-blocklists.sh -l "f2ball https://lists.blocklist.de/lists/all.txt"
if ! crontab -l | grep -q "f2ball"; then if ! crontab -l | grep -q "f2ball"; then
echo -e "$(crontab -u root -l)\n*/35 * * * * /usr/local/bin/ufw-blocklists.sh -l "f2ball https://lists.blocklist.de/lists/all.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n*/35 * * * * /usr/local/bin/ufw-blocklists.sh -l "f2ball https://lists.blocklist.de/lists/all.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function bfblocker() { function bfblocker() {
{ {
ufw-blocklist -l "bfblocker https://danger.rulez.sk/projects/bruteforceblocker/blist.php" ufw-blocklists.sh -l "bfblocker https://danger.rulez.sk/projects/bruteforceblocker/blist.php"
if ! crontab -l | grep -q "bfblocker"; then if ! crontab -l | grep -q "bfblocker"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "bfblocker https://danger.rulez.sk/projects/bruteforceblocker/blist.php"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "bfblocker https://danger.rulez.sk/projects/bruteforceblocker/blist.php"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function cinsarmy() { function cinsarmy() {
{ {
ufw-blocklist -l "cinsarmy http://cinsscore.com/list/ci-badguys.txt" ufw-blocklists.sh -l "cinsarmy http://cinsscore.com/list/ci-badguys.txt"
if ! crontab -l | grep -q "cinsarmy"; then if ! crontab -l | grep -q "cinsarmy"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "cinsarmy http://cinsscore.com/list/ci-badguys.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "cinsarmy http://cinsscore.com/list/ci-badguys.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function drop() { function drop() {
{ {
if grep -q -E "IPV6=(yes|YES)" /etc/default/ufw; then if grep -q -E "IPV6=(yes|YES)" /etc/default/ufw; then
ufw-blocklist -l "drop https://www.spamhaus.org/drop/drop.txt" -l "dropv6 https://www.spamhaus.org/drop/dropv6.txt" ufw-blocklists.sh -l "drop https://www.spamhaus.org/drop/drop.txt" -l "dropv6 https://www.spamhaus.org/drop/dropv6.txt"
if ! crontab -l | grep -q "dropv6"; then if ! crontab -l | grep -q "dropv6"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "drop https://www.spamhaus.org/drop/drop.txt" -l "dropv6 https://www.spamhaus.org/drop/dropv6.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "drop https://www.spamhaus.org/drop/drop.txt" -l "dropv6 https://www.spamhaus.org/drop/dropv6.txt"" | crontab -u root -
fi fi
else else
ufw-blocklist -l "drop https://www.spamhaus.org/drop/drop.txt" ufw-blocklists.sh -l "drop https://www.spamhaus.org/drop/drop.txt"
if ! crontab -l | grep -q "drop"; then if ! crontab -l | grep -q "drop"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "drop https://www.spamhaus.org/drop/drop.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "drop https://www.spamhaus.org/drop/drop.txt"" | crontab -u root -
fi fi
fi fi
blocklist_menu
} }
} }
function edrop() { function edrop() {
{ {
ufw-blocklist -l "edrop https://www.spamhaus.org/drop/edrop.txt" ufw-blocklists.sh -l "edrop https://www.spamhaus.org/drop/edrop.txt"
if ! crontab -l | grep -q "edrop"; then if ! crontab -l | grep -q "edrop"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "edrop https://www.spamhaus.org/drop/edrop.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "edrop https://www.spamhaus.org/drop/edrop.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function feodoc2() { function feodoc2() {
{ {
ufw-blocklist -l "feodoc2 https://feodotracker.abuse.ch/downloads/ipblocklist_recommended.txt" ufw-blocklists.sh -l "feodoc2 https://feodotracker.abuse.ch/downloads/ipblocklist_recommended.txt"
if ! crontab -l | grep -q "feodoc2"; then if ! crontab -l | grep -q "feodoc2"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "feodoc2 https://feodotracker.abuse.ch/downloads/ipblocklist_recommended.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "feodoc2 https://feodotracker.abuse.ch/downloads/ipblocklist_recommended.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function feodoioc() { function feodoioc() {
{ {
ufw-blocklist -l "feodoioc https://feodotracker.abuse.ch/downloads/ipblocklist.txt" ufw-blocklists.sh -l "feodoioc https://feodotracker.abuse.ch/downloads/ipblocklist.txt"
if ! crontab -l | grep -q "fedoioc"; then if ! crontab -l | grep -q "fedoioc"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "feodoioc https://feodotracker.abuse.ch/downloads/ipblocklist.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "feodoioc https://feodotracker.abuse.ch/downloads/ipblocklist.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function firehol() { function firehol() {
{ {
ufw-blocklist -l "firehol https://iplists.firehol.org/files/firehol_level1.netset" ufw-blocklists.sh -l "firehol https://iplists.firehol.org/files/firehol_level1.netset"
if ! crontab -l | grep -q "firehol"; then if ! crontab -l | grep -q "firehol"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "firehol https://iplists.firehol.org/files/firehol_level1.netset"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "firehol https://iplists.firehol.org/files/firehol_level1.netset"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function greensnow() { function greensnow() {
{ {
ufw-blocklist -l "greensnow https://blocklist.greensnow.co/greensnow.txt" ufw-blocklists.sh -l "greensnow https://blocklist.greensnow.co/greensnow.txt"
if ! crontab -l | grep -q "bdsatib"; then if ! crontab -l | grep -q "bdsatib"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "greensnow https://blocklist.greensnow.co/greensnow.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "greensnow https://blocklist.greensnow.co/greensnow.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function ipsum() { function ipsum() {
{ {
ufw-blocklist -l "ipsum https://raw.githubusercontent.com/stamparm/ipsum/master/levels/2.txt" ufw-blocklists.sh -l "ipsum https://raw.githubusercontent.com/stamparm/ipsum/master/levels/2.txt"
if ! crontab -l | grep -q "ipsum"; then if ! crontab -l | grep -q "ipsum"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "ipsum https://raw.githubusercontent.com/stamparm/ipsum/master/levels/2.txt"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "ipsum https://raw.githubusercontent.com/stamparm/ipsum/master/levels/2.txt"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
function maxmind(){ function maxmind(){
{ {
ufw-blocklist -l "maxmind https://www.maxmind.com/en/anonymous_proxies" ufw-blocklists.sh -l "maxmind https://www.maxmind.com/en/anonymous_proxies"
if ! crontab -l | grep -q "maxmind"; then if ! crontab -l | grep -q "maxmind"; then
echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "maxmind https://www.maxmind.com/en/anonymous_proxies"" | crontab -u root - echo -e "$(crontab -u root -l)\n@daily /usr/local/bin/ufw-blocklists.sh -l "maxmind https://www.maxmind.com/en/anonymous_proxies"" | crontab -u root -
fi fi
blocklist_menu
} }
} }
@ -137,40 +161,28 @@ function blocklist_menu() {
read -rn 1 user_input read -rn 1 user_input
if [[ "$user_input" == '1' ]]; then if [[ "$user_input" == '1' ]]; then
bdsatib bdsatib
blocklist_menu
elif [[ "$user_input" == '2' ]]; then elif [[ "$user_input" == '2' ]]; then
f2ball f2ball
blocklist_menu
elif [[ "$user_input" == '3' ]]; then elif [[ "$user_input" == '3' ]]; then
bfblocker bfblocker
blocklist_menu
elif [[ "$user_input" == '4' ]]; then elif [[ "$user_input" == '4' ]]; then
cins cins
blocklist_menu
elif [[ "$user_input" == '5' ]]; then elif [[ "$user_input" == '5' ]]; then
feodoc2 feodoc2
blocklist_menu
elif [[ "$user_input" == '6' ]]; then elif [[ "$user_input" == '6' ]]; then
feodoioc feodoioc
blocklist_menu
elif [[ "$user_input" == '7' ]]; then elif [[ "$user_input" == '7' ]]; then
firehol firehol
blocklist_menu
elif [[ "$user_input" == '8' ]]; then elif [[ "$user_input" == '8' ]]; then
maxmind maxmind
blocklist_menu
elif [[ "$user_input" == '9' ]]; then elif [[ "$user_input" == '9' ]]; then
greensnow greensnow
blocklist_menu
elif [[ "$user_input" == '10' ]]; then elif [[ "$user_input" == '10' ]]; then
ipsum ipsum
blocklist_menu
elif [[ "$user_input" == '11' ]]; then elif [[ "$user_input" == '11' ]]; then
drop drop
blocklist_menu
elif [[ "$user_input" == '12' ]]; then elif [[ "$user_input" == '12' ]]; then
edrop edrop
blocklist_menu
elif [[ "$user_input" == xX ]]; then elif [[ "$user_input" == xX ]]; then
exit 0 exit 0
elif [[ "$user_input" == bB ]]; then elif [[ "$user_input" == bB ]]; then