From 70e98dd26d6c36cd01771fb52a37da4c08d2e4bf Mon Sep 17 00:00:00 2001
From: Manuel Friedli <manuel@fritteli.ch>
Date: Tue, 4 Aug 2020 17:21:45 +0200
Subject: [PATCH] Correctly invoke geoip-lookup.py with respect to the CWD.

---
 ddos-mitigator.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ddos-mitigator.sh b/ddos-mitigator.sh
index e06985b..0cd158d 100755
--- a/ddos-mitigator.sh
+++ b/ddos-mitigator.sh
@@ -132,7 +132,6 @@ function filter() {
 	# Reject already banned addresses
 	while read -r -u3 address ; do
 		if [[ "${banned}" != *"${address}${ext}${suffix}"* ]] ; then
-			echo "Considering ${address}${ext}${suffix}"
 			echo "${address}" >> "${filtered}"
 		else
 			echo "IGNORING ${address}${ext}${suffix}, already banned."
@@ -311,7 +310,7 @@ function process_file () {
 		addronly="$(echo "${line}" | cut -d' ' -f3-)${ext}"
 		addrwithsuffix="${addronly}${suffix}"
 		set_highlight_color "${count}"
-		country="$(./geoip-lookup.py -f "${database}" "${addronly}")"
+		country="$("${curdir}/geoip-lookup.py" -f "${database}" "${addronly}")"
 		if [[ autopilot -eq 0 ]] ; then
 			echo "Country: '${country}'"
 		fi
@@ -366,6 +365,7 @@ banlist."
 tmpdir=$(mktemp -d)
 
 # Set up all file paths
+curdir="$(dirname "$0")"
 # Define the files that will contain the addresses an subnets.
 fileraw="${tmpdir}/raw-http.txt"
 filtered="${tmpdir}/filtered-http.txt"