add tool to show currently connected AP

This commit is contained in:
Dominik Heidler 2015-09-09 16:06:29 +02:00
parent eb96efc883
commit d0aa5aa201
1 changed files with 15 additions and 0 deletions

15
contrib/get_current_ap.py Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python
import subprocess
from pymongo import MongoClient
client = MongoClient()
db = client.freifunk
# this tool will try to show you the hostname of the Freifunk AP you are currently connected to
mac = subprocess.check_output(["iwgetid", "-ar"]).strip().lower().decode()
router = db.routers.find_one({"netifs.mac": mac})
print(router["hostname"])