UPDATE update-bad-ips [MASTER]

This commit is contained in:
Mitchell Krog 2019-06-28 15:59:35 +02:00
parent 08226696c2
commit 6867cba6ac
No known key found for this signature in database
GPG key ID: C243C388553EDE5D

View file

@ -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.
# ------------------------------------------------------------------------------