========== whereami ========== Some 4am exploratory programming on wifi trilateration. Screaming for refactoring but it works (on my machine, of course) and it can't scream that loud because it's still real tiny. Store your current network profile like this whereami.py -i ath0 -a home Of course replace ath0 with your network interface. This will store the mac addresses and signal strengths of the currently broadcasting networks in network-data.json Now go somewhere else and do it again. whereami.py -i ath0 -a "john's house" Now, if you run whereami.py -i ath0 While you're at john's house, it should print "john's house" to stdout. I've actually been able to get it to know what room it's in in my house, and the per-network scoring function is really naive right now, so I believe this has the potential to get pretty accurate. usage: whereami.py [-h] [-a NICKNAME] [-i INTERFACE] [-n N] [-L] Trilaterates ambient wifi network broadcasts and compares them to snapshots you've taken to tell you where you are. optional arguments: -h, --help show this help message and exit -a NICKNAME, --add NICKNAME Stores the current ambient wireless profile as NICKNAME -i INTERFACE, --interface INTERFACE The interface to scan on. -n N, --num-scan N The number of times to scan before accepting the data on the wireless network. All the readings are averaged together in hopes to smooth out anomalies. Note that due to the fact that iwlist does not actually trigger scanning for unprivileged users, this option is probably only useful when run as root, but you trust me, right? -L, --loop Runs forever, showing you every stored network profile and the probability that you are at that profile's location. Again, probably only useful when run as root, and doing so will kill your battery. Good for walking through different stored profiles with your laptop.