Skip to content
a libc wrapper providing per-user hosts file
Branch: master
Clone or download
Piotr Figiel
Latest commit 75580b9 Jul 21, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore - Initial commit Jun 10, 2011
Makefile Fix for Ubuntu 12.04 issue with -ldl Jul 6, 2012
README
hosts.c Add missing NULL-check. Jul 21, 2015

README

hosts - wrapper for libc which provides defining host aliases in a per-user file

note:

 - if your libc does support it you may want to set HOSTALIASES instead of
   using this wrapper, see gethostbyname(3).

compilation:

$ git clone https://github.com/figiel/hosts.git
$ cd hosts
$ make

installation (example for bash):

$ mkdir ~/bin
$ cp libhostspriv.so ~/bin
$ echo 'export LD_PRELOAD=~/bin/libhostspriv.so' >> ~/.bashrc
$ logout

usage:

$ echo "127.0.0.1 new_name" >> ~/.hosts
$ nc -vz new_name 80

limitations:
 - doesn't work with suid programs for obvious reasons, that includes ping
   unfortunately.

feedback:
 - if you've found any bugs, feel free to fork & request a pull with patch

You can’t perform that action at this time.