Package Details: hostsblock 0.999.3-1

Git Clone URL: https://aur.archlinux.org/hostsblock.git (read-only)
Package Base: hostsblock
Description: A script and cronjob that downloads, sorts, and installs multiple ad- and malware-blocking hosts files.
Upstream URL: http://gaenserich.github.com/hostsblock/
Licenses: GPL
Submitter: jav209
Maintainer: jav209
Last Packager: jav209
Votes: 43
Popularity: 0.211603
First Submitted: 2012-05-03 23:18
Last Updated: 2015-10-30 13:12

Dependencies (11)

Required by (0)

Sources (9)

  • black.list
  • hosts.head
  • hostsblock-common.sh
  • hostsblock-urlcheck.sh
  • hostsblock.conf
  • hostsblock.service
  • hostsblock.sh
  • hostsblock.timer
  • white.list

Latest Comments

rpodgorny commented on 2016-04-20 17:38

soooo, here it is:

https://aur.archlinux.org/packages/hostsblock-git

comments welcome!

rumpelsepp commented on 2015-12-29 09:16

Please add the manpages to the package: https://github.com/gaenserich/hostsblock/tree/master/man

FLHerne commented on 2015-12-21 16:38

No, 'which' is in base-devel.
https://wiki.archlinux.org/index.php/Arch_User_Repository#Prerequisites

mkoskar commented on 2015-12-02 15:30

This should get "which" added into depends=(...).

jav209 commented on 2015-10-30 13:13

See https://github.com/gaenserich/hostsblock/commits/master for a complete list of updates

Version 0.999.3 (Alpha 3) (30.10.2015)
*Added more optional source files to hostsblock.conf. Added user agent info to curl to make work with more sites. Sanitized hostsblock.conf file a little bit.
*Added function to force target file update even if no changes are found to source files
*Fixed incorrect invocation of _strip_entries subroutine
*Fixed remaining appearances of gzip -z. (Thanks to Julián Landerreche)
*Fixed misspelled whitelist/whilelist variable
*Fixed incorrect use of -z with gzip/pigz
*Fixed line 261 in hostsblock-common.sh (white list write function)

mareex commented on 2015-10-17 09:33

Does anyone else experience that ntpd goes crazy in cpu usage, when hostsblock is applied?

jav209 commented on 2015-05-19 13:20

@rpodgorny Thanks. Do feel free to make a git version. I'll probably work a bit more on optimizing the packaging leading up to 1.0 stable.

rpodgorny commented on 2015-05-19 12:59

ah, ok. i suggest adding some git tags, then, and linking to gzipped file in pkgbuild. also, having a hostsblock-git pkgbuild would be nice. if you're not going to create one, i'll take care of that.

thanks for the hostsblock!

jav209 commented on 2015-05-19 12:55

@rpodgorny I'm quite sure (I'm the original author). I'm in the process of getting rid of the homepage and just using the github page instead.

rpodgorny commented on 2015-05-17 23:55

are you sure the version is correct? the home page lists 0.12.3 as the latest.

jav209 commented on 2015-05-10 13:36

@setone: Novel uses of hostsblock keep coming out of the woodwork, which makes me think it would just be better to strip out the automatic detection features for the dnscachers and dhcp clients all together and just document the most common setups (and contributed less common setups).

setone commented on 2015-05-09 21:10

Incidentally, let me add: thanks again for your excellent work... much appreciated.

setone commented on 2015-05-09 21:01

I just got around to installing this update. For various reasons I run dnsmasq on a different box than the hostsblock box, so hostsblock should not assume that it is working with dnsmasq. However I also require my hostsfile NOT to be /etc/hosts, and this causes hostsblock to fail, because the hostsblock-common.sh script hard-associates dnscacher="none" with hostsfile="/etc/hosts", i.e. you can't have one without the other. This seems unnecessary - I have dns somewhere else and I don't need/want hostsblock to know or care about it, and I have my hostsfile somewhere else too, because I need it that way. Why shouldn't the dnscacher="none" option just quietly tell hostsblock: "there is nothing for you to restart, so don't do anything." My workarounds are (1) change the script (easy but a PITA to maintain), or (2) configure dnscache="manual", which causes hostsblock to try to restart "manual".

jav209 commented on 2015-04-26 01:27

Here's Alpha 2, with a couple more tidbits:
* sanitized permissions (world readable)
* service and timer files for systemd
* Fixed misidentification of certain non-interactive sessions

csllbr commented on 2015-04-25 05:04

sorry, my mistake - I intended to vote but clicked on the wrong link

jav209 commented on 2015-04-24 22:34

