add export Tunnel as zip

This commit is contained in:
Désiré Werner Menrath 2024-08-25 20:28:32 +02:00
parent 980c5a9010
commit 4060a92a0e
3 changed files with 18 additions and 8 deletions

View File

@ -4,7 +4,7 @@
<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="remove a ',' in DNS Name"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="fix when Filname &gt; 17 first copy file after rename">
<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" />
@ -227,7 +227,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1724576599289</updated> <updated>1724576599289</updated>
</task> </task>
<option name="localTasksCounter" value="18" /> <task id="LOCAL-00018" summary="fix when Filname &gt; 17 first copy file after rename">
<option name="closed" value="true" />
<created>1724593165879</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1724593165879</updated>
</task>
<option name="localTasksCounter" value="19" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -271,6 +279,7 @@
<MESSAGE value="little fixes in Class Import" /> <MESSAGE value="little fixes in Class Import" />
<MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" /> <MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" />
<MESSAGE value="remove a ',' in DNS Name" /> <MESSAGE value="remove a ',' in DNS Name" />
<option name="LAST_COMMIT_MESSAGE" value="remove a ',' in DNS Name" /> <MESSAGE value="fix when Filname &gt; 17 first copy file after rename" />
<option name="LAST_COMMIT_MESSAGE" value="fix when Filname &gt; 17 first copy file after rename" />
</component> </component>
</project> </project>

View File

@ -138,7 +138,7 @@ class FrameWidgets(ttk.Frame):
self.btn_tr = tk.Button(self, image=self.tr_pic, bd=0, command=delete) self.btn_tr = tk.Button(self, image=self.tr_pic, bd=0, command=delete)
self.btn_tr.grid(column=0, row=3, padx=15, pady=15) self.btn_tr.grid(column=0, row=3, padx=15, pady=15)
# Button Export # Button Export
self.btn_exp = tk.Button(self, image=self.exp_pic, bd=0) self.btn_exp = tk.Button(self, image=self.exp_pic, bd=0, command=ExportTunnels.wg_export)
self.btn_exp.grid(column=0, row=4, padx=15, pady=15) self.btn_exp.grid(column=0, row=4, padx=15, pady=15)
# Check Buttons # Check Buttons
self.wg_autostart = tk.Checkbutton(self, text='Autoconnect on PC Start') self.wg_autostart = tk.Checkbutton(self, text='Autoconnect on PC Start')

View File

@ -1,6 +1,7 @@
# Wireguard functions for Wire-Py # Wireguard functions for Wire-Py
import os import os
import shutil import shutil
import tarfile
from tkinter import filedialog from tkinter import filedialog
import tkinter as tk import tkinter as tk
@ -225,8 +226,8 @@ class ExportTunnels:
@staticmethod @staticmethod
def wg_export(): def wg_export():
try: try:
wg_exp = os.popen('nmcli con show | grep -iPo "(.*)(wireguard)"').read().split() wg_tar = os.environ['HOME'] + '/datetime'
wg_exp = wg_exp[1] p_to_conf = os.environ['HOME'] + '/tester'
return wg_exp shutil.make_archive(wg_tar, 'zip', p_to_conf)
except IndexError: except TypeError:
pass pass