You are not logged in.

#226 2013-11-02 09:23:26

ondoho
Member
Registered: 2013-04-30
Posts: 306

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

gaenserich wrote:
ondoho wrote:

edit: i added "google.com" to the blacklist with hostsblock-urlchecker, and now the black.list looks like this:

adwords.google.comgoogle.com
www.google.com

:-(

That is odd...I blocked google.com via hostsblock-urlcheck, too, but I can't reproduce this issue.

it has happened again.

adwords.google.comdomainnamesales.com
sports.bwin.com
bwin.com
g.doubleclick.net
mightydeals.com
da-ads.com

it seems that it only happens on the first/second entry?

Offline

#227 2013-11-02 13:39:42

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

ondoho wrote:
gaenserich wrote:
ondoho wrote:

edit: i added "google.com" to the blacklist with hostsblock-urlchecker, and now the black.list looks like this:

adwords.google.comgoogle.com
www.google.com

:-(

That is odd...I blocked google.com via hostsblock-urlcheck, too, but I can't reproduce this issue.

it has happened again.

adwords.google.comdomainnamesales.com
sports.bwin.com
bwin.com
g.doubleclick.net
mightydeals.com
da-ads.com

it seems that it only happens on the first/second entry?

I have no idea on this one. The revelent line of code for this would be in hostsblock-urlcheck's "check" function, at the line

echo "$@" >> "$blacklist"

(where the url quoted in the previous stdout line "Blocking (url)" is appended to the black.list file.) It would be highly irregular behavior if this line caused additions to black.list anywhere but at the very bottom of the file.

When you used hostsblock-urlcheck to block the specific url, what did it say? Could you copy and past what came out on the command line and then the resulting black.list file?


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#228 2013-11-02 20:06:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

ondoho wrote:
WonderWoofy wrote:

In regard to the use of dhclient in general...   I have a feeling that Network Manager might ignore the dhclient.conf though

i'm using neither networkmanager not dhclient. should i?

Nah, not if you don't want to.  That part was more directed to the thread in general, as I didn't want to have a whole new post to put that last little part.


Edit: ...and I don't want to use pppd because it seems like a real PITA, and normal non-point-to-point networking just seems much simpler.

Last edited by WonderWoofy (2013-11-02 20:07:23)

Offline

#229 2013-11-02 21:00:26

ondoho
Member
Registered: 2013-04-30
Posts: 306

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

gaenserich, the urlcheck script doesn't output anything special:

─$ sudo hostsblock-urlcheck domainnamesales.com
Verifying that the given page is blocked or unblocked
NOT BLOCKED: 'domainnamesales.com' Block? [y/N] y
Blocking domainnamesales.com
Page domain verified. Scan the whole page for other domains for (un)blocking? [y/N] y
Whole-page scan completed.

i have a little wrapper shell script for it, maybe that's what's causing it - but i really don't think so. i reinstalled the hostsblock package but both times it seems to be only the first entry. i can't reproduce it. i'm using urxvt. anyhow here's the script:

#!/bin/bash -u 
while true
do
read -p "Enter URL to be checked: " x
sudo hostsblock-urlcheck "$x"
	while true
	do
		read -p "Check some more [y/N]? " y
		case $y in
			y) break
				;;
			n|'') exit 0
				;;
			*) continue
				;;
		esac
	done
done
exit 1

@wonderwoofy:

WonderWoofy wrote:

...and I don't want to use pppd because it seems like a real PITA, and normal non-point-to-point networking just seems much simpler.

so what are the choices since i'm using mobile broadband only (3G)?

Last edited by ondoho (2013-11-02 21:17:34)

Offline

#230 2013-11-02 23:31:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

No, I'm not saying you're not stuck with pppd.  If you are using a mobile broadband connection, there is a good chance that is your only choice.  I'm just saying that I would prefer to ever have to use it. 

If I need to attach to the interwebs on my computer when I am out an about, I use my phone to make a wireless hotspot, which is basically the same as connecting to a home modem, as the phone handles whatever authorization is necessary for the connection.

In any case, this is a bit OT for this thread.

Offline

#231 2013-11-07 03:46:19

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

@ondoho: Hopefully we can get more reports of this error. Perhaps it might have something to do with my usage of sed in hostsblock-urlcheck, i.e. the syntax I use with the delete line functions (like the line sed -i "/$@/d" "$blacklist") somehow modifies other lines in the whitelist and blacklist in unintentional ways. That seems unlikely, too, but more likely than your wrapper being defective. Unless there is some sort of behavior with quotations or sed invocation that none of us are familiar with that is causing this, I have really no idea what is causing this without more data points.

As an interim work around, you could modify the respective files by hand.

I have no opinion on pppd...never used it, even when I was on dialup a million years ago (thank god). When I have to tether to a 3G/4G connection, I do what WonderWoofy does and just use my phone as a wireless hotspot...much easier. But if pppd works (ostensively) for you, don't fix what isn't broken!


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#232 2013-12-05 22:27:41

Lockheed
Member
Registered: 2010-03-16
Posts: 1,435

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Can someone paste me content od /etc/hostsblock/hosts.head ?
I accidentally deleted it.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#233 2013-12-05 22:47:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

You can't redownload the sources and see for yourself?

In any case, this file is just a backup of your /etc/hosts file and is meant to be used when hostsblock is set to modify your /etc/hosts instead of /etc/hosts.block.  It will apply whatever is in the /etc/hostsblock/hosts.head to the head of the newly made file.  Of course this is clearly explained on the hostsblock page.

Offline

#234 2013-12-06 03:05:55

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

If you used the stock hosts.head file that came packaged in hostsblock, then you can just reinstall hostsblock and pacman will replace your non-existent hosts.head file with the one it has packaged (and will provide .pacnew files for all the configuration files you still have). If you put something specific into your own hosts.head file, there is nothing we can really do to help you...it's typically not a good idea to delete any file from /etc/ without first backing said file up.


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#235 2013-12-23 22:26:36

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,761
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Awesome app: thank you. Migrated all of my machines across to hostsblock/kwakd and I am loving the white space.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#236 2013-12-23 22:36:49

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

jasonwryan wrote:

Awesome app: thank you. Migrated all of my machines across to hostsblock/kwakd and I am loving the white space.

Good to hear! Feel free to provide any other hacks or modifications you've used!


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#237 2013-12-28 09:22:36

ben-arch
Member
Registered: 2005-12-17
Posts: 69

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Stumbled on this thanks to Jason Ryan's write up.

THANK YOU !

Ben

Offline

#238 2013-12-28 15:25:13

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I read JWR's post as well, and like the others on his blog, I enjoyed it.  But I want to comment on his lack of dnsmasq use.  Initially I set that up so that the gigantic list would be loaded into RAM and thus be a bit faster.  But what I really think the true advantage to using dnsmasq has been for me, is the fact that it allows me to use a file other than /etc/hosts and therefore turn the blocking on and off at will.

There probably is a slight speed increase by having the list loaded by dnsmasq, but like JWR, I honestly don't think that it makes enough of a difference to really do it for the speed alone on a personal machine.  But if you want to learn a bit about dnsmasq, or have the ability to turn the blocking on and off, then it is a great thing to have set up.

Offline

#239 2013-12-30 17:02:16

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Thanks for letting me know about JWR...his blog's added to my feedly list now. It's kinda crazy to see your own name mentioned by someoe other than yourself. cool

On ArchLinux, I haven't been able to tell the difference either. I run hostsblock on my server (which acts as a proxy) without dnsmasq and on my laptop with dnsmasq. The only time I have noticed a significant difference was when I tried to run hostsblock on my wife's MacBook, where the default built-in dns handler quickly eats up so much memory when subjected to a huge /etc/hosts file that it almost instantly swaps out and becomes usable. From those experiences, I decided to play it safe and use dnsmasq where I can spare the RAM.


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#240 2014-01-05 15:30:26

xanb
Member
Registered: 2012-07-24
Posts: 383

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I don't get the verbose output appeared in screenshots. And hostsblock --help does not help.

Thanks,
Xan.


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#241 2014-01-06 23:53:22

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

xanb wrote:

I don't get the verbose output appeared in screenshots. And hostsblock --help does not help.

Thanks,
Xan.

Check out the rc.conf file under "/etc/hostsblock/rc.conf", which has more documentation. Moreover, in rc.conf is the default parameter 'logfile="/var/log/hostsblock.log"', which redirects the verbose output of hostsblock to the stated file. If you change it to 'logfile="0"', it should display the verbose output to stdout.


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#242 2014-01-07 13:37:44

xanb
Member
Registered: 2012-07-24
Posts: 383

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Mmm. Thanks. But it's possible to have *both* enabled? I see the logs but occasionally I run manually.


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#243 2014-01-08 16:58:15

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

xanb wrote:

Mmm. Thanks. But it's possible to have *both* enabled? I see the logs but occasionally I run manually.

