From 1d7424c9724d3a1e9b72c8ffdfc130cdce472036 Mon Sep 17 00:00:00 2001 From: ThugPigeon653 <89567974+ThugPigeon653@users.noreply.github.com> Date: Tue, 19 Sep 2023 13:20:30 +1000 Subject: [PATCH] linux wifi check --- wifi-connected-users/wifi_connected_users.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wifi-connected-users/wifi_connected_users.py b/wifi-connected-users/wifi_connected_users.py index 0ed60fc64..3c1fbd337 100644 --- a/wifi-connected-users/wifi_connected_users.py +++ b/wifi-connected-users/wifi_connected_users.py @@ -1,7 +1,12 @@ import subprocess +import platform -results = subprocess.check_output(["netsh", "wlan", "show", "network"]) -results = results.decode("ascii") +if(platform.system()=="Windows"): + results = subprocess.check_output(["netsh", "wlan", "show", "network"]) + results = results.decode("ascii") +elif(platform.system=="Linux"): + results = subprocess.check_output(["iwlist", "scan"]) + results = results.decode("utf-8") results = results.replace("\r","") ls = results.split("\n") ls = ls[4:]