Live data from Hacker News

BeGoneAds – A Python script that blocks ads by installing common hosts files

github.com

41–50 of 97 posts

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#41
post #38

Serious question. We all realize that the economics of the internet is largely fueled by ads, so why are we so keen to block them? It’s ad revenue that have allowed technology to flourish so strongly over the last two decades.

I would not mind contextual ads that don't get in the way of viewing the actual content a website or mobile app is offering. But no, we get huge banners that cover the whole background, pop-ups, every click opens a new tab redirecting to an ad and "hot chicks in your area". If I'm seeing an intersting ad I'll click on it by myself, don't need your help really. Conclusion: it's not the ads themselves but how they get in your way. See reddit ads, google ads. They are part of the actual content.

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#42
post #38

Serious question. We all realize that the economics of the internet is largely fueled by ads, so why are we so keen to block them? It’s ad revenue that have allowed technology to flourish so strongly over the last two decades.

Whether or not ads on the internet are good is not that clear cut. But I would say 99% of tracking is both evil and mostly useless, probably with the 1% being first-party analytics to track some very simple stuff like page views.

I'm glad Firefox is now blocking third-party trackers by default (not that I needed it for myself, but it's important for others to have this).

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#43
post #24

Earlier quoted context omitted.

Why?

Why not? Modifying system hosts configuration requires privileged file system access. The mindset here should be default deny.

Yep, finding and modifying a script that runs with root privileges, but is writable by non-root users is the oldest privesc trick in the book.

With the proper permissions something like this should be ok, but I'd tread lightly. Especially with something that dynamically updates your hosts file.

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#44
post #31
post #14

Earlier quoted context omitted.

0.0.0.0 ≠ localhost

Indeed. Traffic served from 0.0.0.0 can be seen from other machines. Traffic on 127.0.0.1 or localhost cannot. Important to know when you’re doing local development vs a local demo.

IP addresses with 0 as the first octet are invalid and hopefully will not be routed. I prefer them for hosts files over localhost because localhost has to wait and time out, but 0.0.0.0 will fail right away.

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#45
post #38

Serious question. We all realize that the economics of the internet is largely fueled by ads, so why are we so keen to block them? It’s ad revenue that have allowed technology to flourish so strongly over the last two decades.

Internet was a better place when the economics of the internet was driven by porn.

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#46
post #12
post #8

Since accepting Host files from someone on the internet can be dangerous I dug into the code: The list of hosts to exclude comes from several sites here: https://github.com/anned20/begoneads/blob/2c90fcee221edf71f8... The actual application of the hosts file is here: https://github.com/anned20/begoneads/blob/2c90fcee221edf71f8... I missed something though. Is a simple domain name per line enough to send that content…

This is actually sent to the IP address 0.0.0.0, it roughly means that all the traffic of the listed hosts is routed back to localhost

[deleted]

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#47
post #22

Earlier quoted context omitted.

Isn’t that what cron is for?

Systemd has a cron system too. I’m just guessing, but it might be easier to programmatically install a systemd cron job (and making sure it runs) than doing so for the old/conventional crond?

Just using cron is back compatible

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#48
post #38

Serious question. We all realize that the economics of the internet is largely fueled by ads, so why are we so keen to block them? It’s ad revenue that have allowed technology to flourish so strongly over the last two decades.

I'd say it's not so much about the ads, more about the way they're delivered with all those shady tricks for tracking and fingerprinting. IMHO ad blocking is more about privacy than anything else...

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#49
post #39
post #38

Serious question. We all realize that the economics of the internet is largely fueled by ads, so why are we so keen to block them? It’s ad revenue that have allowed technology to flourish so strongly over the last two decades.

Not long ago, the economy was largely fueled by slavery. Yet we got rid of that.

Citation needed

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#50
post #8

Since accepting Host files from someone on the internet can be dangerous I dug into the code: The list of hosts to exclude comes from several sites here: https://github.com/anned20/begoneads/blob/2c90fcee221edf71f8... The actual application of the hosts file is here: https://github.com/anned20/begoneads/blob/2c90fcee221edf71f8... I missed something though. Is a simple domain name per line enough to send that content…

I think you may be misreading the code. It concatenates the host files at the various URLs and then inserts their contents into /etc/hosts. I only looked at a couple of those files but the ones I did used either 0.0.0.0 or 127.0.0.1 as an address combined with a domain.

To be honest, this code is over-engineered. It could be a single script with a handful of functions. At the same time, it’s missing functionality such as deduplicating entries from the different lists.

Post reply on HN