« Graham's Favourite Free Apps | Main | KDE4/PC-BSD Thoughts »
Wednesday
Jul012009

Fun with sed and domain blacklists

Well I couldn't sleep one night and a friend sent me a DNS blacklist of domain names. I needed it to be in the windows hosts file format to install on to an old computer, the format looks a little like this:

127.0.0.1 somedomainxxxxxxxxxxxxx.ru
127.0.0.1 someotherurlyyyy.com

However the list had several thousand lines and cut and paste will only get you so far. I used the program sed on my mac to change all these lines quickly.

$ sed "s/^/127.0.0.1\ /" InPutFile >> OutPutFile

fun times :)

Disclaimer: I'm by no means a command line wizard so there is probably a better way of doing this. Security gained by loopback hosts files is also questionable.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>