diff --git a/gestion/tools/whokfet.py b/gestion/tools/whokfet.py index eab62191..3f002a8f 100755 --- a/gestion/tools/whokfet.py +++ b/gestion/tools/whokfet.py @@ -11,22 +11,15 @@ from affich_tools import coul, cprint from whos import aff from socket import gethostname from os import system -from subprocess import Popen, PIPE - +import xml.dom.minidom def get_wifi_connected_client(): - x=Popen(["ssh","-T", "-i" , "/usr/scripts/gestion/clef-wifi-kfet","-l","root" ,"-x", "-o", "BatchMode=yes", "-o", - "ConnectTimeout=5", "-o", "StrictHostKeyChecking=no","valhalla.wifi", "/usr/crans/list_clients.sh"], stdout=PIPE) - clients=x.communicate()[0].split("\n") - macs=[] - for client in clients: - try: - macs.append(client.split(" ")[1]) - except IndexError: pass - return macs + f = open('/usr/scripts/var/wifi_xml/valhalla.xml','r') + doc = xml.dom.minidom.parse(f) + f.close() + return [ mac.firstChild.nodeValue for mac in doc.getElementsByTagName('mac') ] def liste_kfet(): - sw = hpswitch('batb-0') db = crans_ldap() try: