smeserver-xt_geoip/source/root/usr/share/xt_geoip/geoip_look
2023-02-06 23:04:43 +04:00

12 lines
230 B
Bash

#! /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