From e958f508cbd85e637bd62babaefc656295e8c390 Mon Sep 17 00:00:00 2001 From: sascha Date: Sun, 16 Aug 2026 20:08:07 +0200 Subject: [PATCH] Fix unprivileged WireGuard status parsing --- app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index c43dec1..37b94c6 100644 --- a/app.py +++ b/app.py @@ -1231,7 +1231,7 @@ try: for address in item.get("addr_info", []): result["addresses"].append(address["local"] + "/" + str(address["prefixlen"])) result["routes"] = json.loads(run(["ip", "-j", "route", "show", "dev", "wg0"])) - rows = run(["wg", "show", "wg0", "dump"]).splitlines() + rows = run(["sudo", "-n", "wg", "show", "wg0", "dump"]).splitlines() if rows: interface = rows[0].split("\\t") result["listen_port"] = int(interface[2]) @@ -1244,7 +1244,7 @@ try: "latest_handshake": int(fields[4]), "rx_bytes": int(fields[5]), "tx_bytes": int(fields[6]), - "persistent_keepalive": int(fields[7]), + "persistent_keepalive": 0 if fields[7] == "off" else int(fields[7]), }) except Exception as exc: result["error"] = str(exc)[:300]