Build Your Own Independent Phone Network: Part 2

In the first part of this project, we completed all the prerequisites needed to build an offline independent phone network. We are now ready to finalize, launch, and use the network, which I will demonstrate in this post. Note that this post is best viewed on a PC as the code snippets are too large for smartphone displays.

Requirements

The same equipment as in the first part is needed:

  • Raspberry Pi (Model 3 recommended)
  • USB storage drive
  • microSD card and reader (32 GB recommended)
  • Ethernet cable
  • Wireless network adapter with powerful antenna and support for monitor mode
Illustration from hellofuture.orange.com

Connecting to the PirateBox

First, we must connect to the PirateBox via SSH, which requires knowledge of its IP address. We thus perform an arp-scan with the command arp-scan -l then attempt to connect:

~# ssh alram@192.168.10.5

The authenticity of host '192.168.10.5 (192.168.10.5)' can't be established.

ECDSA key fingerprint is SHA256xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

Are you sure you want to continue connecting (yes/no)? yes

Waarning: Permanently added '192.168.1051' (ECDSA) to the list of known hosts.

alarm@192.168.77.1's password:

Success is announced via the PirateBox screen:

____________________.__               __        __________

\______   \______   \__|___________ _/  |_  ____\______   \ _______  ___

 |       _/|     ___/  \_  __ \__  \\   __\/ __ \|    |  _//  _ \  \/  /

 |    |   \|    |   |  ||  | \// __ \|  | \  ___/|    |   (  < > >    <

 |____|_  /|____|   |__||__|  (____  /__|  \___  >______  /\____/__/\_ \

        \/                         \/          \/       \/            \/

 

Website: http://piratebox.cc                 PirateBox Version: 1.1.4

Forum:   http://forum/piratebox.cc           Build date: 11-05-2018

IRC:     #piratebox irc.freenode.net         Be open  --  Share freely!

 

First Steps After Flashing

1. Change password of alarm user

 > passwd

2. Change password of root user

 > sudo password root

3. Enable Fake-Timeservice

 3.1 Set date and time

  # Disable network time sync

  > sudo timedatectl set-ntp false

  # Set time to "Mon May 23 17:42:00" (Format: CCYYMMDD hhmm)

  > sudo date -s "20170523 1742"

  > cd /opt/piratebox && sudo ./bin/timesave.sh ./conf/piratebox.conf install

 3.2 Enable on startup

  > sudo systemctl enable timesave

4. Enable the Kareha Image and Discussion Board

  > sudo /opt/piratebox/bin/board-autoconf.sh

5. Enable USB thumb drive share OR extend SDCard

 USB: > sudo /opt/piratebox/rpi/bin/usb_share.sh

 SDCard: > sudo /opt/piratebox/rpi/bin/sdcard_share.sh

6. Enable UPnP Media Server

  > sudo cp /etc/minidlna.conf /etc/minidlna.conf.bkp

  > sudo cp /opt/piratebox/src/linux.example.minidlna.conf /etc/minidlna.conf

  > sudo systemctl stsart minidlna

  > sudo systemctl enable minidlna

7. Enable RealTimeClock timekeeping (needs DS3231 or 1307 RTC module!)

  > sudo systemctl enable rpi_hwclock

[alarm@alarmpi ~]$ 

In this screen, there are suggested steps to perform as well as settings to customize. We don’t need to dig deeper in those for the scope of this project.

Choosing the right Wifi card

One requirement that might go unnoticed is the choice of the Wifi card: if using an external one, we must specify this to the program by changing a variable in the /boot/wifi_card.conf file. After finding the name of the Wifi card to be used via ifconfig, we use the following command:

[alarm@alarmpi ~]$ sudo ifconfig wlan1 up

Be sure to write the appropriate name of your Wifi card instead of wlan1 as seen above. To verify that the operation was successful, we open the file mentioned earlier in a text editor (such as nano) and check that the right Wifi card is displayed:

[alarm@alarmpi ~]$ sudo nano /boot/wifi_card.conf

GNU nano 2.9.6              /boot/wifi_card.config

wlan1

Finalizing the project

Finally, the only step left is to install an appropriate application on the smartphones expected to connect to the network, allowing them to send text messages. Any Wifi Direct chatting app will work, for instance “Intercom for Android” (I didn't include a link to eliminate any confusion with sponsorship). Remember that this project unfortunately only supports Android devices. We are now officially done: we have built a network system from the ground up that allows us to communicate without relying on any external infrastructure! The range is completely dependent on the Wifi antenna chosen and can be easily extended by several kilometers with the addition of a powerful antenna, or even repeaters if desired.

One might wonder why not use a router instead, since it enables the same features even without an Internet connection. This method might be quicker to setup, but our solution offers various benefits. The most important is probably cost: a Raspberry Pi 3 sells for around US$ 25. Considering the price of an entry-level Wifi antenna and power bank, the cost of our project should not exceed US$ 40. On the other hand, finding a secure, reliable, and well-built Wifi router for the same price is very unlikely. Moreover, using a PirateBox ensures maximum privacy as no data is collected or stored in memory, making it impossible for anyone to steal data for advertising or profit purposes, plus the software used is open source. Also, one might opt for more advanced firmware than PirateBox, such as OpenWrt, which supports much more configuration and personalization, even though it is not beginner-friendly – this might be your next project!

For any questions, visit the Contact Me page and I will be glad to assist. Share this post with someone who may like it and stay tuned for more guides and projects coming soon.


Comments

Popular posts from this blog

Pixie-Dust Wifi Attack: Theory & Practice

Getting started in scripting

How to capture a WPA handshake