@csllbr: Any reason for marking this as our of date?

@madalu: service and timer files forthcoming. I'll update the file permissions once I double check what the best practices are with executables that should only be handled by root.

madalu commented on 2015-04-24 14:49

Also, is there a reason for the very restrictive permissions on the script?

$ cd usr/bin
$ ls -al hostsblock

-rwx------ 1 root root 8733 Apr 24 09:06 hostsblock

This prevents the hostsblock script from being found by normal users with commands like which.

On my machine there is not a single other binary in /usr/bin that has such permissions.

madalu commented on 2015-04-24 14:33

Finally, is there a reason for the very restrictive permissions on the script?

$ cd usr/bin
$ ls -al hostsblock

-rwx------ 1 root root 8733 Apr 24 09:06 hostsblock

This prevents the hostsblock script from being found by normal users with commands like which.

On my machine there is not a single other binary in /usr/bin that has such permissions.

man hostsblock also does not work as a normal user

madalu commented on 2015-04-24 14:32

Finally, is there a reason for the very restrictive permissions on the script?

$ cd usr/bin
$ ls -al hostsblock

-rwx------ 1 root root 8733 Apr 24 09:06 hostsblock

This prevents the hostsblock script from being found by normal users with commands like which.

On my machine there is not a single other binary in /usr/bin that has such permissions.

madalu commented on 2015-04-24 14:29

Also there seems to be a regression in a couple of the urls in hostsblock.conf.
For instance, the old rc.conf had the url:

http://hosts-file.net/ad_servers.txt

The new hostsblock.conf has the url:

http://hosts-file.net/ad_servers.asp

In a regular browser, this redirects to http://hosts-file.net/ad_servers.txt.

But with the hostsblock script it simply downloads the following html:

<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="ad_servers.txt">here</a>.</body>

madalu commented on 2015-04-24 14:14

Thanks for the update. The new PKGBUILD does not download or install service files. Might I ask for the reason for their exclusion in this version? (I had been relying on them for automated updates.)

jav209 commented on 2015-04-24 01:13

WARNING: 0.999.1 is ALPHA quality yet, so use with caution.

When installing, note that rc.conf is no longer used. Instead use /etc/hostsblock/hostsblock.conf.

As ALPHA-quality software, this version does not have documentation yet. Volunteers are welcome to help in creating the hostsblock.8, hostsblock.conf.8, and hostsblock-urlcheck.8 man files. To do so, go here: https://github.com/gaenserich/hostsblock

That said, this should be a significant improvement over the stable version by most performance metrics. Please do submit bug reports here https://github.com/gaenserich/hostsblock/issues.

Alad commented on 2015-02-25 02:22

Oops, forgot to enable notifications. Thanks for the updates; I'll soon check how it works now.

setone commented on 2015-01-15 05:21

@jav209: glad you're back.

jav209 commented on 2015-01-10 19:16

oh, and @Alad: volunteers for maintainership gladly accepted!

jav209 commented on 2015-01-10 19:15

Version 0.12.4 (10.01.2015)
*rc.conf: moved hphost entries to the optional section of the $blocklist list
*rc.conf: fixed certain urls, removed dead ones
*hostsblock: removed download/preparation exit code. Will not complete even if not all blocklists are downloaded and extracted successfully
*added hostsblock.service and hostsblock.timer files for use with systemd

jav209 commented on 2015-01-10 19:08

Hi all. Back from the dead!
@Alad:
-I moved the hphosts entries, save for the adblock-only list, to the commented-out optional area. Do note that you can always use hostblock-urlcheck to lift any blocks, e.g. hostblock-urlcheck "pastie.org" will (1) check to first see that pastie.org is blocked or unblocked (and offer you the choice of unblocking or blocking it) and then (2) scan the specified page for any other urls that may or may not be blocked.
-Could you explain how /dev/shm "doesn't work"? I haven't personally witnessed any issue with this directory. If may also change the tmpdir parameter in the rc.conf file if you dislike the use of /dev/shm, but as it stands, I don't know of any particular reason for not using it.
-Could you provide any standard out or error for the default settings issue? Prima facie I don't see anything wrong in the script as it exists that would be fixed by your patch.

@vinsonchuong
-Thanks for the info. I switched the suffixes.

@vwyodajl
-I haven't been as actively tracking changes to AUR standards and the like, but at the moment, I'm not sure of the standards you speak of. At present, I just re-makepkg'd what I have, but haven't noticed any issues.
-What's wrong with rc.conf? (although, in the upcoming pre-alpha version, rc.conf turns into hostsblock.conf, but just because that hostsblock won't be backwards compatible with the current version)

@setone
-I took out the code that gives up when it encounters an error. hostsblock will now carry on when confronted with a download or extraction error.
-Thanks for the complement. I feel bad lately for not getting back to this in a while (I've been busy balancing dissertation, job, child.)

Alad commented on 2015-01-08 13:47

Another thing. This should NOT include hphosts by default, as it blocks common websites - like the below pastie.org. And you're stuck with it if you didn't remove it beforehand.

This needs a new maintainer.

Alad commented on 2015-01-08 13:43

Also, /dev/shm doesn't work. Should be /tmp.

Alad commented on 2015-01-08 13:37

Had to remove the "Default settings" section in /usr/bin/hostsblock to have this do anything at all.

http://pastie.org/9820107

Patch:

http://pastie.org/pastes/9820111/text

vinsonchuong commented on 2014-12-20 04:14

The URLs `hosts-file.net/ad_servers.asp` and `hosts-file.net/hphosts-partial.asp` have changed from ending in `.asp` to ending in `.txt`.

vwyodajl commented on 2014-12-11 18:15

Can you please fix this to current standards. Installing as is fails to produce a usable tool. And rc.conf still?

setone commented on 2014-09-14 06:32

Hi, I noticed that even though I've set a cron job to update hostsblock once a week, the actual hosts.block file has not been updated since the end of July. Stepping through the script showed that the ismeh.com domain does not seem to be up and running any more, and as a result the hostsblock script stops processing, i.e. fails out on the spot. So whatever files might have been updated after that one in the list do not get updated, and the hosts.block file does not get updated either.

So I commented out http://www.ismeh.com/HOSTS in my hosts.rc file and now everything updates completely.

Wouldn't it make sense to continue processing the list of files even though a domain (such as ismeh.com) can't be resolved?

BTW - I love this thing.

jav209 commented on 2014-04-17 12:20

@ilpianista:
I use the following guide:
https://wiki.archlinux.org/index.php/Systemd/cron_functionality

And then use the following service file (call it hostsblock.service):
----------------------------------------
[Unit]
Description=Block bad hosts
Requires=network.target
After=network.target
ConditionACPower=true

[Service]
Type=oneshot
ExecStart=/usr/bin/hostsblock

[Install]
WantedBy=timer-daily.target
---------------------------------

And then systemctl --system daemon-reload and systemctl enable hostsblock.service (i.e. the above file)

I need to set aside a little time soon to roll in some code clean-ups and updates, such as this one, sometime soon, so stay tuned!

ilpianista commented on 2014-04-17 10:29

Hi, could you add systemd timers?

jav209 commented on 2013-06-03 21:34

Version 0.12.3 (03.06.2013)
*hostblock-urlcheck: issue with colored prompt on white-backgrounded terminals fixed

jav209 commented on 2013-06-02 15:34

Version 0.12.2 (02.06.2013)
*whitelist, blacklist not applying fixed

jav209 commented on 2013-06-01 01:43

Version 0.12.1 (31.05.2013)
*quick fix of previous change.

jav209 commented on 2013-05-31 20:24

Version 0.12 (31.05.2013)
*changed order of processing of black and while lists.

Version 0.11.3 (31.05.2013)
*changed installation path according to new Arch Linux practices.

WonderWoofy commented on 2013-05-31 14:41

I left a comment in the forum thread as well. But the PKGBUILD needs to be changed so that the scripts are put into /usr/bin as the move is near! If any of you users want to do this, it is as easy as editing the PKGBUILD and changing sbin to bin. Or for this particular package you can do:

$ sed -i 's|sbin|bin|g' /path/to/PKGBUILD

jav209 commented on 2012-12-09 18:44

Version 0.11.2 (09.12.2012)
*swapped out use of md5sums for ls mod times to improve performance

Ideas for further development:
*Make use of GNU Parallel to speed up download times and processing, possibly at the risk of a perl dependency.
*Autodetect archiving utils in order to compress archived hosts file.

jav209 commented on 2012-09-13 15:24

Version 0.11.1 (13.09.2012)
*accumulated fixes with feedback (thanks tlvince)
*fixed hostsblock-urlcheck's misidentification of colons in urls

jav209 commented on 2012-08-30 19:41

New homepage: http://gaenserich.github.com/hostsblock/

jav209 commented on 2012-08-26 13:30

Now available via github: https://github.com/gaenserich/hostsblock

jav209 commented on 2012-08-19 01:37

Version 0.11 (18.08.2012)
*fixed typo in hostsblock-urlcheck
*added integrated logging
*removed gzipping of target hostsfile backup, removed gzip as
dependency.
*added extended timeout to downloading procedure, provided for
script exit in the event of failed download
*tweaked the format of dates and times in log output

jav209 commented on 2012-08-14 23:41

New webpage: http://www.personal.psu.edu/jav209/scripting.html

jav209 commented on 2012-08-14 03:41

Version 0.10.6 (13.08.2012)
*spruced up default blocklists entries in rc.conf.
*fixed small issue in hostsblock-urlcheck.

jav209 commented on 2012-08-13 14:28

Version 0.10.5 (12.08.2012)
*updated rc.conf, removing redundant blocklists.
*fixed a few issues with hostsblock-urllist. Should now
register more domains and filter out any garbage.

jav209 commented on 2012-08-11 14:17

Version 0.10.4 (11.08.2012)
*removed optimization code. Caused significant performance
penalties
*fixed old issue with hostsblock-url
*replaced a few sed invocations with tr for slight
performance increase

jav209 commented on 2012-08-10 15:43

Version 0.10.3 (10.08.2012)
*fixed white.list issue

jav209 commented on 2012-08-09 23:55

Version 0.10.2 (09.08.2012)
*fixed issue with 0.0.0.0 address not working
*cleaned up logging output

Known issues:
*when calculating number of entries at end, mistakes hosts.head
domains as redirect addresses

jav209 commented on 2012-08-09 22:50

Version 0.10.1 (09.08.2012)
*fixed issues with optimization pass, integrated it into main
processing pass
*fixed issue with 32-bit machines and touch

jav209 commented on 2012-08-08 22:20

Version 0.10 (08.08.2012)
*implemented an optimization option, which shrinks target hostfile
size by putting all entries redirecting to the same address
on the same line.
*instead of processing all files in the cache, hostsblock now only
processes those listed (and not commented out) in rc.conf
*updated documentation in rc.conf
*added another blocklist
*simplified really long pgl.yoyo.com blocklisturl

jav209 commented on 2012-08-06 15:22

Version 0.9.2 (06.08.2012)
*added "FAIL" notifications
*fixed issue with blacklist
*fixed issue with 7z files
*fixed documentation in rc.conf on mirrored, defunct blocklists

jav209 commented on 2012-08-05 17:31

Version 0.9.1 (05.08.2012)
*removed color interface output options (better for logging).
*made output cleaner for logging. Enter a >>/var/log/[your logfile]
after your crontab entry for it to enable logging.
*improved behavior: only downloads new blocklists if they have been
changed on the server. Saves bandwidth.
*rc.conf in-text documentation updated accordingly.
*removed antequated warning from install file.

jav209 commented on 2012-08-05 03:39

Version 0.9 (04.08.2012)
*cleaned up minor gliches when running under OS X
*cleaned up non-color output
*now exits if not run as root
*new behavior: only writes to target hostsfile if changes detected
*new option: allow/disallow dns redirections

jav209 commented on 2012-07-24 19:10

Version 0.8.4 (24.07.2012)
*minor code tweeks to hostsblock-urlcheck
*colorized and more compact prompts for hostsblock-urlcheck

jav209 commented on 2012-07-24 03:13

Version 0.8.3 (23.07.2012)
*fixed hostsblock-urlcheck to check for both http and https domains.
*simplified hostsblock-urlcheck usage. See "hostsblock-urlcheck --help"
for details.

jav209 commented on 2012-07-22 03:37

Version 0.8.2 (21.07.2012)
*added "--compressed" option to curl commands to allow for compressed
blocklist downloads (thanks ontobelli)
*removed the modyouri blocklist from defaults since it included
redirection and "junk" entries (noted in rc.conf comments)
IT IS HIGHLY SUGGESTED THAT YOU REMOVE THE MODYOURI ENTRY FROM RC.CONF.

jav209 commented on 2012-06-16 00:16

Version 0.8.1 (15.06.2012)
*changed hostsblock-urlcheck to also check given urls as to whether they are
blocked or not (via "page" option). This is in addition to the whole page
scan option ("scan"), which reads through the whole given page to see if
contained subdomains are blocked or not.
*regular behavior of hostsblock-urlcheck now relegated to "scan" option. See
'hostsblock-urlcheck help' for details.

jav209 commented on 2012-06-14 20:55

Verson 0.8 (14.06.2012)
*made postprocessing routine (such as dnsmasq restart) more flexible for those
who might want to use a different program. PLEASE CHECK RC.CONF.
*minor fixes with variable quoting, console output, code formatting
*added run-time dependency checks
*updated documentation in rc.conf
*added additional entry to whitelists
*fixed error with whitelist not taking periods literally

TODO
*revamp unzip command to function under other *nix implementations

jav209 commented on 2012-06-04 19:56

Version 0.7.2 (04.06.2012)
*Fixed error in hostsblock-urlcheck that cased full-stop error

TODO
*revamp unzip command to function under other *nix implementations

jav209 commented on 2012-06-03 20:34

Version 0.7.1 (03.06.2012)
*Made changes from hostsblock-urlcheck apply more quickly without running hostblock
*Made hosts.head file optional, and adjusted default rc.conf accordingly.

TODO
*revamp unzip command to function under other *nix implementations

jav209 commented on 2012-06-01 19:35

Version 0.7 (01.06.2012)
*Added hostsblock-urlcheck, which checks a given url for contained subdomains and allows the user to white or blacklist them selectively
*Fixed minor typo

TODO
*revamp unzip command to function under other *nix implementations

jav209 commented on 2012-06-01 19:30

Version 0.7 (01.06.2012)
*Added hostsblock-urlcheck, which checks a given url for contained subdomains and allows the user to white or blacklist them selectively
*Fixed minor typo

TODO
*revamp unzip command to function under other *nix implementations

jav209 commented on 2012-05-22 23:59

Version 0.6 (22.05.2012)
*Fixed white space issues in white list entries
*Fixed errors from stat_* functions when not running on ArchLinux
*Configuration file moved to /etc/hostsblock directory as rc.conf
*New configuration files hosts.head, black.list, and white.list
*hosts.head: contains user-defined entries that go to the top of resultant output file
*removed original file recycling. If you want to carry over entries from previous output file, include in hosts.head

TODO
*add command-line tool to interactively examine a given site, provide a list of domains involved in that site (and whether they are blocked or not), and add entries to the blacklist and whitelist accordingly.
*revamp unzip command to function under other *nix implementations

jav209 commented on 2012-05-21 13:37

Revised TODO:
*preserve entries from previous or given master file
*split off whitelist and blacklist arrays into separate config files. (will resolve spaces in sed issue)
*fix errors from stat_* functions when not running on ArchLinux
*revamp unzip command to function under other *nix implementations
*add command-line tool to interactively examine a given site, provide a list of domains involved in that site (and whether they are blocked or not), and add entries to the blacklist and whitelist accordingly.

jav209 commented on 2012-05-13 16:37

Version 0.5 (13.04.2012)
*Added color via /etc/rc.d/functions (see "USECOLOR" in config file to disable)
*Removed notifications from trivially short and redundant steps
*Changed default blockhosts to non-zip version of the file
*Removed pixelserv check. Use kwakd instead.

jav209 commented on 2012-05-10 12:51

More TODO:
Add color via /etc/rc.d/functions

jav209 commented on 2012-05-09 17:38

Version 0.4 (09.04.2012)
*Post-extraction scan now recursively searches extracted file tree for potential entries
*Added 7z blocklist functionality
*Moved unzip (with p7zip) to optdep
*Added check for unzip and 7za to decompression routines
*Added new entries from rlwpx.free.fr (requires p7zip)
*Now gzips backup hosts file to save space (added gzip as dependency)

TODO
*add command-line tool to interactively examine a given site, provide a list of domains involved in that site (and whether they are blocked or not), and add entries to the blacklist and whitelist accordingly.
*fix issue with whitespaces in whitelist entries (disappears in temporary .sed file)

jav209 commented on 2012-05-06 16:49

Version 0.3 (06.04.2012)
*improved performance by changing whitelist for-loop with an sed-file in the main processing routine
*added automatic backing up of original target hosts file
*added install-time warning to backup /etc/hosts file
*changed install spot to /usr/sbin instead of /usr/bin (requires root to run anyway)
*fixed typo in default variables (blacklists to blocklists)
*added changelog
*updated conf file with whitelist entries to unblock flickr.com and ompldr.org

TODO
*add command-line tool to interactively examine a given site, provide a list of domains involved in that site (and whether they are blocked or not), and add entries to the blacklist and whitelist accordingly.
*fix issue with whitespaces in whitelist entries (disappears in temporary .sed file)

jav209 commented on 2012-05-05 16:53

Also, look under /usr/share/hostsblock/hostsblock.conf for an example config file. Existing config files might need to be modified.

jav209 commented on 2012-05-05 16:41

Update 0.2:
-Added personal blacklist functionality
-Included more info in the config file
WARNING: there has been a minor change in the config file: "blacklists" is now "blocklists".