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”
For my browser (FF) I’ts still best to use an addon. For any other non-PC devices its a great hack. Also nice to read about the different block possibilities.
Or just do it on the router that can run dd-wrt, openwrt, tomato, etc.
This is what I started doing back in 2000 with Squid.
Most of people who visit hackaday use add blocking software. That’s certainly well above average for entire population.
Thank you for reminding me to whitelist HAD in ABP on my computer.
I do that for very few sites, most of which are my favorite webcomics.
Agreed. I do the same, accept not for this site LOL.
If you’re looking for an ad blocker for when you browse websites, it’s probably best to just use a browser add-on.
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.
A classic, make all images upside down for unauthorized people, or change them all to kittens, etc…
I’m a big fan of replacing random photos with goatse. Make the occurrence rate rare enough that it takes a while to figure out it’s the router.
Shameful plug here but definitely on topic. I used this hack on a raspberry pi as a joke hotspot (only issue is the pi isn’t powerful enough to run some of the plugins due to CPU limitations):
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.
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).
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.
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.
So what you’re saying is that you want all websites to either be run by lone amateurs off of pocket change, or charge their viewers for content?
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.
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.
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.
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!
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.
Interesting…. never knew the option to whitelist unobtrusive ads was there. Thanks for pointing it out.
It’s enabled by default.
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.
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.
Sorry, I’m not Mental2K, I just nicked his name for an amusing joke in another thread. Sorry dude. Sorry!
We’re working on that.
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. :)
very localized for you. easily ignorable and minimal bandwidth impacts are extremely relative terms. And “websites are entitled to a little income..” Fkin please.
The redirection at the end of the intro sounds fun, just redirect wifi scammers to either disney and hard core gay porn, and if the scammer keeps using your internet MOVE!
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.
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.
I use my pi as a dnsmasq server (dns not dhcp) to block ads on my iPad. Blocks most ads but not all nowhere near as good as Adblock plus.
I have upside-down ap using raspi and chinese 3$ wifi-usb and squid3
I was also thinking of making it share free black-n-white internet for apartments near me, but didnt yet do it as i had problems locating where to start writing my scripts
you can also do it without using the pi as a router
just set your dns server to the pi address, and use the normal wifi
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.
This doesn’t really work on HTTPS sites.
For the particularly evil… you can use this to replace all images with your own ads :3
or do this! http://www.ex-parrot.com/pete/upside-down-ternet.html
I run Privoxy on a dedicated server. Much more control over ad filtering.
I might have to do something like this to go with HSMM-MESH. I can’t legally pass advertisements over that and keep it legal under 47CFR97
Please be kind and respectful to help make the comments section excellent. (Comment Policy)