Ghosting | Building A PirateBox

PirateBox is a DIY anonymous offline file-sharing and communications system built with free software and inexpensive off-the-shelf hardware.

I have been wanting to try to build one of these for MFADT students to use and experiment with in our communal working space at Parsons. More and more I have wanted to explore a free and private space for conversation, concerns, and sharing projects and created media. I hope that this will serve as a solid foundation for students to connect, but also as a creative sandbox for hosting web, game, media and Internet of Things projects.

screen-shot-2016-11-18-at-6-51-41-pm

Depending on the underlying software and difficulty of development on the platform, I would also like to explore additional user interfaces, connection methods, and creative applications of using this system, both in a fixed location and mobile applications. There are also precedents for connecting the boxes together, so a future extension could be to install them around campus for use by all students, or with similar creative coding programs around NYC.

Building a Raspberry Pi PirateBox

imag0046

Luckily, The Pirate Box project has included extensive instructions for building both a Wireless Router based (who knew you could custom program routers to host things???) and a Raspberry Pi (2A, 2B, 3 etc.) version.

Thanks to a generous donation of a Raspberry Pi 3 from my program and some of my own tools, I’m ready to get started.

Here is the official material list, with links to the items from the PirateBox website. I’ve made some notes as to different options given the Raspberry Pi 3.

Materials Needed

1. Raspberry Pi, several different models.

You can also opt to get a kit which will include the micro SD Card, 5V USB Power Supply, HDMI cable to hook up to TV or monitor for initial setup, case to protect it initially, and hopefully a micro SD adapter. I’m using the Canakit Raspberry Pi 3 Complete Starter KitCanakit Raspberry Pi 3 Complete Starter Kit except the SD card was missing from the box at school so I instead have a Kingston 8GB Micro SD Card that was on hand.

2. SD Card, Class 10 SDHC 8GB Card (Amazon) – See above note

3. USB Wi-Fi Adapter (compatible devices) – Not Necessary for RPI 3, has built in wifi, but can still get it for range.

4. 5V micro USB power supply (Amazon)

5. USB Flash Drive (single partition, FAT32 formatted) The Kingston DT 16GB works well (Amazon)(Newegg) – Using my own Flash Drive as well for this, didn’t come with kit

6. Ethernet cable (Amazon)

7. Computer with ethernet port – I am completing this project on a Macbook Pro 2015 running OSX Capitan, version 10.11.6.

8. 5V USB Battery (optional) (Amazon)

Building the Pirate Box

Downloading the PirateBox Operating System

The PirateBox team has posted a link to download the Image for the project as a torrent that you can unzip and “flash” (copy) to the SD card. If you don’t know what a torrent is,

If you don’t know what a torrent is, here is a quick lesson (courtesy of Wikipedia).

BitTorrent  ) is a collaborative file sharing – protocol , which is particularly suitable for the rapid distribution of large amounts of data. In contrast to other file sharing techniques, BitTorrent does not rely on an over-archiving file-sharing network, but instead creates a separate distribution network for each file.

A torrent is kind of like the Table of Contents for a book, You download it and open it in a BitTorrent client which connects you to several other people who have a copy of the file on their computer, (seeders). They each transmit a small piece of the file to you (while you do the same) filling in the Table of Contents with the actual content. When finished, you have a complete file of whatever type it was you were downloading (mp4, epub, txt, pdf, exe, dmg, img etc.).

utorrent-logo-con-sfondocover

I used UTorrent which I already had installed, and booted up my Windscribe free VPN service before starting it – can’t ever be too safe since BitTorrent often gets a bad rap for people downloading copyrighted content. You should always use a VPN when using BitTorrent in my opinion, no matter what you are downloading. A VPN is like a private tunnel into the internet that can obscure your immediately recognizable traffic and change your IP Address. Mine has me ported to Germany, which then plays all sorts of fun games with Google search results for hours!!!

Formatting the SD Card

head_logo

Right out of the gate, I had  a little trouble with this since I’m using a differn SD card than the one included in the Starter Kit. The kit comes with a USB MicroSD reader that can allow you to read/write to it from your computer.

imag0049

However, when trying to erase and format the SD Card, I encountered a “Write-Protection” error and had to go find a MicroSD card adapter that would fit in the SD card slot of my Macbook. After I made this change (and frantically tore my house apart looking for the adapter) the process went much more smoothly.

imag0050

Insert Your MicroSD card into your SD Card Reader (or USB reader if you have the right combination I guess).

This slideshow requires JavaScript.

I used SDFormatter from the SD Association to completely erase and reformat the SD Card, and lovingly renamed it “arkenstone” because I’m a huge geek.

I then used the RPiCard Builder and the instructions on their website to flash (copy) the .img file downloaded and unzipped from the Pirate Box Torrent to the SD Card.

screen-shot-2016-11-18-at-6-40-51-pm
See The Raspberry Pi Icon on the Right

Download and Install the RPiCard Builder from the link above if you don’t have it already. Open it from your applications menu.

