import datetime for datetime in zip_name a export Tunnel
This commit is contained in:
parent
4060a92a0e
commit
6173a653f9
34
.idea/workspace.xml
generated
34
.idea/workspace.xml
generated
@ -4,9 +4,8 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="fix when Filname > 17 first copy file after rename">
|
||||
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add export Tunnel as zip">
|
||||
<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$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -41,16 +40,16 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/home/punix/Pyapps/wire-py",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/home/punix/Pyapps/wire-py",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||
<module name="wire-py" />
|
||||
@ -235,7 +234,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1724593165879</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="19" />
|
||||
<task id="LOCAL-00019" summary="add export Tunnel as zip">
|
||||
<option name="closed" value="true" />
|
||||
<created>1724610514657</created>
|
||||
<option name="number" value="00019" />
|
||||
<option name="presentableId" value="LOCAL-00019" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1724610514658</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="20" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
@ -280,6 +287,7 @@
|
||||
<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="fix when Filname > 17 first copy file after rename" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="fix when Filname > 17 first copy file after rename" />
|
||||
<MESSAGE value="add export Tunnel as zip" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="add export Tunnel as zip" />
|
||||
</component>
|
||||
</project>
|
14
wg_func.py
14
wg_func.py
@ -1,7 +1,7 @@
|
||||
# Wireguard functions for Wire-Py
|
||||
import os
|
||||
import shutil
|
||||
import tarfile
|
||||
from datetime import datetime
|
||||
from tkinter import filedialog
|
||||
import tkinter as tk
|
||||
|
||||
@ -225,9 +225,19 @@ class ImportTunnel:
|
||||
class ExportTunnels:
|
||||
@staticmethod
|
||||
def wg_export():
|
||||
now_time = datetime.now()
|
||||
now_datetime = now_time.strftime('/wg-exp-' + "%m-%d-%Y" + '-' + "%H:%M")
|
||||
tl = ListTunnels.tl_list()
|
||||
try:
|
||||
wg_tar = os.environ['HOME'] + '/datetime'
|
||||
if len(tl) != 0:
|
||||
wg_tar = os.environ['HOME'] + now_datetime
|
||||
p_to_conf = os.environ['HOME'] + '/tester'
|
||||
shutil.make_archive(wg_tar, 'zip', p_to_conf)
|
||||
#if zip_full != 0:
|
||||
#print('Export erfolgraeich')
|
||||
#else:
|
||||
#print('ups etwwas ging schief bitte Export wiederholen')
|
||||
else:
|
||||
print('No Tunnel for Export')
|
||||
except TypeError:
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user