WiFi Trilateration: Or, the Difficulties of Networking
Brooke & Hans
To build a permanent database of users’ MAC addresses, use these MAC addresses to discover their devices on a network, and ping their devices to determine a user’s exact location. Ideally, this would allow our map to function similarly to the Marauder’s Map ability to show character locations as they walk through the halls, but replacing the mystique of magic with the cold logic of computer science.
As any Harry Potter fan will tell you, one of the most important tools in Harry’s arsenal is his Marauder’s Map, which allows him to traverse and discover the secret halls of Hogwarts without being discovered by professors. For our recreation of the Tuft’s Marauder’s Map, we decided to tackle tracking of individual users, a huge component of Harry’s Map. To do this we elected to explore WiFi trilateration and MAC address pairing as a means to obtain accurate position data of individuals as they wandered the halls of the Tufts SEC building.
To have the ability to track and show the location of individuals on the Tufts Marauder’s Map, we first had to create a standardized way to identify all the individuals of our class that could also be easily usable to locate them on a network. In the age of smartphones, we identified smartphone MAC address pairing as a way to easily ID users and locate them across the network. MAC addresses were chosen as their permanent association with hardware allows them to avoid IP addresses’ issues of updating whenever a user swaps networks or is bumped over to a different router. To carry out the device pairing, a Python script was written (see GitHub) to scrape the router’s log of connected devices, pull any new additions to the log, and write them to a database paired with the user’s username. This data could then be pushed to the cloud and used by other map projects and pinged to determine location.
To determine location, we deemed trilateration an elegant solution. Trilateration works by measuring a user’s distance from three known points to find the intersection of these distances and, as a result, determining the user’s exact positioning with reference to these fixed points. Traditionally, WiFi trilateration has been handled by having a user’s device ping several beacons, measuring response, then pushing position to the cloud from the user’s device. We wanted to flip this relationship, instead giving the pinging responsibilities to the beacons themselves, thereby giving a network the ability to actively track a user while the user him/herself could remain passive (and unknowing of the fact that they were being tracked). Unfortunately, this proved much more difficult than anticipated as we ran into numerous roadblocks with regards to how to best measure distance over WiFi indoors (time of flight and signal strength are not fantastically precise or accurate) and how to best offload this ping to the beacons and coordinate them to work together.
GitHub Code Repository | Video Demonstration of Address Pairing
Our final product is a Python script that identifies and associates devices connected to any given network. While it is unable to track a user’s position, it can still be applied to the Marauder’s Map and has potential uses outside of the scope of this project. One such possibility is use in a company setting to sweep their networks to determine if people are connected that do not belong, allowing those in charge to take further security actions and thereby prevent any threat or leak of company information.