screen-shot-2016-11-18-at-6-41-39-pm

A finder window will immediately pop up. You should navigate to wherever you download and unzipped your PirateBox file from the Torrent file earlier.

 

screen-shot-2016-11-18-at-6-59-31-pmEnter your system password to continue.

screen-shot-2016-11-18-at-7-00-02-pm

You will then get a pop-up asking you to confirm if the SD card is unmounted. I was a little confused by this and messed it up a couple of times. You should check finder, and if you don’t see the SD card, then click continue.

screen-shot-2016-11-18-at-6-43-39-pm

You will then wait for awhile and if you want, check the progress from the Mac system top toolbar.

screen-shot-2016-11-18-at-7-02-04-pm

Finally, you will get a pop-up that says that it is safe to remove the card and put it in your Raspberry Pi.

That’s it! Step 1 is complete, formatting the SD Card and flashing the Pirate Box image to the disk. We are now ready to start setting up our Raspberry Pi!

I actually have to go to school for this part (so I can connect with the router), so I will continue writing the next section from there.

Booting Up PirateBox on the Raspberry Pi 3

I finally made it back to school (it was the beginning of the weekend when I started) determined to set up the Pirate Box and see if I could get it to work on a local router one of our teachers installed off the main school’s ethernet connection.

Following the instructions from the website, I loaded the microSD card into the Raspberry Pi, inserted a thumb drive I had on hand (for external storage down the line), connected it to the router with an ethernet cable,and finally turned it on by plugging in the power adapter. Here it is booting up for the first time!

imag0054

After a couple of minutes of letting it boot, I followed the instructions to log into the Piratebox by opening up Terminal on my Macbook Pro and “SSHing” into it.

SSH stands for Secure Shell and is a cryptographic network protocol that allows you to do secure things on an unsecured network. Here we are logging into a remote computer system (our Pirate Box) so we are telling our computer to use the SSH protocol (a secure set of instructions) as our method for doing so.

In order to SSH into the Pirate Box for the first time, join the wireless network for your router (or connect to it via Ethernet), open up Terminal (or whatever similar console you have for your Operating System) and type:

ssh alarm@alarmpi

Your computer will probably ask you to authenticate the “host” meaning that you’ve never tried to talk to it over SSH before and it wants to establish it as a “trusted” network to connect to. You do this by cryptographically creating and sharing a public key that your computer will use to authenticate the Piratebox is trusted. You just need to do this once. 

Note: If you encounter an error saying you already have a key for this connection, you may have to modify your folder that stores all the keys. Copy whatever error you get into Google and you should quickly find an answer, it is very common if you work with a lot of Raspberry Pis.

Type in yes and hit enter to continue.

Next enter the password for the Pirate Box (alarm is the default), hit enter and you’ll get the super cool message below! Congratulations you are in!

screen-shot-2016-11-19-at-9-53-23-pm

Now that you are logged into your Pirate Box for the first time, you have a little bit of housekeeping to do.

MUST DO: Change your Password so random people can’t log in

Type:

passwd

and hit enter. It will ask you to type your current password and then enter the new password twice.

OPTIONAL TO DO: Change the file directory to point to your USB Thumb drive instead of the microSD card. I didn’t do this for now, but you can follow the instructions here if you want to try that.

Setting up the Pirate Box Interface (Out-Of-The-Box)

As documented on the Pirate Box website, I followed the Post-Installation instructions to set up the board as-is for the first time.

Later I took a quick tour of the content to see where the main Graphic User Interface lived to see if I could change it a bit (documented in the next section).

Setting up the Interface

