Tunnel Start and Stop Work

This commit is contained in:
2024-08-14 22:05:00 +02:00
commit f6ec12d03e
32 changed files with 609 additions and 0 deletions

20
wg_func.py Normal file
View File

@ -0,0 +1,20 @@
# 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