If you use tee(1) with the output to stdout option, you can manually do both, or run "tail -f" on your logfile whenever you manually run hostsblock. For instance, when I debug hostsblock, I often use the following command line sequence:

hostsblock & tail -f /var/log/hostsblock.log

Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#244 2014-01-12 03:27:18

notyourbuddy
Member
Registered: 2012-12-30
Posts: 8

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Recently stumbled upon this thread after migrating to UZBL and needing an adblock solution.

Was a cinch to setup, easily customizable, and if there is a performance hit I'm having a hard time perceiving it.

Nice work!!!


"A problem well stated is a problem half solved." - Charles Franklin Kettering

Offline

#245 2014-01-12 15:28:09

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

notyourbuddy wrote:

Recently stumbled upon this thread after migrating to UZBL and needing an adblock solution.

Was a cinch to setup, easily customizable, and if there is a performance hit I'm having a hard time perceiving it.

Nice work!!!

I'm glad you find it useful! Do note that it is not a perfect solution. Unlike Adblock* it can't catch the text ads in Gmail, for instance, since those adds come from the same domain as Gmail itself (and thus blocking them would block Gmail as well!). Perhaps with the new NPTables coming into the kernel, there could be a way to make use the same sort of regex parsing that Adblock uses to be able to create permit the same sort of flexibility at an OS-wide level (swoon!). In the meanwhile, though, please do keep using hostsblock and let us know about any bugs or patches you might have.


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#246 2014-02-03 10:12:56

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 451

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

Great script, I'm just surprised that none ever tried to use an alternative logfile path (or logging to stdout). The script just sets some defaults, redirects the output into default logfile path and THEN loads the config file...

Offline

#247 2014-02-04 11:31:13

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

lahwaacz wrote:

Great script, I'm just surprised that none ever tried to use an alternative logfile path (or logging to stdout). The script just sets some defaults, redirects the output into default logfile path and THEN loads the config file...

This is somewhat by design, albeit I'm not sure I appreciate the logic behind it anymore. At one point I might have had issues with how the config file was formatted and sourced and wanted to make sure errors from that sourcing got dumped to where I wanted them. I'll put a re-ordering of these events in my TODO (which I hope someday I will get to), or feel free to submit a patch here or via github.


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#248 2014-02-04 20:52:26

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 451

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

gaenserich wrote:
lahwaacz wrote:

Great script, I'm just surprised that none ever tried to use an alternative logfile path (or logging to stdout). The script just sets some defaults, redirects the output into default logfile path and THEN loads the config file...

This is somewhat by design, albeit I'm not sure I appreciate the logic behind it anymore. At one point I might have had issues with how the config file was formatted and sourced and wanted to make sure errors from that sourcing got dumped to where I wanted them. I'll put a re-ordering of these events in my TODO (which I hope someday I will get to), or feel free to submit a patch here or via github.

I might submit a patch after my exams, hopefully next week... The point is that with systemd it's quite common to have logging into stdout and let journald manage the output, so the script might be a little simpler.

Offline

#249 2014-02-05 11:14:31

gaenserich
Member
From: Pennsylvania
Registered: 2010-06-07
Posts: 115
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

lahwaacz wrote:
gaenserich wrote:
lahwaacz wrote:

Great script, I'm just surprised that none ever tried to use an alternative logfile path (or logging to stdout). The script just sets some defaults, redirects the output into default logfile path and THEN loads the config file...

This is somewhat by design, albeit I'm not sure I appreciate the logic behind it anymore. At one point I might have had issues with how the config file was formatted and sourced and wanted to make sure errors from that sourcing got dumped to where I wanted them. I'll put a re-ordering of these events in my TODO (which I hope someday I will get to), or feel free to submit a patch here or via github.

I might submit a patch after my exams, hopefully next week... The point is that with systemd it's quite common to have logging into stdout and let journald manage the output, so the script might be a little simpler.

Good! I've been meaning to get around to including my systemd service file for hostsblock for some time, two, but haven't yet.


Check out hostsblock for system-wide ad- and malware-blocking.

Offline

#250 2014-02-16 19:40:38

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,471
Website

Re: hostsblock: cli utility/cronscript to automate hostsfile adblocking

I am pretty sure that this has been asked before, but at the moment my searching skills are not good enough to come up with any results. I was wondering what the differences are between hostsblock and hosts-update? I'm very unfamiliar with all this stuff so please bear with me here. The way I see it, hostsblock has the same functionality as hosts-update but a little more to it, such as the hostsblock-urlcheck script.

Am I right in assuming this?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB