Created
June 11, 2012 11:52
-
-
Save horzadome/2909740 to your computer and use it in GitHub Desktop.
Script to insert Croatian IP ranges to hosts.allow
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 | |
# Author: Davor Grubisa for Igor Tomljanovic | |
# v01. Davor Grubisa horzadome@gmail.com - written it | |
# Replace this wrkdir line with /etc when ready | |
wrkdir=$HOME/testing | |
outfile=hosts.allow | |
tmpfile=hosts.allow.tmp | |
cd $wrkdir | |
touch $outfile | |
echo "# Autogenerated file, any manual edit is overwritten">$outfile | |
echo "">$tmpfile | |
dlurl="http://sistemac.carnet.hr/hr_alloclist/hr-iplist.txt" | |
dlhandler=`which curl` | |
dlopts="-Ss -o" | |
dllist=`$dlhandler $dlopts $tmpfile $dlurl` | |
sed -i '/^\#/d' $tmpfile | |
for i in `cat $tmpfile`; do | |
echo "ALL:"$i >> $outfile ; | |
done | |
rm $tmpfile | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment