this is a W you motherfucker! this is a W you motherfucker!
top about projects my photos rc stuff contact home
box_top
News/my blog discussion

My little ad-blocking tool; adblock-c
24/12/2011 Filed in: Programming

First of all, Merry Christmas to whomever is reading this article! ;)

 I hate ads, and only tend to enable them on pages I use frequently (to support the page). I've been using various ad-block extensions/plugins with the browsers I use--I only use Chromium for the time being. I like the extensions, but with Chrome the ad-block extension does not actually remove the ads--it only hides them--fair enough you may say, but I like not using bandwidth on ads or material I never actually see. Therefore you can go back to use your machines /etc/hosts file. This is actually much better, because you can then "blacklist" the domains that hosts the ads; affectively never using bandwidth from these domains/hosts. This is easy, you just add the hosts to your /etc/hosts file and set their pointing IP-address to your localhost... problem solved. This is tiresome to do manually because there are so many different hosts handling ads. Therefore I decided to write a little tool. I made the tool in C, rather than a shell-script, this is because I like C, simple as that.

The C program grabs ad-block hosts lists that are provided by third-party providers that frequently updates these lists--you can also add addional ad-block hosts sources to a file yourself and then fetch this file to the program. The C program then merge these hosts to your /etc/hosts file... and voila... ads are gone! You can add this program to your crontab and have it update your host-file on a regular basis; ie. every day or week. You are never dependent on a browser extension/plugin after this.

The source is freely available and I invite you to tamper with it as much as you'd want. You can of course just download, and compile it yourself, then use it on your machine.

Please fork it and make changes/additions/fixes, I'd appricate that! Or just give it a spin ;)

Over and out! Merry Christmas and a happy new year! 

comments powered by Disqus
box_bottom

mysteries dot © 2009-2017 design/code Tobias Westergaard Kjeldsen