From d0aa5aa201f261cd2207c634a2d55cc043cac912 Mon Sep 17 00:00:00 2001 From: Dominik Heidler Date: Wed, 9 Sep 2015 16:06:29 +0200 Subject: [PATCH] add tool to show currently connected AP --- contrib/get_current_ap.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 contrib/get_current_ap.py diff --git a/contrib/get_current_ap.py b/contrib/get_current_ap.py new file mode 100755 index 0000000..b812a1d --- /dev/null +++ b/contrib/get_current_ap.py @@ -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"])