Turning A Raspi Into AdBlock

pi

There’s nothing quite as annoying as seeing bandwidth wasted on unimpressive flash animations, irrelevant ads, and animated GIFs. The bad news is these ads are the sole source of income for a lot of your favorite websites – Hackaday included. The good news is you can turn these ads off with a Raspberry Pi, a WiFi adapter, and a little bit of fun in the terminal.

This build creates a wireless access point with a WiFi adapter plugged in to a Raspberry Pi. With an Ethernet cable plugged in, this effectively turns the Raspi into a wireless router.

To configure the software to block ads, it’s a simple matter of installing dnsmasq from the command line and making sure all the ads on your favorite webpages time out. This means a fairly big hit on the performance of your new DIY router, but with the installation of Pixelserv you can host a 1-pixel transparent GIF image that replaces all the ads and renders them invisible.

It’s a great project if you don’t like watching ads on your PS3, XBox, tablet, or other non-PC Internetting device. If people stealing your wireless connection is a problem, it shouldn’t be hard to make every image upside down or blurry for those rogue WiFi pirates.

42 thoughts on “Turning A Raspi Into AdBlock

    1. Unless you’re using a device that doesn’t allow browser add-ons, as was mentioned in the HaD summary. But hey, who reads the whole summary anymore, right?

      I’m actually more interested in the ability to manipulate what others see when using your wifi. A lot of fun could be had with unauthorized freeloaders. My neighbor’s son is constantly trying to break in on my router; it might be fun to let him “break in” and then manipulate the feed.

      1. No idea what method this random router out in the stix was using. Once when using my tablet it picked up an open wifi router so I connected. What I got was chaosnet. Some sentences were translated into random languages. Some had random color changes. And I got rick rolled at every turn. It was so awesome I drove out there again to try and find who owned it but it was offline.

  1. I suppose it’s funny to see a website which depends on ads for revenue, give instructions on how to eliminate it. Then again, as the article mentioned, my problem is wostly with nonsense like flash ads, or obnoxious seizure inducing flashing ones (both of which you guys are thankfully bereft of).

    1. Not any funnier or ironic than opening the Google’s Chrome browser to see that the ad block plus icon was still on the address bar, and still working. Disabled for hackaday in the browsers I use most.

    2. The fact that HaD is willing to post this material shows that HaD is still relevant. I block everything and the kitchen sink on principle. If site revenue would depend on 100% of the viewing audience being exposed to ads, then logically the ads would cater to the lowest common denominator and following suit so would the content.I mean, How many commercial media outlets do you know that provide unbiased quality whilst depending on advertising income?
      Ad driven content loses quality every time.
      This article shows that HaD is still content driven which is a good and rare thing.

  2. If HaD (and any other site for that matter) would CONTROL their advertisements, I wouldn’t block them. Instead, sites farm out their ad engine to the lowest bidder highest payer and then their viewers (the people they should care about) get blasted with at best stupid ads and at worst malware. Is it any wonder smart people do their best to block such crap? Give me targeted, well behaved, clearly presented, pre-screened, 110% malware/crapware/slimeware free ad’s, and watch your click thru rate skyrocket.

    1. Thing is, you’re into a routine with it now as well as always expecting adverts to be shite. SO, if sites were to control their ad’s you wouldn’t know about it because you’re already blocking them. Catch 22.

      Basically if you already adblock it doesn’t matter how ‘nice’ the adverts are, you’ll still block them.

      1. Not necessarily. I use Adblock on Firefox, and I whitelist sites that I read regularly, as long as they don’t carry annoying ads. HaD is one of them, as well as OSNews, and the few webcomics I read. On Slashdot I have excellent karma and the option from them to turn off ads, but I leave them on. CowboyNeal has to eat, after all.

        1. Ah, fellow /. reader! I wasn’t saying that that’s how everyone looks at advertising, just vonskippy seems a little angry at sites not controlling their ads and incites “whitewash all ads” type behaviour to deal with it. Personally I do let ads for sites I read regularly through (although while we’re mentioning it Slashdot normally give me the option to remove them for positive contribution), but there are some sites where the adverts are just too aggressive (pop-ups, ones that grey out the screen until closed, video ads) and they do get the blacklist treatment.

          CowboyNeal is still alive? I thought that’s what we’ve been eating the whole time!

      2. This seems like a good time to point out that Adblock has a setting designed to deal with this situation called “Allow Non Intrusive Ads”, which is checked by default. Basically, websites that don’t have animated or inline ads can request to be put on a whitelist, and then they will show up for people running Adblock as long as the user has not gone into the settings and unchecked the checkbox. (Nobody ever does, it appears… I don’t think most people even realize it is there.)

        Extrapolating the new, different future problems created when the primary income source for most websites is being controlled by a small number of unaccountable whitelist operators is left as an exercise for the reader.

      3. Odd that adblockers would not work if the ads were served up by hackaday.com directly. If they did then huge chunks of content would go missing.

        That is all people really want. Tasteful ads, serverd up by the domain they are going to. Why should someone trust that an ad being loaded by another site that loads flash from another, javascript from another, and so on isn’t saturated with malware at worst and annoyance at best?

        1. Not really, adblocking is just doing a bit of grep on the URL for each item. It’d be very, very easy, in fact I could do it now with a right-click, to filter out ads as long as their URLs were distinguishable from the content.

          A site could bypass it if they wanted to be s00per-smart by randomising all URLs. Tho you can still just disable images. Or use Javascript to serve up ads + content. Like most things there’s ways and means. I think turning it into an arms race tho would piss off readers of sites that go out of their way to ignore their choice and preferences.

  3. I don’t block ads. Most are easily ignorable, impact on my bandwidth is minimal, and websites are entitled to a little income for using them. But I can still think of instances in which it would be handy to block specific websites. Will try this with a spare Pogoplug soon.

    It’s a bit of irony that the picture for this post is a particularly gaudy animated GIF, though. :)

    1. I’ve done my own version of upside-down ternet (a forever work in progress). it’ll randomly: swap out the image for an image of my choosing, mess the image up, or insert rick into gif (from what i remember, that wasn’t working too well). additionally, if it’s a *.swf file, rick will perform a ‘solo’ (it’s uh… creepy when the page uses multiple flash mulitple times in a website). If i ever figure it (running and writing the script), i’d like to get an ICAP server running to allow me to mess with the text content – insert messages, cgnahe ltteer oedrr, etc… :P. Of course the logical thing to do is encrypt your wifi.

      1. Much more fun not to encrypt it though; I use a dhcp whitelist to give ‘guests’ a squid proxy which redirects all http to cute kittens. (it used to be goatse but my other half complained she couldn’t look the neighbours in the face)

        Completely insecure of course, but really if the police want to plant kiddie porn on my server then WPA isn’t gonna stop them it’s just a lot harder to convince the layman it wasn’t me.

  4. i really like the idea of a central adblocking ‘server’. I admit that I do it myself (with the additon of site that commonly, supposedly, transmit malware). I haven’t done enough digging, but a whitelisting (allow ads to show on certain websites, like hackaday, but block all ads when viewing site ?????.com) feature would be great. im not sure how well rasberry pi would handle squid + ???. dansguardian and squidguard have whitelisting capabilities, but not sure if they would do what i’m looking for – not a blanket any ads being hosted on ads.google.com (or similar). I’m sure an ICAP server would work and allow for a multitude of other possiblitiies. I also don’t know how those would work with SSL connections.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.