Compare commits

..

No commits in common. "0b9eec8d1dd8b9fb84fdc7f7b493d4fd672bda13" and "b9083d4698cd36d907bac23ea4937653afecf6a9" have entirely different histories.

4 changed files with 25 additions and 52 deletions

View File

@ -4,7 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add file dict_to_address for &#10;address a active Tunnel. Label green pack in Class.&#10;add Class to convert fileoutput as String to Dictionary"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add Label Interface and Peer to new FrameWidget one and two. when import Tunnel then add to list works and remove of list when Tunnel delete.(with Label active on and off) &#10;add to class and methods open a avtive Tunnel when Wire-Py open, when import and start a Tunnel">
<change afterPath="$PROJECT_DIR$/dict_to_address" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
@ -146,15 +147,7 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1724102937260</updated> <updated>1724102937260</updated>
</task> </task>
<task id="LOCAL-00008" summary="add file dict_to_address for &#10;address a active Tunnel. Label green pack in Class.&#10;add Class to convert fileoutput as String to Dictionary"> <option name="localTasksCounter" value="8" />
<option name="closed" value="true" />
<created>1724233806458</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1724233806458</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -188,18 +181,6 @@
<MESSAGE value="add class Frame and class Massage, delete funktion go 100%, add resize window, add warning pic" /> <MESSAGE value="add class Frame and class Massage, delete funktion go 100%, add resize window, add warning pic" />
<MESSAGE value="add class ListTunnels and class ImportTunnel, and add class ExportTunnels (ExportTunnels no finish)" /> <MESSAGE value="add class ListTunnels and class ImportTunnel, and add class ExportTunnels (ExportTunnels no finish)" />
<MESSAGE value="add Label Interface and Peer to new FrameWidget one and two. when import Tunnel then add to list works and remove of list when Tunnel delete.(with Label active on and off) &#10;add to class and methods open a avtive Tunnel when Wire-Py open, when import and start a Tunnel" /> <MESSAGE value="add Label Interface and Peer to new FrameWidget one and two. when import Tunnel then add to list works and remove of list when Tunnel delete.(with Label active on and off) &#10;add to class and methods open a avtive Tunnel when Wire-Py open, when import and start a Tunnel" />
<MESSAGE value="add file dict_to_address for &#10;address a active Tunnel. Label green pack in Class.&#10;add Class to convert fileoutput as String to Dictionary" /> <option name="LAST_COMMIT_MESSAGE" value="add Label Interface and Peer to new FrameWidget one and two. when import Tunnel then add to list works and remove of list when Tunnel delete.(with Label active on and off) &#10;add to class and methods open a avtive Tunnel when Wire-Py open, when import and start a Tunnel" />
<option name="LAST_COMMIT_MESSAGE" value="add file dict_to_address for &#10;address a active Tunnel. Label green pack in Class.&#10;add Class to convert fileoutput as String to Dictionary" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/wg_func.py</url>
<line>116</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component> </component>
</project> </project>

View File

@ -1,3 +1,3 @@
10.64.1.5/32 192.168.178.158/24
10.64.1.1 192.168.178.1,
wg.iunix.dedyn.io:51820 rj2cexasg9b9oydd.myfritz.net:54775

24
main.py
View File

