import requests import urllib3 import json urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) s = requests.Session() s.verify = False r = s.post('https://14.44.4.1/api/auth/login', json={'username': 'snarf', 'password': 'Katzir476!!!'}) csrf = r.headers.get('x-csrf-token') or r.cookies.get('csrf_token') headers = {'X-CSRF-Token': csrf} if csrf else {} # Get wlanconf r_wlan = s.get('https://14.44.4.1/proxy/network/api/s/default/rest/wlanconf', headers=headers) print("WLANs:") for w in r_wlan.json().get('data', []): print(f" SSID: {w.get('name')}, enabled: {w.get('enabled')}, networkconf_id: {w.get('networkconf_id')}, is_guest: {w.get('is_guest')}, l2_isolation: {w.get('l2_isolation')}, client_isolation: {w.get('client_isolation')}") # Get nutserver client details in depth r_sta = s.get('https://14.44.4.1/proxy/network/api/s/default/stat/sta', headers=headers) for c in r_sta.json().get('data', []): if c.get('ip') == '14.4.4.44': print("\nNutserver client full details:") for k, v in c.items(): if any(term in k for term in ['ip', 'mac', 'network', 'vlan', 'ap', 'bssid', 'guest', 'blocked', 'isolate']): print(f" {k}: {v}")