From 6867cba6ac0fb4247181f676664eb4adc1b6b98d Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Fri, 28 Jun 2019 15:59:35 +0200 Subject: [PATCH] UPDATE update-bad-ips [MASTER] --- .dev-tools/update-bad-ips.sh | 114 ++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 27 deletions(-) diff --git a/.dev-tools/update-bad-ips.sh b/.dev-tools/update-bad-ips.sh index f77992f0d..7fd625c1a 100755 --- a/.dev-tools/update-bad-ips.sh +++ b/.dev-tools/update-bad-ips.sh @@ -3,49 +3,109 @@ # REPO: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker # Copyright Mitchell Krog - mitchellkrog@gmail.com -# ******************************* -# Input and Output File Variables -# ******************************* +# ------------------------------------------------------------------------------ +# MIT License +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 Mitchell Krog - mitchellkrog@gmail.com +# https://github.com/mitchellkrogza +# ------------------------------------------------------------------------------ +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# ------------------------------------------------------------------------------ +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# ------------------------------------------------------------------------------ +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# ------------------------------------------------------------------------------ + +# ------------------------ +# Set Terminal Font Colors +# ------------------------ + +bold=$(tput bold) +red=$(tput setaf 1) +green=$(tput setaf 2) +yellow=$(tput setaf 3) +blue=$(tput setaf 4) +magenta=$(tput setaf 5) +cyan=$(tput setaf 6) +white=$(tput setaf 7) +defaultcolor=$(tput setaf default) + +# --------- +# Variables +# --------- outputfile=${TRAVIS_BUILD_DIR}/_generator_lists/bad-ip-addresses.list - -# ************** -# Temp Variables -# ************** - tmp=${TRAVIS_BUILD_DIR}/_generator_lists/tmp.list -# ********************************************** -# Fetch our feed(s) and append to our input file -# ********************************************** +# --------- +# FUNCTIONS +# --------- -fetch () { - sudo wget https://raw.githubusercontent.com/mitchellkrogza/Suspicious.Snooping.Sniffing.Hacking.IP.Addresses/master/ips.list -O ${outputfile} +fetchBadIPs () { + sudo wget https://hosts.ubuntu101.co.za/bad-ips.list -O ${outputfile} +echo "${bold}${green}----------------------------" +echo "${bold}${green}Fetching Latest BAD IPs List" +echo "${bold}${green}----------------------------" +printf "\n\n" } -# ************************************************* -# Prepare our input lists and remove any duplicates -# ************************************************* - -initiate () { - - # Prepare Feed 1 +prepareBadIPs () { sudo sort -u ${outputfile} -o ${outputfile} grep '[^[:blank:]]' < ${outputfile} > ${tmp} sudo mv ${tmp} ${outputfile} sudo dos2unix ${outputfile} - +echo "${bold}${green}-----------------------------" +echo "${bold}${green}Preparing Latest BAD IPs List" +echo "${bold}${green}-----------------------------" +printf "\n\n" } -# ***************** +# ----------------- # Trigger Functions -# ***************** +# ----------------- -fetch -initiate +fetchBadIPs +prepareBadIPs -# ********************** +# ---------------------- # Exit With Error Number -# ********************** +# ---------------------- exit ${?} + +# ------------------------------------------------------------------------------ +# MIT License +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 Mitchell Krog - mitchellkrog@gmail.com +# https://github.com/mitchellkrogza +# ------------------------------------------------------------------------------ +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# ------------------------------------------------------------------------------ +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# ------------------------------------------------------------------------------ +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# ------------------------------------------------------------------------------