Log In to the Pirate Box as a User: 

  1. If not powered already, re-power up your PirateBox (make sure you disconnect it from the ethernet cable first).
  2. Open up your WiFi menu and look for the network with the SSID Piratebox, Share Freely. Join this network.
  3. Open up the Network Preferences menu by clicking “Open Network Preferences” at the bottom of your WiFi drop-down menu.
  4. Look right underneath where it says Status Connected and you should see an IP address listed in the sentence “Wi-Fi is connected to Piratebox, Share Freely and has the IP address 192.168.77.17.”
    • Remember, you won’t be able to access the actual Internet when you join this, so be sure to have whatever instructions you need open and on your computer screen before you make the switch.
  5. Open up a Terminal window on your Macbook or alternate console program (for Window’s, PirateBox says to install and open PuTTY) and SSH into your PirateBox as a user this time by typing: (it only worked for me when I just had a 1 at the end, not sure why, but this was Pirate Box’s instructions as well, so the IP they had listed worked for me.
ssh alarm@192.168.77.1

Activate the Kareha Image & Discussion Board

  1. After SSHing in, type in the following command to activate the Kareha Image & Discussion board by using the “board-autoconf” (autoconfigure) tool included.
sudo /opt/piratebox/bin/board-autoconf.sh

Activate the “Timesave” Functionality

  1. Type in the below to activate the timesave functionality for the Pirate Box.
 sudo /opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf install
 sudo systemctl enable timesave

Activate the UPnP Media Server

  1. Type in the below line by line and hit enter after each line to copy over the configuration file for the UPnP Media Server into the correct folder.
sudo cp /etc/minidlna.conf /etc/minidlna.conf.bkp
sudo cp /opt/piratebox/src/linux.example.minidlna.conf /etc/minidlna.conf

(Optional) Edit the Configuration File

  1. You can edit the configuration file you copied over above to change things like the Display Name by typing in the below and hitting enter.
sudo nano /etc/minidlna.conf

Start the UPnP Media Server

When you are done making any optional edits, you can start the UPnP Media server by typing in the below commands line by line and hitting enter after each line.

sudo systemctl start minidlna
sudo systemctl enable minidlna

 

Congratulations!!! Your Pirate Box should now be ready to use!!!

Access The User Interface for Your Pirate Box

Now that the Pirate Box is all set up, time to check it out and share it with friends.

In order to access the Pirate Box, you must be connected to the WiFi network for it. It is actually a Local Area Network cast wirelessly, so you can’t use both it and the Internet out of the gate, although I would like to experiment with mods that allow this to happen (if it makes sense security wise).

Once you connect to the Pirate Box network, you will need to open up a browser of your choice (I used Chrome) and type in the following to access the Pirate Box User Interface.

192.168.77.1

Hit enter. You should be redirected to a page entitled piratebox.lan/ which has a graphic User Interface setup and looks like a normal website. See below.

Home Page/Welcome

screen-shot-2016-11-19-at-10-13-00-pm
Welcome page with some basic instructions.
screen-shot-2016-11-19-at-11-12-33-pm
Here is the built-in chat board. You can change your name to whatever you want each time you log in. I am chatting here with a friend to see how it works. You can also see the upload button for the file-share (below) and how much of the Pirate Box’s hard drive is being used.

File Server

screen-shot-2016-11-19-at-11-12-17-pm
The Media/File Sharing Page that allows you to share files and live-stream them from the website.
screen-shot-2016-11-19-at-11-12-08-pm
Testing Out my Famous “Test” Movie, a Mp4 of Big Bang’s Fantastic Baby that I use to test everything… (I was also easily able to upload and share an music file)

Forum

screen-shot-2016-11-19-at-10-48-39-pm

Touring the BackEnd & Making Some Edits

Since this is meant to be an experiment and sandbox for myself and my classmates to experiment with, I really wanted to understand how to tinker with that Graphic User Interface, services offered, and new services that could be hosted using this platform (Internet of Things, games etc. that can stay perpetually running an accessible).

There were three things I wanted to try to do for experimentation.

  1. Change the WiFi SSID to something DT specific
  2. Change the welcome text on the Index Page
  3. Change the Default Chat Name to something funny instead of “Anonymous”

Changing the WiFi SSID

After a lot of searching through the forums, I finally found the path to edit some of the system configuration files.

cd /opt/piratebox/conf

Within in this directory, you can edit the Network information from the “hostapd.conf” file, accessed by typing the below and hitting enter.

nano /opt/piratebox/conf/hostapd.conf

This will open up a text editor right in your terminal with sosomenformation about your build. Look for the line that says:

ssid=PirateBox - Share Freely

And change it to the SSID you want to show.

ssid=Pirate Ship

I rebooted the Pirate Box after this to make sure the change took hold, and shortly thereafter, saw it come up in WiFi with the new name.

Edit the Welcome Text

Also hiding in the /opt/piratebox directory is the “www” folder, which holds all the elements of the Graphic User Interface as a set of HTML, CSS and javascript documents. After all, the Pirate Box is a server that automatically hosts a website upon boot allowing people to access its content via a web-interface. The www is where this web interface lives. Type the below to navigate into the www folder.

cd /opt/piratebox/conf/www_content

I was able to open up the main index page for the website and make some changes. Below.

screen-shot-2016-11-19-at-10-52-11-pmscreen-shot-2016-11-19-at-10-53-41-pm

However, there is also a preset text file that Pirate Box uses to generate content based on language, so I actually had to find the preset text for English and edit that as well to make the changes stick.

Screen Shot 2016-11-19 at 11.12.28 PM.png

Also in this file, I found the line:

mainChatName.value = Anonymous

which I modified to instead say “AnonymousPanda” just as a trial. This worked and the preset chat name was changed for the site.

For The Future

That’s it for now! I have the following wishes for this network over the coming months and hope my classmates infinitely more talented at some of these things will assist.

  1. Play with the network configuration to allow this to be accessed at same time as the Internet connection (if that makes sense for privacy).
  2. Set up WPA Authentication to give us a password
  3. Try permanently hosting IOT applications off the server
  4. Add/Modify pages to the Web User Interface
  5. Host game or other interactive online media
  6. Get a WiFi Extender to Boost Range
  7. Build a Super Cool Custom Enclosure like the one listed in the featured image of this post

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s