Correctly invoke geoip-lookup.py with respect to the CWD.

This commit is contained in:
Manuel Friedli 2020-08-04 17:21:45 +02:00
parent fa489db45f
commit 70e98dd26d

View file

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