PirateTrain Radio
Introduction[edit]
Pirate Train is a wifi based underground radio station intended for use underground. Listeners use their wifi enabled device (like an iPhone) to connect to a special SSID. Opening any page in the web browser then redirects to a live streaming radio station.
Implementation[edit]
OS X[edit]
- Install NiceCast.
- Set up your streaming radio station on port 8000
- sudo vi /etc/apache2/other/redirect-all.conf (#redirect-all.conf)
- Turn on (or restart) Web Sharing
- sudo perl -MCPAN -e "install Net::DNS::Nameserver"
- vi ~/dns-server.pl (#dns-server.pl)
- sudo perl ~/dns-server.pl
- Set up a separate network location called "Radio"
- Configure Ethernet with a DNS server to 127.0.0.1 (make stuff up for the rest)
- Turn on Internet Sharing to Ethernet with SSID "Pirate Train"
- Connect to "Pirate Train" on your wifi enabled device
- Open any web page on your wifi enabled device
redirect-all.conf[edit]
RedirectMatch .* http://10.0.2.1:8000/
dns-server.pl[edit]
#!/usr/bin/perl
use Net::DNS::Nameserver;
use strict;
use warnings;
sub reply_handler {
my ($qname, $qclass, $qtype, $peerhost,$query,$conn) = @_;
my ($rcode, @ans, @auth, @add);
my($ttl,$rdata) = (3600, "10.0.2.1");
push @ans, Net::DNS::RR->new("$qname $ttl $qclass $qtype $rdata");
# mark the answer as authoritive (by setting the 'aa' flag
return ($rcode, \@ans, \@auth, \@add, { aa => 1 });
}
my $ns = Net::DNS::Nameserver->new(
LocalPort => 53,
ReplyHandler => \&reply_handler,
Verbose => 1,
) || die "couldn't create nameserver object\n";
$ns->main_loop;