@ -4,7 +4,7 @@ import tkinter as tk
from tkinter import ttk from tkinter import ttk
from wg_func import (TunnelActiv, ListTunnels, ImportTunnel, from wg_func import (TunnelActiv, ListTunnels, ImportTunnel,
ConToDict, GreenLabel, StartStopBTN, ExportTunnels) ConToDict, GreenLabel, ExportTunnels)
class MainWindow(tk.Tk): class MainWindow(tk.Tk):
@ -37,6 +37,8 @@ class FrameWidgets(ttk.Frame):
self.wg_read = None self.wg_read = None
self.wg_vpn_start = tk.PhotoImage(file=r'icons/wg-vpn-start-48.png') self.wg_vpn_start = tk.PhotoImage(file=r'icons/wg-vpn-start-48.png')
self.wg_vpn_stop = tk.PhotoImage(file=r'icons/wg-vpn-stop-48.png') self.wg_vpn_stop = tk.PhotoImage(file=r'icons/wg-vpn-stop-48.png')
self.wgi_on = tk.PhotoImage(file=r'icons/wire-switch-on-48.png')
self.wgi_off = tk.PhotoImage(file=r'icons/wire-switch-off-48.png')
self.imp_pic = tk.PhotoImage(file=r'icons/wg-import.png') self.imp_pic = tk.PhotoImage(file=r'icons/wg-import.png')
self.tr_pic = tk.PhotoImage(file=r'icons/wg-trash-48.png') self.tr_pic = tk.PhotoImage(file=r'icons/wg-trash-48.png')
self.exp_pic = tk.PhotoImage(file=r'icons/wg-export-48.png') self.exp_pic = tk.PhotoImage(file=r'icons/wg-export-48.png')
@ -95,13 +97,15 @@ class FrameWidgets(ttk.Frame):
# Button Vpn # Button Vpn
if self.a != '': if self.a != '':
StartStopBTN.button_stop(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf' wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf'
file = open(wg_read, 'r') file = open(wg_read, 'r')
ConToDict.covert_to_dict(file) ConToDict.covert_to_dict(file)
file.close() file.close()
else: else:
StartStopBTN.button_start(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
# Button Import # Button Import
self.btn_i = tk.Button(self, image=self.imp_pic, bd=0, command=lambda: ImportTunnel.wg_import_select(self)) self.btn_i = tk.Button(self, image=self.imp_pic, bd=0, command=lambda: ImportTunnel.wg_import_select(self))
self.btn_i.grid(column=0, row=2, padx=15, pady=15) self.btn_i.grid(column=0, row=2, padx=15, pady=15)
@ -114,7 +118,8 @@ class FrameWidgets(ttk.Frame):
os.remove(os.environ['HOME'] + '/tester/' + str(select_tl) + '.conf') os.remove(os.environ['HOME'] + '/tester/' + str(select_tl) + '.conf')
if self.a != '': if self.a != '':
self.StrVar.set(value='') self.StrVar.set(value='')
StartStopBTN.button_start(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
self.l_box.update() self.l_box.update()
# Button Trash # Button Trash
@ -133,7 +138,7 @@ class FrameWidgets(ttk.Frame):
def wg_switch(self): def wg_switch(self):
self.a = TunnelActiv.active() self.a = TunnelActiv.active()
if self.a == '': if self.a == '':
StartStopBTN.button_start(self)
self.select_tunnel = self.l_box.curselection() self.select_tunnel = self.l_box.curselection()
select_tl = self.l_box.get(self.select_tunnel[0]) select_tl = self.l_box.get(self.select_tunnel[0])
os.system('nmcli connection up ' + str(select_tl)) os.system('nmcli connection up ' + str(select_tl))
@ -142,17 +147,20 @@ class FrameWidgets(ttk.Frame):
ConToDict.covert_to_dict(file) ConToDict.covert_to_dict(file)
file.close() file.close()
# Button Start/Stop # Button Start/Stop
StartStopBTN.button_stop(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
self.a = TunnelActiv.active() self.a = TunnelActiv.active()
self.StrVar = tk.StringVar() self.StrVar = tk.StringVar()
self.StrVar.set(self.a) self.StrVar.set(self.a)
GreenLabel.green_show_label(self) GreenLabel.green_show_label(self)
elif self.a != '': elif self.a != '':
# Button Start/Stop # Button Start/Stop
StartStopBTN.button_stop(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
os.system('nmcli connection down ' + str(self.a)) os.system('nmcli connection down ' + str(self.a))
# Button Start/Stop # Button Start/Stop
StartStopBTN.button_start(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
self.a = TunnelActiv.active() self.a = TunnelActiv.active()
self.StrVar = tk.StringVar() self.StrVar = tk.StringVar()
self.StrVar.set(value=' ') self.StrVar.set(value=' ')

View File

@ -41,23 +41,6 @@ class GreenLabel(tk.Tk):
self.lb_tunnel.grid(column=3, row=1, sticky="w") self.lb_tunnel.grid(column=3, row=1, sticky="w")
class StartStopBTN(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.wg_switch = None
self.btn_stst = None
self.wg_vpn_start = tk.PhotoImage(file=r'icons/wg-vpn-start-48.png')
self.wg_vpn_stop = tk.PhotoImage(file=r'icons/wg-vpn-stop-48.png')
def button_stop(self):
self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
def button_start(self):
self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
class ConToDict: class ConToDict:
@classmethod @classmethod
def covert_to_dict(cls, file): def covert_to_dict(cls, file):
@ -155,7 +138,8 @@ class ImportTunnel:
self.lb_tunnel = tk.Label(self, textvariable=self.StrVar, fg='green') self.lb_tunnel = tk.Label(self, textvariable=self.StrVar, fg='green')
self.lb_tunnel.config(font=("Ubuntu", 11, "bold")) self.lb_tunnel.config(font=("Ubuntu", 11, "bold"))
self.lb_tunnel.grid(column=3, row=1, sticky="w") self.lb_tunnel.grid(column=3, row=1, sticky="w")
StartStopBTN.button_stop(self) self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=15, sticky="s")
wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf' wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf'
file = open(wg_read, 'r') file = open(wg_read, 'r')
ConToDict.covert_to_dict(file) ConToDict.covert_to_dict(file)