Fork me on GitHub

Detours Clone by jmhobbs

Detours Clone is a super fast way to edit your hosts file.

Credit Where Credit Is Due

Detours Clone is a clone of Detours App by Jerod Santo - Jerod Santo. Except it's not Mac specific because it leverages the hosts file instead of OS API's.

If you are on a Mac, I'd use the real thing. If you are on Linux, you might give this a shot.

How It Works

Essentially it maintains a chunk of your hosts file (think /etc/hosts) in a parseable fashion and gives you access to easily change it from a client app.

This app involves a client and a server, since on Linux the hosts file is protected we have to run our daemon with a privileged user. The client and server communicate via TCP sockets with JSON.

Currently there are three Python clients. One is an HTTP server, one is GTK, and one is Qt4. You can write a client in any language as long as it can talk on TCP sockets and has a JSON implementation.

Heck, if you are clever you can talk right to it:

jmhobbs@asuka:~$ telnet 127.0.0.1 8552
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
{"method":"list"}
{"pairs": [{"ip": "127.0.0.1", "host": "google.com"}, {"ip": "127.0.0.1", "host": "gmail.com"}], "response": "list"}Connection closed by foreign host.
jmhobbs@asuka:~$ 

Screen Shots

The Qt4 Client
Qt4 Client

The GTK+ Client
GTK+ Client (In KDE)

The HTTP Client
HTTP Client (In Chrome)

Dependencies

Python is required for the server. Also, the python-daemon module is required (for now).

Install

$ git clone git://github.com/jmhobbs/detours-clone
$ cd detours-clone
$ python setup.py install

License

MIT

Copyright (c) 2010 John Hobbs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Authors

John Hobbs (john@velvetcache.org)

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/jmhobbs/detours-clone