/hosts

a libc wrapper providing per-user hosts file

Primary LanguageC

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