Skip to content

Commit 560b4c2

Browse files
authored
Merge pull request #2059 from Jixabon/fix/api-fixes
API Fixes
2 parents 4b1e6f0 + 3bc9433 commit 560b4c2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

api/modules/ap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def ieee80211n():
3232
return subprocess.run("cat /etc/hostapd/hostapd.conf | grep ieee80211n= | cut -d'=' -f2", shell=True, capture_output=True, text=True).stdout.strip()
3333

3434
def wpa_passphrase():
35-
return subprocess.run("sed -En 's/wpa_passphrase=(.*)/\1/p' /etc/hostapd/hostapd.conf", shell=True, capture_output=True, text=True).stdout.strip()
35+
return subprocess.run("sed -En 's/wpa_passphrase=(.*)/\\1/p' /etc/hostapd/hostapd.conf", shell=True, capture_output=True, text=True).stdout.strip()
3636

3737
def interface():
38-
return subprocess.run("cat /etc/hostapd/hostapd.conf | grep interface= | cut -d'=' -f2 | head -1", shell=True, capture_output=True, text=True).stdout.strip()
38+
return subprocess.run("cat /etc/hostapd/hostapd.conf | grep '^interface=' | cut -d'=' -f2", shell=True, capture_output=True, text=True).stdout.strip()
3939

4040
def wpa():
4141
return subprocess.run("cat /etc/hostapd/hostapd.conf | grep wpa= | cut -d'=' -f2", shell=True, capture_output=True, text=True).stdout.strip()
@@ -61,4 +61,4 @@ def logging():
6161
logs[interface] = []
6262
logs[interface].append(message)
6363

64-
return json.dumps(logs, indent=2)
64+
return json.dumps(logs, indent=2)

api/modules/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def get_active_clients_amount(interface):
55
arp_output = subprocess.run(['arp', '-i', interface], capture_output=True, text=True)
6-
mac_addresses = arp_output.stdout.splitlines()
6+
mac_addresses = mac_addresses = set(line.split()[2] for line in arp_output.stdout.splitlines()[1:])
77

88
if mac_addresses:
99
grep_pattern = '|'.join(mac_addresses)

0 commit comments

Comments
 (0)