Hack 80. Redirect Brought to you by Bonjour Ads

Spam your fellow Bonjour users with sponsored links.

"Advertise Bonjour Services in Linux" [Hack #78] shows how simple it is to advertise arbitrary services using Bonjour. This makes it easy to provide easy reference links to every user on your wireless network.

You may use this hack only for the forces of Good.

Wouldn't it be nice to give those users a public service announcement en route to their destination, to let them know who was kind enough to provide the link? You could even give them more information about yourself or the network you provide before they head out to the Internet. This is easily achieved with a simple application of Apache magic.

In the httpd.conf on your web server, create a new VirtualHost entry like this:

		 ServerName adserver.local
		 DocumentRoot /home/example/ads/

You can, of course, call the server anything you want and put the DocumentRoot wherever is convenient. Restart your Apache for the change to take effect. Just be sure that the ServerName ends in .local.

Now create as many HTML files in DocumentRoot as you like, using this as a template:


This Bonjour link brought to you by: me!

Redirecting you automatically in five seconds…


The URL at the end of the Refresh line will be the users' final destination, and the number at the beginning specifies the number of seconds to wait before redirecting. The body of the HTML can contain whatever message you want the users to see before the redirect takes effect.

Finally, advertise adserver.local (or whatever you used in your VirtualHost enTRy) as a proxy service using one of the methods described in "Advertise Bonjour Services in Linux" [Hack #78] or "Advertise Any Service with Bonjour in Mac OSX" [Hack #79]. In the text field of the Bonjour advertisement, specify the HTML file you just created. This example saves the HTML code to /home/example/ads/freenetworks.html and specifies path=/freenetworks.html as the text field.

Now, users who share my wireless network see a Bonjour advertisement called FreeNetworks and are presented with the previous HTML when they browse to the site. Five seconds later, they are redirected automatically to the real http://freenetworks.org and are left to go about their merry way. This sort of service is ideal for permanent services on public access wireless nodes, to give users an idea of who is providing Internet access.

Bluetooth, Mobile Phones, and GPS

Network Discovery and Monitoring

Wireless Security

Hardware Hacks

Software Hacks

Do-It-Yourself Antennas

Wireless Network Design

Appendix A. Wireless Standards

Appendix B. Wireless Hardware Guide

Wireless Hacks
Wireless Hacks: Tips & Tools for Building, Extending, and Securing Your Network
ISBN: 0596101449
EAN: 2147483647
Year: 2004
Pages: 178

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net