Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/bin/bashrm -f Deniedlistrm -f GeoIPCountry*rm -f ARGlistrm -f tempif [ -z "$1" ]; thenecho "Usage: GetDeniedIpRange.sh Country1,Country2,.....,CountryN"exit 1fiecho $1 | sed 's/,/\n/g' >ARGlist/usr/bin/mysql -h 192.168.190.114 -u root -pshop2020 -Bse "use transaction;delete from blockediprange"wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zipunzip GeoIPCountryCSV.zipwhile read arglistdoPARAM=$arglistgrep -i "$PARAM" GeoIPCountryWhois.csv | awk -F ',' '{print $3" "$4}' | sed 's/"//g' > Deniedlistwhile read linedoecho $line > tempSTART=`awk -F ' ' '{print $1}' temp`END=`awk -F ' ' '{print $2}' temp`/usr/bin/mysql -h 192.168.190.114 -u root -pshop2020 -Bse "use transaction;insert into blockediprange (start, end) values ('$START','$END')"done < Deniedlistdone < ARGlist