Skip to content

Instantly share code, notes, and snippets.

@horzadome
Created June 11, 2012 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horzadome/2909740 to your computer and use it in GitHub Desktop.
Save horzadome/2909740 to your computer and use it in GitHub Desktop.
Script to insert Croatian IP ranges to hosts.allow
#!/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