Live data from Hacker News

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

github.com

61–70 of 97 posts

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

#61
post #22
post #9

Earlier quoted context omitted.

The goal here is to make it automatically update the hosts file once in a while

Isn’t that what cron is for?

You're right, but I like the extensibilty of Systemd. Things like running every week or whenever the next start is. Or only if the network is online.

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

#62
post #43
post #24

Earlier quoted context omitted.

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.

It won't be able to run if the user that is running it doesn't have the proper privileges. You could even protect the files by giving them other permissions so only the root user can use them.

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

#63
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.

Not exactly Godwin’s law, but pretty close. Comparing advertising and marketing to the ownership of human beings? Slavery infringed on the inalienable of human beings, the existence of advertising doesn’t take away my freedom or potentially subject me to beatings.

It’s a ridiculous comparison. I am not a friend to intrusive ad-tech, but making a moral equivalence to slavery is to trivialize slavery. It’s like comparing parking tickets to the death penalty.

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

#64

Earlier quoted context omitted.

I assume you wrote a hello world once or twice, what was the point of that?

Who posts their hello world on HN? My question was a valid one given the circumstances.

People posts simple projects, learning projects, projects that are inadvertently a dupe of some other project, projects that are deliberately patterned after existing projects, etc, etc, etc all the time.

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

#65
post #57

Earlier quoted context omitted.

To be completely fair with you, I didn't know this was out there. Then again, I think my solution is more elegant, especially if all the todo's are finished.

Patching a critical system file with python on a regular basis... What could go wrong?

I mean, if you don't trust the sources, you can use your own. Or if you don't trust the software, don't use it. It's up to the end user to decide what is in their best interest. I believe the included lists are trustworthy and I use them myself.

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

#67
post #57

Earlier quoted context omitted.

To be completely fair with you, I didn't know this was out there. Then again, I think my solution is more elegant, especially if all the todo's are finished.

Patching a critical system file with python on a regular basis... What could go wrong?

I don't understand the aversion to python here. What is it about python that makes it less reliable than any other piece of software?

Yes, downloading hosts files from 3rd-party sites is kind of sketchy. But using python to do it is what you're worried about?

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

#68
post #62
post #43

Earlier quoted context omitted.

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.

It won't be able to run if the user that is running it doesn't have the proper privileges. You could even protect the files by giving them other permissions so only the root user can use them.

Above you mentioned setting this up as a scheduled job. In this case the job would need to run as root (or you'd need to assign the appropriate permissions in the sudoers file, but people are lazy). If a non-root user had write privileges to the file, they could modify the script and thereby gain root code execution.

Naturally it's on the user to properly configure the permissions.

I'm not saying this isn't a worthy project, I'm just adding to the discussion on why people should be cautious when running scripts with root permissions.

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

#69
post #53
post #47

Earlier quoted context omitted.

Just using cron is back compatible

Things you get with systemd that you don't get with cron unless you implement them in the script. * Not running if the network is down. * Not running if the download path isn't available. * Running if the machine was off during the scheduled time. * Monitoring and retry logic. * Logging to syslog. * Resource constraints. * Random wait. It ends up being a lot of code factored out of the actual application.

so instead of code in one place you have it in 2?

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

#70
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.

Ads have gotten to a point where they hamper user experience. My problem with most of the ads is the amount of js tracking junk and 3rd party A/B calls that grinds the browser to a halt.

Do you mind FB ads which are pretty smooth experiences?
Post reply on HN