Created
February 27, 2014 00:46
-
-
Save szepeviktor/9242001 to your computer and use it in GitHub Desktop.
Magyar IP cím tartomány generáló - maxmind.com & ip.ludost.net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUT="GeoIPhuWhois.txt" | |
OUT2="ip.ludost.txt" | |
if ! [ -f GeoIPCountryWhois.csv ] | |
then | |
wget -q http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip | |
7z x GeoIPCountryCSV.zip > /dev/null | |
fi | |
echo '<Files wp-login.php> | |
# GeoLite data created by MaxMind | |
# http://dev.maxmind.com/geoip/legacy/geolite/ | |
order deny,allow | |
deny from all' > $OUT | |
grep ',"HU",' GeoIPCountryWhois.csv | \ | |
cut -d"," -f1,2 | sed 's|^"\(.*\)","\(.*\)"$|\1 \2|' | \ | |
while read r | |
do | |
range2cidr.awk $r | while read r2 | |
do | |
echo " Allow from $r2" | |
done | |
done >> $OUT | |
######################## | |
echo '<Files wp-login.php>' > $OUT2 | |
wget -qO - --post-data="country=1&country_list=hu&format_template=apache-allow&format_name=&format_target=&format_default=" \ | |
https://ip.ludost.net/cgi/process >> $OUT2 | |
echo '</Files>' | tee -a $OUT2 >> $OUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment