smeserver-xt_geoip/root/usr/share/xt_geoip/geoip_look

12 lines
230 B
Plaintext
Raw Permalink Normal View History

#! /bin/bash
for par in "$@"
do
CN=$(/usr/bin/mmdblookup --file /usr/share/GeoIP/GeoLite2-Country.mmdb --ip $par country iso_code 2>/dev/null | cut -d\" -f2| tr -d '\n')
if [ -z $CN ]; then echo 'XX'; else echo $CN; fi
done