Wire-Py/wg_func.py
2024-08-14 22:05:00 +02:00

21 lines
485 B
Python

# Wireguard functions for Wire-Py
import os
def active(): # Shows the active tunnel
a = os.popen('nmcli connection show --active | grep -iPo "(.*)(wireguard)"').read().split()
if not a:
a = ''
return a
else:
a = a[0]
return a
def tl_list():
wg_s = os.popen('nmcli connection show | grep -iPo "(.*)(wireguard)"').read().split()
tl = wg_s[::3] # tl = Tunnelliste # Hiermit wird jedes 4. Element der Liste gezeigt
return tl