PirateTrain Radio

From NYC Resistor Wiki
Jump to: navigation, search


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.


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 (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


	RedirectMatch .*


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, "");
	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";