Introduction
While on the flight to Derbycon 2019 I wanted to have a way to broadcast the conference schedule to WiFi so I didn't have to pull the program out. I didn't finish the build in time, but it may still be useful for others.
https://github.com/vgrsec/wifi-messages
Overview
This project is designed to provide messages over wifi. It has two operating modes.
- Default A single file will be loaded and broadcast. This file is located in
- Date-based
/boot/wifi-messages/input/_default.txt
ssid-rotator.py
grabs current date and time and broadcasts any lines that are for this hour, and the next hour. It loads the schedule from /boot/wifi-messages/input/%date%.txt
To perform the rotation, this project contains a systemd timer, a shell script to broadcast ssid messages, and a ssid rotation python script.
The input file is located in /boot
so that one can remove the SD Card from the raspberry pi and load new messages without having to muck with the device
Setup
Required Equipment
- Raspberry Pi
- Alfa AWUS036NH
- USB Battery
- MicroUSB Cable
- Network Cable
- Network Adapter that supports crossover detection
- Adafruit PiRTC - PCF8523 Real Time Clock (RTC)
- CR1220 coin cell battery for RTC
Setup Raspberry Pi
- Install the RTC
- Download Rasbian Lite
- Image SD Card
- Enable SSH
- Connect network cable from RPi to computer
- SSH:
ssh pi@raspberrypi.local
Password:raspberry
- Clone the wifi-messages repo and run the setup script
sudo -i
cd /usr/local/bin/
apt-get install git -y
git clone https://github.com/vgrsec/wifi-messages.git
cd /usr/local/bin/wifi-messages
./setup.sh
The first time you setup your wifi-messages pi make sure to be connected to the internet. Otherwise the RTC may not be programmed with the correct time and the clock rotation will fail
Setup WiFi Messages
Modify /boot/wifi-messages/input/_default.txt
for static messages.
OR
Create files for the days you wish to broadcast messages in /boot/wifi-messages/input/YYYYMMDD.txt
The easiest way to modify the input files is to remove the sd card from the raspberry pi and put it into another device. This way you can use a text editor to edit the file without having to ssh into the pi.
Files
ssid-rotator is looking for times in half hour increments. I am not a developer, and so the logic is only looking for the top of the hour and the half hour. It is also not capable of rotating over at midnight.
This script is launched by the systemd event to broadcast the ssid messages.
- NTP time sync
- Set Timezone
- airmon-ng is used to put the wifi card into broadcast mode.
- mdk3 broadcasts the ssid's from
/usr/local/bin/wifi-messages/output/ssid.txt
This file shows the format that ssid-rotator.py
expects. The first four characters for the time is what the rotator looks at.
To perform a function test of your wifi-rotator copy input/_test.txt to input/%YYYYMMDD%.txt and watch it go