PirateTrain Radio

From NYC Resistor Wiki

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]

  1. Install NiceCast.
  2. Set up your streaming radio station on port 8000
  3. sudo vi /etc/apache2/other/redirect-all.conf (#redirect-all.conf)
  4. Turn on (or restart) Web Sharing
  5. sudo perl -MCPAN -e "install Net::DNS::Nameserver"
  6. vi ~/dns-server.pl (#dns-server.pl)
  7. sudo perl ~/dns-server.pl
  8. Set up a separate network location called "Radio"
  9. Configure Ethernet with a DNS server to 127.0.0.1 (make stuff up for the rest)
  10. Turn on Internet Sharing to Ethernet with SSID "Pirate Train"
  11. Connect to "Pirate Train" on your wifi enabled device
  12. 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;