Compare commits
	
		
			22 Commits
		
	
	
		
			1.11.1724
			...
			13832d916f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 13832d916f | |||
| 1667682c9d | |||
| 8771be760d | |||
| 97bf9df041 | |||
| 1bba45a6c1 | |||
| a5eb6293c6 | |||
| 6e54529c0f | |||
| e28235af4b | |||
| 862cc91fa1 | |||
| 5fe6fd3f29 | |||
| 48a48ffd4c | |||
| 1278b02a95 | |||
| 22abe9f8b9 | |||
| 52f22beec6 | |||
| 8754e7ecda | |||
| a6742a0c0e | |||
| 6b75713121 | |||
| 762694aa94 | |||
| cc54f329fe | |||
| 8c01c1b984 | |||
| ebafdbdcb3 | |||
| ce4f6c84dc | 
							
								
								
									
										210
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										210
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -4,21 +4,9 @@ | ||||
|     <option name="autoReloadType" value="SELECTIVE" /> | ||||
|   </component> | ||||
|   <component name="ChangeListManager"> | ||||
|     <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError"> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/128/error.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/128/info.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/256/error.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/256/info.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/32/error.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/32/info.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/48/error.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/48/info.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/64/error.png" afterDir="false" /> | ||||
|       <change afterPath="$PROJECT_DIR$/lx-icons/64/info.png" afterDir="false" /> | ||||
|     <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment=" - Update Translate Files"> | ||||
|       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/install" beforeDir="false" afterPath="$PROJECT_DIR$/install" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/cls_mth_fc.py" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/wg_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_main.py" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/cls_mth_fc.py" beforeDir="false" afterPath="$PROJECT_DIR$/cls_mth_fc.py" afterDir="false" /> | ||||
|     </list> | ||||
|     <option name="SHOW_DIALOG" value="false" /> | ||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||
| @@ -56,25 +44,25 @@ | ||||
|     <option name="hideEmptyMiddlePackages" value="true" /> | ||||
|     <option name="showLibraryContents" value="true" /> | ||||
|   </component> | ||||
|   <component name="PropertiesComponent"><![CDATA[{ | ||||
|   "keyToString": { | ||||
|     "ASKED_ADD_EXTERNAL_FILES": "true", | ||||
|     "Python.INSTALL.executor": "Run", | ||||
|     "Python.install.executor": "Run", | ||||
|     "Python.main.executor": "Run", | ||||
|     "Python.messagebox.executor": "Run", | ||||
|     "Python.start_wg.executor": "Run", | ||||
|     "Python.testtheme.executor": "Run", | ||||
|     "Python.wg_func.executor": "Run", | ||||
|     "Python.wg_main.executor": "Run", | ||||
|     "RunOnceActivity.ShowReadmeOnStart": "true", | ||||
|     "Shell Script.install.executor": "Run", | ||||
|     "Shell Script.run_as.executor": "Run", | ||||
|     "git-widget-placeholder": "1.11.0824", | ||||
|     "last_opened_file_path": "/home/punix/Pyapps/wire-py/lx-icons", | ||||
|     "settings.editor.selected.configurable": "reference.settingsdialog.IDE.editor.colors" | ||||
|   <component name="PropertiesComponent">{ | ||||
|   "keyToString": { | ||||
|     "ASKED_ADD_EXTERNAL_FILES": "true", | ||||
|     "Python.INSTALL.executor": "Run", | ||||
|     "Python.install.executor": "Run", | ||||
|     "Python.main.executor": "Run", | ||||
|     "Python.messagebox.executor": "Run", | ||||
|     "Python.start_wg.executor": "Run", | ||||
|     "Python.testtheme.executor": "Run", | ||||
|     "Python.wg_func.executor": "Run", | ||||
|     "Python.wg_main.executor": "Run", | ||||
|     "RunOnceActivity.ShowReadmeOnStart": "true", | ||||
|     "Shell Script.install.executor": "Run", | ||||
|     "Shell Script.run_as.executor": "Run", | ||||
|     "git-widget-placeholder": "1.11.1024", | ||||
|     "last_opened_file_path": "/home/punix/Pyapps/wire-py", | ||||
|     "settings.editor.selected.configurable": "reference.settingsdialog.IDE.editor.colors" | ||||
|   } | ||||
| }]]></component> | ||||
| }</component> | ||||
|   <component name="RecentsManager"> | ||||
|     <key name="CopyFile.RECENT_KEYS"> | ||||
|       <recent name="$PROJECT_DIR$/lx-icons" /> | ||||
| @@ -154,78 +142,6 @@ | ||||
|       <option name="presentableId" value="Default" /> | ||||
|       <updated>1723279982210</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00020" summary="columnconfigure on all widgets set"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1724778892233</created> | ||||
|       <option name="number" value="00020" /> | ||||
|       <option name="presentableId" value="LOCAL-00020" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1724778892233</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00021" summary="little fixes a " " to ' '"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725119445803</created> | ||||
|       <option name="number" value="00021" /> | ||||
|       <option name="presentableId" value="LOCAL-00021" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725119445803</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00022" summary="add class FileHandle,
add Label to show autoconnect Tunnel
disable checkbox when Listbox is empty or no select Tunnel"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725391658456</created> | ||||
|       <option name="number" value="00022" /> | ||||
|       <option name="presentableId" value="LOCAL-00022" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725391658456</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00023" summary="add if question and add autoconnect, autoconnect_var to class Filehandle in box_set no finish!"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725434328731</created> | ||||
|       <option name="number" value="00023" /> | ||||
|       <option name="presentableId" value="LOCAL-00023" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725434328731</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00024" summary="fixes on empty Listbox now is disable and now works autoconnect label with read and write, delete works now with read and write"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725475967338</created> | ||||
|       <option name="number" value="00024" /> | ||||
|       <option name="presentableId" value="LOCAL-00024" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725475967338</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00025" summary="add Frame widget 3
for Buttons and Listbox with Scrollbar.
all Widgets new format
delete works now of disable checkbox when Listbox empty (part two)"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725567453540</created> | ||||
|       <option name="number" value="00025" /> | ||||
|       <option name="presentableId" value="LOCAL-00025" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725567453540</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00026" summary="little fixes"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725639633873</created> | ||||
|       <option name="number" value="00026" /> | ||||
|       <option name="presentableId" value="LOCAL-00026" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725639633873</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00027" summary="little fixes"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725746027132</created> | ||||
|       <option name="number" value="00027" /> | ||||
|       <option name="presentableId" value="LOCAL-00027" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725746027132</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00028" summary="little fixes replace os.system with check_call
first steps in install Script add wg_start.service file"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725820337669</created> | ||||
|       <option name="number" value="00028" /> | ||||
|       <option name="presentableId" value="LOCAL-00028" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1725820337669</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00029" summary="little fixes a labels when stop and start, installer first functions works"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1725991610908</created> | ||||
| @@ -546,7 +462,79 @@ | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731098372497</updated> | ||||
|     </task> | ||||
|     <option name="localTasksCounter" value="69" /> | ||||
|     <task id="LOCAL-00069" summary=" - - Fix Checkbutton Autostart when first install Wire-Py"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731690583059</created> | ||||
|       <option name="number" value="00069" /> | ||||
|       <option name="presentableId" value="LOCAL-00069" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731690583060</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00070" summary=" - - Fix Checkbutton Autostart when first install Wire-Py"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731836942211</created> | ||||
|       <option name="number" value="00070" /> | ||||
|       <option name="presentableId" value="LOCAL-00070" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731836942212</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00071" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731840048762</created> | ||||
|       <option name="number" value="00071" /> | ||||
|       <option name="presentableId" value="LOCAL-00071" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731840048763</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00072" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731840089956</created> | ||||
|       <option name="number" value="00072" /> | ||||
|       <option name="presentableId" value="LOCAL-00072" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731840089956</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00073" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731840188277</created> | ||||
|       <option name="number" value="00073" /> | ||||
|       <option name="presentableId" value="LOCAL-00073" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731840188278</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00074" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731840383592</created> | ||||
|       <option name="number" value="00074" /> | ||||
|       <option name="presentableId" value="LOCAL-00074" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731840383592</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00075" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731841930614</created> | ||||
|       <option name="number" value="00075" /> | ||||
|       <option name="presentableId" value="LOCAL-00075" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731841930615</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00076" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731844213239</created> | ||||
|       <option name="number" value="00076" /> | ||||
|       <option name="presentableId" value="LOCAL-00076" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731844213239</updated> | ||||
|     </task> | ||||
|     <task id="LOCAL-00077" summary=" - Update Translate Files"> | ||||
|       <option name="closed" value="true" /> | ||||
|       <created>1731844339039</created> | ||||
|       <option name="number" value="00077" /> | ||||
|       <option name="presentableId" value="LOCAL-00077" /> | ||||
|       <option name="project" value="LOCAL" /> | ||||
|       <updated>1731844339039</updated> | ||||
|     </task> | ||||
|     <option name="localTasksCounter" value="78" /> | ||||
|     <servers /> | ||||
|   </component> | ||||
|   <component name="UnknownFeatures"> | ||||
| @@ -577,8 +565,6 @@ | ||||
|   </component> | ||||
|   <component name="VcsManagerConfiguration"> | ||||
|     <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> | ||||
|     <MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" /> | ||||
|     <MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" /> | ||||
|     <MESSAGE value="replace tar with zip and Check if Zip file is empty" /> | ||||
|     <MESSAGE value="Create your own message boxes for export" /> | ||||
|     <MESSAGE value="chown Export File to 1000:1000" /> | ||||
| @@ -602,15 +588,17 @@ | ||||
|     <MESSAGE value="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip" /> | ||||
|     <MESSAGE value="- Optimize Class and Tooltip" /> | ||||
|     <MESSAGE value="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError" /> | ||||
|     <option name="LAST_COMMIT_MESSAGE" value="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change
- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets
- add new Frame for Widgets on Bottom
- optimize from tkinter * to from tkinter import filedialog, ttk, TclError" /> | ||||
|     <MESSAGE value=" - - Fix Checkbutton Autostart when first install Wire-Py" /> | ||||
|     <MESSAGE value=" - Update Translate Files" /> | ||||
|     <option name="LAST_COMMIT_MESSAGE" value=" - Update Translate Files" /> | ||||
|   </component> | ||||
|   <component name="XDebuggerManager"> | ||||
|     <breakpoint-manager> | ||||
|       <breakpoints> | ||||
|         <line-breakpoint enabled="true" suspend="THREAD" type="python-line"> | ||||
|           <url>file://$PROJECT_DIR$/start_wg.py</url> | ||||
|           <line>1</line> | ||||
|           <option name="timeStamp" value="2" /> | ||||
|           <url>file://$PROJECT_DIR$/wg_main.py</url> | ||||
|           <line>1128</line> | ||||
|           <option name="timeStamp" value="3" /> | ||||
|         </line-breakpoint> | ||||
|       </breakpoints> | ||||
|     </breakpoint-manager> | ||||
|   | ||||
							
								
								
									
										26
									
								
								Changelog
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								Changelog
									
									
									
									
									
								
							| @@ -6,13 +6,29 @@ My standard System: Linux Mint 22 Cinnamon | ||||
|  - os import in cls_mth_fc.py replaced by other methods | ||||
|  - If Wire-Py already runs, prevent further start | ||||
|  - for loops with lists replaced by List Comprehensions | ||||
|  - Update search after start of Wire-Py | ||||
|  - Crypt and Decrypt Config Files in ~/.config/wire_py | ||||
|  | ||||
|    ### Added | ||||
| 03-03-2025 | ||||
|  | ||||
|  - Fixes a new user files create | ||||
|  | ||||
|  | ||||
|   ### Added | ||||
| 07-11-2024 | ||||
| 02-03-2025 | ||||
|  | ||||
| - remove classes and add methods to class FrameWidgets (removed self errors) | ||||
|  - Fix ipv6 in Config File on import | ||||
|  - Wirepy run now as user | ||||
|  - settings, keys and Config Files now in ~/.config/wire_py | ||||
|  - For new users, the required files are created and autostart service is started.  | ||||
|  - Tunnels are now read from the directory to view them in the list.  | ||||
|    To display only own tunnels, and read errors are minimized. | ||||
|  | ||||
|   ### Added | ||||
| 10-11-2024 | ||||
|  | ||||
|  - Fix Checkbutton Autostart when first install Wire-Py | ||||
|  - Update Translate Files | ||||
|  | ||||
|   ### Added | ||||
| 10-11-2024 | ||||
| @@ -56,7 +72,7 @@ My standard System: Linux Mint 22 Cinnamon | ||||
|   ### Added | ||||
| 27-10-2024 | ||||
|  | ||||
|  - Add Autoconnect settings to settings.conf | ||||
|  - Add Autoconnect settings to settings | ||||
|  | ||||
|  | ||||
|   ### Added | ||||
| @@ -64,7 +80,7 @@ My standard System: Linux Mint 22 Cinnamon | ||||
|  | ||||
|  - Add run_as Bash script and open_gitea.py python script | ||||
|  - Add Tooltip disable/enable | ||||
|  - Rename settings to settings.conf for theme, updates and tooltip enable in one file | ||||
|  - Rename settings to settings for theme, updates and tooltip enable in one file | ||||
|  | ||||
|  | ||||
|   ### Added | ||||
|   | ||||
							
								
								
									
										2
									
								
								Wire-Py.desktop
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										2
									
								
								Wire-Py.desktop
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @@ -1,7 +1,7 @@ | ||||
| [Desktop Entry] | ||||
| Type=Application | ||||
| Name=Wire-Py | ||||
| Exec=/usr/bin/wirepy.py | ||||
| Exec=/usr/local/bin/wg_main.py | ||||
| Terminal=false | ||||
| Categories=Network; | ||||
| Icon=/usr/share/icons/wp-icons/128/wg_vpn.png | ||||
							
								
								
									
										
											BIN
										
									
								
								__pycache__/cls_mth_fc.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								__pycache__/cls_mth_fc.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								__pycache__/message.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								__pycache__/message.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								__pycache__/start_wg.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								__pycache__/start_wg.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								__pycache__/wg_main.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								__pycache__/wg_main.cpython-312.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										127
									
								
								cls_mth_fc.py
									
									
									
									
									
								
							
							
						
						
									
										127
									
								
								cls_mth_fc.py
									
									
									
									
									
								
							| @@ -4,6 +4,7 @@ import gettext | ||||
| import locale | ||||
| import os | ||||
| import shutil | ||||
| from subprocess import check_call | ||||
| import subprocess | ||||
| import tkinter as tk | ||||
| import zipfile | ||||
| @@ -12,15 +13,106 @@ from pathlib import Path | ||||
| from tkinter import ttk | ||||
| import requests | ||||
|  | ||||
| APP = 'cls_mth_fc' | ||||
|  | ||||
| APP = 'wirepy' | ||||
| LOCALE_DIR = "/usr/share/locale/" | ||||
| locale.bindtextdomain(APP, LOCALE_DIR) | ||||
| gettext.bindtextdomain(APP, LOCALE_DIR) | ||||
| gettext.textdomain(APP) | ||||
| _ = gettext.gettext | ||||
|  | ||||
| wg_set = Path('/etc/wire_py/settings.conf') | ||||
| _u = Path.read_text(Path('/tmp/_u')) | ||||
| wg_set = Path(Path.home() / '.config/wire_py/settings')   | ||||
|  | ||||
| class Create(): | ||||
|     """ | ||||
|     This class is for the creation of the folders and files | ||||
|     required by Wire-Py, as well as for decryption | ||||
|     the tunnel from the user's home directory  | ||||
|     """ | ||||
|  | ||||
|     @staticmethod     | ||||
|     def dir_and_files(): | ||||
|  | ||||
|         pth = Path.home() / '.config/wire_py' | ||||
|         pth.mkdir(parents=True, exist_ok=True) | ||||
|         sett = Path.home() / '.config/wire_py/settings' | ||||
|         ks = Path.home() / '.config/wire_py/keys' | ||||
|  | ||||
|         if sett.exists(): | ||||
|             pass | ||||
|  | ||||
|         else: | ||||
|             sett.touch() | ||||
|             sett.write_text('[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff\n') | ||||
|  | ||||
|         if ks.exists(): | ||||
|             pass | ||||
|  | ||||
|         else: | ||||
|             ks.touch() | ||||
|  | ||||
|     @staticmethod | ||||
|     def files_for_autostart(): | ||||
|  | ||||
|         pth2 = Path.home() / '.config/systemd/user' | ||||
|         pth2.mkdir(parents=True, exist_ok=True) | ||||
|         wg_ser = Path.home() / '.config/systemd/user/wg_start.service' | ||||
|  | ||||
|         if wg_ser.exists(): | ||||
|             pass | ||||
|  | ||||
|         else: | ||||
|             wg_ser.touch() | ||||
|             wg_ser.write_text('[Unit]\nDescription=Automatic Tunnel Start\nAfter=network-online.target' | ||||
|                               '\n\n[Service]\nType=oneshot\nExecStartPre=/bin/sleep 5\nExecStart=/usr/' | ||||
|                               'local/bin/start_wg.py\n[Install]\nWantedBy=default.target') | ||||
|             check_call(['systemctl', '--user', 'enable', 'wg_start.service']) | ||||
|  | ||||
|     @staticmethod | ||||
|     def make_dir(): | ||||
|         ''' Dirname "tlecdewg" = Tunnel Encrypt Decrypt Wireguard ''' | ||||
|  | ||||
|         dirname = Path('/tmp/tlecdcwg/') | ||||
|         if dirname.exists(): | ||||
|             pass | ||||
|         else: | ||||
|             dirname.mkdir() | ||||
|  | ||||
|     @staticmethod | ||||
|     def decrypt(): | ||||
|         process = subprocess.run(['pkexec', '/usr/local/bin/ssl_decrypt.py'], stdout=subprocess.PIPE, text=True) | ||||
|         #print(process.stdout) | ||||
|         if process.returncode == 0: | ||||
|             print('File successfully decrypted...') | ||||
|         else: | ||||
|             print(f'Error with the following code... {process.returncode}') | ||||
|              | ||||
|     @staticmethod | ||||
|     def encrypt(): | ||||
|         process = subprocess.run(['pkexec', '/usr/local/bin/ssl_encrypt.py'], stdout=subprocess.PIPE, text=True) | ||||
|         print(process.stdout) | ||||
|         if process.returncode == 0: | ||||
|             print('All Files successfully encrypted...') | ||||
|         else: | ||||
|             print(f'Error with the following code... {process.returncode}')       | ||||
|          | ||||
| class UOS: | ||||
|     """  | ||||
|     The class is only for unixoidal systems "UOS" = UnixOS | ||||
|      | ||||
|     """ | ||||
|      | ||||
|     """  | ||||
|     This method displays the user name of the logged-in user,  | ||||
|     even if you are rooted in a shell | ||||
|     """ | ||||
|     @staticmethod | ||||
|     def username(): | ||||
|         logname = str(Path.home())[6:] | ||||
|         file = Path.home() / '/tmp/.loguser' | ||||
|         with open(file, "w") as f: | ||||
|             f.write(logname) | ||||
|  | ||||
|  | ||||
|  | ||||
| class GiteaUpdate: | ||||
| @@ -53,10 +145,10 @@ class GiteaUpdate: | ||||
|     @staticmethod | ||||
|     def download(urld, down_ok_image, down_not_ok_image, res): | ||||
|         try: | ||||
|             to_down = 'wget -qP ' + str(_u) + ' ' + urld | ||||
|             to_down = 'wget -qP ' + str(Path.home()) + ' ' + urld | ||||
|             result = subprocess.call(to_down, shell=True) | ||||
|             if result == 0: | ||||
|                 shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000) | ||||
|                 shutil.chown(str(Path.home()) + f'/{res}.zip', 1000, 1000) | ||||
|                 """img_w, img_i, w_title, w_txt hand over""" | ||||
|                 iw = r'/usr/share/icons/lx-icons/64/info.png' | ||||
|                 ii = down_ok_image | ||||
| @@ -145,6 +237,8 @@ class Tunnel: | ||||
|         for items in dictlist: | ||||
|             if items == '=': | ||||
|                 dictlist.remove(items) | ||||
|             if items == '::/0': | ||||
|                 dictlist.remove(items)     | ||||
|  | ||||
|         ''' Here is the beginning (Loop) of convert List to Dictionary ''' | ||||
|         for _ in dictlist: | ||||
| @@ -189,15 +283,16 @@ class Tunnel: | ||||
|         return active | ||||
|  | ||||
|     """ | ||||
|     Shows all existing Wireguard tunnels | ||||
|     Shows all existing Wireguard tunnels a login user | ||||
|     """ | ||||
|     @staticmethod | ||||
|     def list(): | ||||
|         wg_s = os.popen('nmcli con show | grep -iPo "(.*)(wireguard)"').read().split() | ||||
|          | ||||
|         ''' tl = Tunnel list # Show of 4.Element in list ''' | ||||
|         tl = wg_s[::3] | ||||
|         return tl | ||||
|         dirname = Path('/tmp/tlecdcwg/') | ||||
|         wg_s = os.listdir(dirname) | ||||
|  | ||||
|         return wg_s | ||||
|  | ||||
|  | ||||
|     """ | ||||
|     This will export the tunnels. | ||||
| @@ -206,21 +301,17 @@ class Tunnel: | ||||
|     """ | ||||
|     @staticmethod | ||||
|     def export(): | ||||
|         _u1 = str(_u[6:]) | ||||
|         now_time = datetime.now() | ||||
|         now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M') | ||||
|         tl = Tunnel.list() | ||||
|  | ||||
|         try: | ||||
|             if len(tl) != 0: | ||||
|                 wg_tar = str(_u) + '/' + now_datetime | ||||
|                 shutil.copytree('/etc/wire_py', '/tmp/wire_py', dirs_exist_ok=True) | ||||
|                 wg_tar = str(Path.home()) + '/' + now_datetime | ||||
|                 shutil.copytree('/tmp/tlecdcwg/', '/tmp/wire_py', dirs_exist_ok=True) | ||||
|                 source = Path('/tmp/wire_py') | ||||
|                 Path.unlink(Path(source) / 'wg_py', missing_ok=True) | ||||
|                 Path.unlink(Path(source) / '.keys', missing_ok=True) | ||||
|                 Path.unlink(Path(source) / 'settings.conf', missing_ok=True) | ||||
|                 shutil.make_archive(wg_tar, 'zip', source) | ||||
|                 shutil.chown(wg_tar + '.zip', 1000, 1000) | ||||
|                 #shutil.chown(wg_tar + '.zip', 1000, 1000) | ||||
|                 shutil.rmtree(source) | ||||
|                 with zipfile.ZipFile((wg_tar + '.zip'), 'r') as zf: | ||||
|                     if len(zf.namelist()) != 0: | ||||
| @@ -268,5 +359,3 @@ class Tipi: | ||||
|             else: | ||||
|                 return True | ||||
|  | ||||
|  | ||||
| wg_tips = Tipi.if_tip(wg_set) | ||||
|   | ||||
							
								
								
									
										34
									
								
								install
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								install
									
									
									
									
									
								
							| @@ -6,30 +6,30 @@ BLUE='\033[30;1;34m' | ||||
|  | ||||
| install_file_with(){ | ||||
|   clear | ||||
|   mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \ | ||||
|   mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \ | ||||
|   systemctl --user enable wg_start.service | ||||
|   sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/ && \ | ||||
|   sudo apt install python3-tk && \ | ||||
|   sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ | ||||
|   sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \ | ||||
|   sudo cp -fv wg_main.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \ | ||||
|   sudo cp -uR wp-icons lx-icons /usr/share/icons/ &&  sudo cp -uR TK-Themes /usr/share/ && \ | ||||
|   sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ | ||||
|   sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ | ||||
|   sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ | ||||
|   sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ | ||||
|   sudo cp -u Wire-Py.desktop /usr/share/applications/ && \ | ||||
|   sudo cp -u wg_start.service /lib/systemd/system/ && \ | ||||
|   sudo systemctl enable wg_start.service | ||||
|   sudo ln -sf /usr/local/bin/wg_main.py /usr/local/bin/wirepy && \ | ||||
|   sudo cp -f Wire-Py.desktop /usr/share/applications/  | ||||
|   } | ||||
|  | ||||
| install_arch_d(){ | ||||
|   clear | ||||
|   sudo pacman -S --noconfirm tk python3 python-requests && \ | ||||
|   sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ | ||||
|   sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf  /etc/wire_py/ && \ | ||||
|   sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \ | ||||
|   sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && sudo cp -u settings  /etc/wire_py/ && \ | ||||
|   sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ | ||||
|   sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ | ||||
|   sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ | ||||
|   sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ | ||||
|   sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ | ||||
|   sudo cp -u Wire-Py.desktop /usr/share/applications/ && \ | ||||
|   sudo cp -u org.sslcrypt.policy /usr/share/polkit-1/actions/ && \ | ||||
|   sudo cp -u wg_start.service /lib/systemd/system/ && \ | ||||
|   sudo systemctl enable wg_start.service | ||||
|   } | ||||
| @@ -91,9 +91,9 @@ elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1 | ||||
|         if ! which python3-tkinter &> /dev/null | ||||
|             then sudo dnf install python3-tkinter -y | ||||
|  | ||||
|                 sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ | ||||
|                 sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \ | ||||
|                 sudo cp -u settings.conf /etc/wire_py/ && \ | ||||
|                 sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \ | ||||
|                 sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && \ | ||||
|                 sudo cp -u settings /etc/wire_py/ && \ | ||||
|                 sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ | ||||
|                 sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ | ||||
|                 sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ | ||||
| @@ -108,9 +108,9 @@ elif grep -i 'suse' /etc/os-release > /dev/null 2>&1 | ||||
|     then | ||||
|         if ! which python311-tk &> /dev/null | ||||
|             then sudo zypper install python311-tk | ||||
|                  sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \ | ||||
|                  sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \ | ||||
|                  sudo cp -u settings.conf /etc/wire_py/ && \ | ||||
|                  sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \ | ||||
|                  sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && \ | ||||
|                  sudo cp -u settings /etc/wire_py/ && \ | ||||
|                  sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \ | ||||
|                  sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ | ||||
|                  sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ | ||||
| @@ -128,7 +128,7 @@ else | ||||
|     clear | ||||
|     exit 0 | ||||
| fi | ||||
| clear | ||||
| #clear | ||||
| read -n 1 -s -r -p $"To close the Window press a button" | ||||
| clear | ||||
|  | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1,5 +0,0 @@ | ||||
| #!/usr/bin/python3 | ||||
|  | ||||
| import webbrowser | ||||
|  | ||||
| webbrowser.open('https://git.ilunix.de/punix/Wire-Py') | ||||
							
								
								
									
										42
									
								
								org.sslcrypt.policy
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								org.sslcrypt.policy
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> | ||||
|  | ||||
| <!-- | ||||
| Policy definitions for ssl_encrypt and ssl_decrypt | ||||
|  | ||||
| Copyright (C) 2025 Désiré Werner Menrath <polunga40@unity-mail.de> | ||||
|  | ||||
| This library is free software; you can redistribute it and/or | ||||
| modify it under the terms of the GNU Lesser General Public | ||||
| License as published by the Free Software Foundation; either | ||||
| version 2.1 of the License, or (at your option) any later version. | ||||
|  | ||||
| This library is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
| Lesser General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU Lesser General Public | ||||
| License along with this library.  If not, see | ||||
| <http://www.gnu.org/licenses/>. | ||||
| --> | ||||
|  | ||||
| <policyconfig> | ||||
|   <action id="org.ssl_encrypt"> | ||||
|     <defaults> | ||||
|       <allow_any>auth_admin_keep</allow_any> | ||||
|       <allow_active>yes</allow_active> | ||||
|     </defaults> | ||||
|     <annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/ssl_encrypt.py</annotate> | ||||
|   </action> | ||||
|  | ||||
|   <action id="org.ssl_decrypt"> | ||||
|     <defaults> | ||||
|       <allow_any>auth_admin_keep</allow_any> | ||||
|       <allow_inactive>auth_admin_keep</allow_inactive> | ||||
|       <allow_active>yes</allow_active> | ||||
|     </defaults> | ||||
|     <annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/ssl_decrypt.py</annotate> | ||||
|      | ||||
|   </action> | ||||
| </policyconfig> | ||||
| @@ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> | ||||
| <policyconfig> | ||||
|   <vendor>Project Wire-Py</vendor> | ||||
|   <vendor_url>https://git.ilunix.de/punix/Wire-Py</vendor_url> | ||||
|   <icon_name>wg-vpn</icon_name> | ||||
|   <action id="org.wirepy"> | ||||
|     <defaults> | ||||
|       <allow_any>auth_admin_keep</allow_any> | ||||
|       <allow_inactive>auth_admin_keep</allow_inactive> | ||||
|       <allow_active>yes</allow_active> | ||||
|     </defaults> | ||||
|     <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/wg_main.py</annotate> | ||||
|     <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate> | ||||
|   </action> | ||||
| </policyconfig> | ||||
							
								
								
									
										28
									
								
								ssl_decrypt.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								ssl_decrypt.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #!/usr/bin/python3 | ||||
| ''' This Script decrypt Wireguardfiles for Wirepy users ''' | ||||
|  | ||||
| import os | ||||
| from subprocess import check_call | ||||
| from pathlib import Path | ||||
| import shutil | ||||
| uname = Path('/tmp/.loguser') | ||||
|  | ||||
| with open(uname, 'r') as f: | ||||
|     logname = f.readline() | ||||
|      | ||||
| ''' Dirname "tlecdewg" = Tunnel Encrypt Decrypt Wireguard ''' | ||||
| dirname = Path('/tmp/tlecdcwg/') | ||||
| keyfile = '/usr/local/etc/ssl/pwgk.pem' | ||||
|  | ||||
| dirname2 = ('/home/' + logname + '/.config/wire_py/') | ||||
| detl = os.listdir(dirname2) | ||||
| os.chdir(dirname2) | ||||
| detl.remove('keys') | ||||
| detl.remove('settings') | ||||
| if os.path.exists(dirname2 + 'pbwgk.pem'): | ||||
|     detl.remove('pbwgk.pem') | ||||
|     for detunnels in detl: | ||||
|         tlname2 = detunnels[:-4] + '.conf' | ||||
|         extpath = str(dirname) + '/' + tlname2 | ||||
|         check_call(['openssl', 'pkeyutl', '-decrypt', '-inkey', keyfile, '-in', detunnels, '-out', extpath]) | ||||
|         shutil.chown(extpath, 1000, 1000) | ||||
							
								
								
									
										49
									
								
								ssl_encrypt.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										49
									
								
								ssl_encrypt.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| #!/usr/bin/python3 | ||||
| ''' This Script encrypt Wireguardfiles for Wirepy users for more Security''' | ||||
|  | ||||
| import os | ||||
| from subprocess import check_call | ||||
| from pathlib import Path | ||||
| import shutil | ||||
|  | ||||
| uname = Path('/tmp/.loguser') | ||||
|  | ||||
| with open(uname, 'r') as f: | ||||
|     logname = f.readline() | ||||
|  | ||||
| keyfile = Path(f'/home/{logname}/.config/wire_py/pbwgk.pem') | ||||
| dirname = Path('/tmp/tlecdcwg/') | ||||
| pkeyfile = '/usr/local/etc/ssl/pwgk.pem' | ||||
|  | ||||
| if not keyfile.is_file(): | ||||
|      | ||||
|     check_call(['openssl', 'rsa', '-in', pkeyfile, '-out', keyfile, '-outform', 'PEM', '-pubout'])         | ||||
|     shutil.chown(keyfile, 1000, 1000) | ||||
|      | ||||
|     if dirname.exists(): | ||||
|         tl = os.listdir(str(dirname)) | ||||
|         cpth = str(keyfile) | ||||
|         cryptfiles = cpth[:-9] | ||||
|  | ||||
|         if keyfile.exists() and len(tl) != 0: | ||||
|             for tunnels in tl: | ||||
|                 sourcetl = str(dirname) + '/' + tunnels | ||||
|                 tlname = cryptfiles + tunnels[:-5] + '.dat' | ||||
|                 check_call(['openssl', 'pkeyutl', '-encrypt', '-inkey', keyfile, '-pubin', '-in', sourcetl, '-out', tlname]) | ||||
|  | ||||
| else: | ||||
|  | ||||
|     if dirname.exists(): | ||||
|         tl = os.listdir(str(dirname)) | ||||
|         cpth = str(keyfile) | ||||
|         cryptfiles = cpth[:-9] | ||||
|  | ||||
|         if keyfile.exists() and len(tl) != 0: | ||||
|             for tunnels in tl: | ||||
|                 sourcetl = str(dirname) + '/' + tunnels | ||||
|                 tlname = cryptfiles + tunnels[:-5] + '.dat' | ||||
|                 check_call(['openssl', 'pkeyutl', '-encrypt', '-inkey', keyfile, '-pubin', '-in', sourcetl, '-out', tlname]) | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -2,7 +2,7 @@ | ||||
| from subprocess import check_call | ||||
| from pathlib import Path | ||||
|  | ||||
| path_to_file = Path('/etc/wire_py/settings.conf') | ||||
| path_to_file = Path(Path.home() / '.config/wire_py/settings') | ||||
|  | ||||
| with open(path_to_file, 'r') as a_con: | ||||
|     lines = a_con.readlines() | ||||
|   | ||||
							
								
								
									
										117
									
								
								wg_main.py
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								wg_main.py
									
									
									
									
									
								
							| @@ -2,19 +2,30 @@ | ||||
|  | ||||
| import gettext | ||||
| import locale | ||||
| import webbrowser | ||||
| import os | ||||
| import shutil | ||||
| import sys | ||||
| import signal | ||||
| import subprocess | ||||
| import shutil | ||||
| import tkinter as tk | ||||
| from pathlib import Path | ||||
| from subprocess import check_call | ||||
| from tkinter import filedialog, ttk, TclError | ||||
| from cls_mth_fc import (Tunnel, msg_window, GiteaUpdate, _u, wg_tips, wg_set) | ||||
| from cls_mth_fc import (Tunnel, Create, msg_window, Tipi, GiteaUpdate, UOS) | ||||
|  | ||||
| UOS.username() | ||||
| Create.dir_and_files() | ||||
| Create.make_dir() | ||||
| Create.decrypt() | ||||
|  | ||||
| tcl_path = Path('/usr/share/TK-Themes') | ||||
| wg_set = Path(Path.home() / '.config/wire_py/settings') | ||||
| wg_tips = Tipi.if_tip(wg_set) | ||||
| dirname = Path('/tmp/tlecdcwg/') | ||||
|  | ||||
| ''' 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year ''' | ||||
| version = 'v. 1.11.1024' | ||||
| version = 'v. 2.03.0325' | ||||
|  | ||||
| res = GiteaUpdate.api_down('https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases', version) | ||||
|  | ||||
| @@ -26,7 +37,31 @@ gettext.bindtextdomain(APP, LOCALE_DIR) | ||||
| gettext.textdomain(APP) | ||||
| _ = gettext.gettext | ||||
|  | ||||
| def signalHandler(signum, frame): | ||||
|     ''' Determine clear text names for signal numbers ''' | ||||
|     SIGNALS_TO_NAMES_DICT = dict((getattr(signal, n), n) \ | ||||
|         for n in dir(signal) if n.startswith('SIG') and '_' not in n ) | ||||
|     signame = SIGNALS_TO_NAMES_DICT.get(signum, "Unnamed signal: %d" % signum) | ||||
|   | ||||
|     ''' | ||||
|     End program for certain signals, | ||||
|     report to others only reception | ||||
|     ''' | ||||
|     if signum in (signal.SIGINT, signal.SIGTERM): | ||||
|         exitCode = 1 | ||||
|         print("\nSignal '%s' (%d) received. => Aborting with exit code %d." % (signame, signum, exitCode)) | ||||
|         shutil.rmtree(dirname) | ||||
|         Path.unlink('/tmp/.loguser') | ||||
|         print('Breakdown by user...') | ||||
|         sys.exit(exitCode) | ||||
|     else: | ||||
|         print("Signal %d received and ignored." % signum) | ||||
|         shutil.rmtree(dirname) | ||||
|         Path.unlink('/tmp/.loguser') | ||||
|         print('Process unexpectedly ended...')  | ||||
| signal.signal(signal.SIGINT,  signalHandler) | ||||
| signal.signal(signal.SIGTERM, signalHandler) | ||||
| signal.signal(signal.SIGHUP,  signalHandler) | ||||
| class MainWindow(tk.Tk): | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
| @@ -141,9 +176,7 @@ class FrameWidgets(ttk.Frame): | ||||
|  | ||||
|         def info(): | ||||
|             def link_btn(): | ||||
|                 _u1 = str(_u[6:]) | ||||
|                 path_to_file = Path('/usr/bin/./run_as') | ||||
|                 check_call(['su', _u1, path_to_file]) | ||||
|                 webbrowser.open('https://git.ilunix.de/punix/Wire-Py') | ||||
|  | ||||
|             """img_w, img_i, w_title, w_txt , txt2, com hand over""" | ||||
|             iw = r'/usr/share/icons/wp-icons/48/wg_vpn.png' | ||||
| @@ -332,7 +365,7 @@ class FrameWidgets(ttk.Frame): | ||||
|         ''' Listbox with Scrollbar ''' | ||||
|  | ||||
|         def enable_check_box(_): | ||||
|  | ||||
|             Create.files_for_autostart()     | ||||
|             if self.l_box.size() != 0: | ||||
|                 self.wg_autostart.configure(state='normal') | ||||
|                 self.lb_rename.config(state='normal') | ||||
| @@ -349,9 +382,10 @@ class FrameWidgets(ttk.Frame): | ||||
|         self.l_box.configure(yscrollcommand=self.scrollbar.set) | ||||
|  | ||||
|         ''' Tunnel List ''' | ||||
|          | ||||
|         self.tl = Tunnel.list() | ||||
|         for tunnels in self.tl: | ||||
|             self.l_box.insert("end", tunnels) | ||||
|             self.l_box.insert("end", tunnels[:-5]) | ||||
|             self.l_box.update() | ||||
|  | ||||
|         def list_empty_enter(event): | ||||
| @@ -382,7 +416,7 @@ class FrameWidgets(ttk.Frame): | ||||
|         ''' Button Vpn ''' | ||||
|         if self.a != '': | ||||
|             self.stop() | ||||
|             wg_read = Path('/etc/wire_py') / str(self.a + '.conf') | ||||
|             wg_read = '/tmp/tlecdcwg/' + str(self.a + '.conf') | ||||
|             with open(wg_read, 'r') as file: | ||||
|                 data = Tunnel.con_to_dict(file) | ||||
|  | ||||
| @@ -420,28 +454,30 @@ class FrameWidgets(ttk.Frame): | ||||
|             try: | ||||
|                 self.select_tunnel = self.l_box.curselection() | ||||
|                 select_tl = self.l_box.get(self.select_tunnel[0]) | ||||
|                 with open('/etc/wire_py/' + select_tl + '.conf', 'r+') as file2: | ||||
|                 with open('/tmp/tlecdcwg/' + select_tl + '.conf', 'r+') as file2: | ||||
|                     key = Tunnel.con_to_dict(file2) | ||||
|                     pre_key = key[3] | ||||
|                 check_call(['nmcli', 'connection', 'delete', select_tl]) | ||||
|                 self.l_box.delete(self.select_tunnel[0]) | ||||
|                 with open(wg_set, 'r') as set_file6: | ||||
|                     lines6 = set_file6.readlines() | ||||
|                     if select_tl == lines6[7].strip() and 'off' not in lines6[7].strip(): | ||||
|                         lines6[7] = 'off' | ||||
|                     if select_tl == lines6[7].strip() and 'off\n' not in lines6[7].strip(): | ||||
|                         lines6[7] = 'off\n' | ||||
|                         with open(wg_set, 'w') as set_file7: | ||||
|                             set_file7.writelines(lines6) | ||||
|                         self.selected_option.set(0) | ||||
|                         self.autoconnect_var.set(_('no Autoconnect')) | ||||
|  | ||||
|                 Path.unlink(Path('/etc/wire_py') / str(select_tl + '.conf')) | ||||
|                 with open('/etc/wire_py/.keys', 'r') as readfile: | ||||
|                     with open('/etc/wire_py/.keys2', 'w') as writefile: | ||||
|                 is_encrypt =  Path.home() / '.config/wire_py' / str(select_tl + '.dat')       | ||||
|                 if is_encrypt.is_file(): | ||||
|                     Path.unlink(str(Path.home()) + '/.config/wire_py/' + str(select_tl + '.dat')) | ||||
|                 Path.unlink(Path('/tmp/tlecdcwg') / str(select_tl + '.conf')) | ||||
|                 with open(str(Path.home()) + '/.config/wire_py/keys', 'r') as readfile: | ||||
|                     with open(str(Path.home()) +  '/.config/wire_py/keys2', 'w') as writefile: | ||||
|                         for line in readfile: | ||||
|                             if pre_key not in line.strip("\n"): | ||||
|                                 writefile.write(line) | ||||
|                 file_one = Path('/etc/wire_py/.keys2') | ||||
|                 file_two = file_one.with_name('.keys') | ||||
|                 file_one = Path(str(Path.home()) +  '/.config/wire_py/keys2') | ||||
|                 file_two = file_one.with_name('keys') | ||||
|                 file_one.replace(file_two) | ||||
|                 self.wg_autostart.configure(state='disabled') | ||||
|  | ||||
| @@ -636,9 +672,10 @@ class FrameWidgets(ttk.Frame): | ||||
|  | ||||
|                     ''' nmcli connection modify old connection.id iphone ''' | ||||
|                     check_call(['nmcli', 'connection', 'modify', select_tl, 'connection.id', self.lb_rename.get()]) | ||||
|                     source = Path('/etc/wire_py') / str(select_tl + '.conf') | ||||
|                     source = Path('/tmp/tlecdcwg') / str(select_tl + '.conf') | ||||
|                     destination = source.with_name(str(self.lb_rename.get() + '.conf')) | ||||
|                     source.replace(destination) | ||||
|                     Path.unlink(str(Path.home()) + '/.config/wire_py/' + str(select_tl + '.dat')) | ||||
|                     self.l_box.delete(self.select_tunnel[0]) | ||||
|                     self.l_box.insert("end", self.lb_rename.get()) | ||||
|                     self.l_box.update() | ||||
| @@ -649,12 +686,14 @@ class FrameWidgets(ttk.Frame): | ||||
|                         self.StrVar.set(value=self.a) | ||||
|                         with open(wg_set, 'r') as set_file5: | ||||
|                             lines5 = set_file5.readlines() | ||||
|                         if select_tl == lines5[7].strip() and 'off' not in lines5[7].strip(): | ||||
|                         if select_tl == lines5[7].strip() and 'off\n' not in lines5[7].strip(): | ||||
|                             lines5[7] = new_a_connect | ||||
|                             with open(wg_set, 'w') as theme_set5: | ||||
|                                 theme_set5.writelines(lines5) | ||||
|                             self.autoconnect_var.set(value=new_a_connect) | ||||
|                  | ||||
|                     Create.encrypt() | ||||
|  | ||||
|                     return select_tl | ||||
|  | ||||
|                 except IndexError: | ||||
| @@ -738,8 +777,11 @@ class FrameWidgets(ttk.Frame): | ||||
|         If True then the name is automatically shortened to 12 characters and then imported. | ||||
|         If in each case false comes out, a corresponding window comes to inform the user that something is wrong. | ||||
|         """ | ||||
|  | ||||
|         Create.dir_and_files() | ||||
|  | ||||
|         try: | ||||
|             filepath = filedialog.askopenfilename(initialdir=str(_u), title=_('Select Wireguard config File'), | ||||
|             filepath = filedialog.askopenfilename(initialdir=str(Path.home()), title=_('Select Wireguard config File'), | ||||
|                                                   filetypes=[(_('WG config files'), '*.conf')], ) | ||||
|  | ||||
|             with open(filepath, 'r') as file: | ||||
| @@ -753,7 +795,7 @@ class FrameWidgets(ttk.Frame): | ||||
|                     key = Tunnel.con_to_dict(file) | ||||
|                     pre_key = key[3] | ||||
|                     if len(pre_key) != 0: | ||||
|                         with open('/etc/wire_py/.keys', 'r') as readfile: | ||||
|                         with open(str(Path.home()) + '/.config/wire_py/keys', 'r') as readfile: | ||||
|                             p_key = readfile.readlines() | ||||
|                             if pre_key in p_key or pre_key + '\n' in p_key: | ||||
|                                 """img_w, img_i, w_title, w_txt hand over""" | ||||
| @@ -765,13 +807,13 @@ class FrameWidgets(ttk.Frame): | ||||
|  | ||||
|                             else: | ||||
|  | ||||
|                                 with open('/etc/wire_py/.keys', 'a') as keyfile: | ||||
|                                 with open(str(Path.home()) +  '/.config/wire_py/keys', 'a') as keyfile: | ||||
|                                     keyfile.write(pre_key + '\r') | ||||
|                                     if len(path_split1) > 17: | ||||
|                                         p1 = shutil.copy(filepath, Path('/etc/wire_py/')) | ||||
|                                         p1 = shutil.copy(filepath, '/tmp/tlecdcwg/') | ||||
|                                         path_split = path_split1[len(path_split1) - 17:] | ||||
|                                         os.rename(p1, Path('/etc/wire_py') / str(path_split)) | ||||
|                                         new_conf = '/etc/wire_py/' + path_split | ||||
|                                         os.rename(p1, '/tmp/tlecdcwg/' + str(path_split)) | ||||
|                                         new_conf = '/tmp/tlecdcwg/' + path_split | ||||
|                                         if self.a != '': | ||||
|                                             check_call(['nmcli', 'connection', 'down', Tunnel.active()]) | ||||
|                                             self.label_empty() | ||||
| @@ -779,8 +821,10 @@ class FrameWidgets(ttk.Frame): | ||||
|                                         subprocess.check_output(['nmcli', 'connection', 'import', 'type', | ||||
|                                                                  'wireguard', 'file', new_conf], text=True) | ||||
|  | ||||
|                                         Create.encrypt()                         | ||||
|  | ||||
|                                     else: | ||||
|                                         shutil.copy(filepath, Path('/etc/wire_py/')) | ||||
|                                         shutil.copy(filepath, '/tmp/tlecdcwg/') | ||||
|                                         if self.a != '': | ||||
|                                             check_call(['nmcli', 'connection', 'down', Tunnel.active()]) | ||||
|                                             self.label_empty() | ||||
| @@ -788,6 +832,8 @@ class FrameWidgets(ttk.Frame): | ||||
|                                         subprocess.check_output(['nmcli', 'connection', 'import', 'type', | ||||
|                                                                  'wireguard', 'file', filepath], text=True) | ||||
|  | ||||
|                                         Create.encrypt() | ||||
|  | ||||
|                                     self.StrVar.set('') | ||||
|                                     self.a = Tunnel.active() | ||||
|                                     self.l_box.insert(0, self.a) | ||||
| @@ -865,7 +911,7 @@ class FrameWidgets(ttk.Frame): | ||||
|                                     self.StrVar.set(self.a) | ||||
|                                     self.color_label() | ||||
|                                     self.stop() | ||||
|                                     wg_read = Path('/etc/wire_py') / str(self.a + '.conf') | ||||
|                                     wg_read = '/tmp/tlecdcwg/' + str(self.a + '.conf') | ||||
|                                     with open(wg_read, 'r') as file_for_key: | ||||
|                                         data = Tunnel.con_to_dict(file_for_key) | ||||
|  | ||||
| @@ -906,7 +952,7 @@ class FrameWidgets(ttk.Frame): | ||||
|             if self.selected_option.get() == 0: | ||||
|                 with open(wg_set, 'r') as set_file3: | ||||
|                     lines3 = set_file3.readlines() | ||||
|                     lines3[7] = 'off' | ||||
|                     lines3[7] = 'off\n' | ||||
|                 with open(wg_set, 'w') as set_file3: | ||||
|                     set_file3.writelines(lines3) | ||||
|  | ||||
| @@ -936,15 +982,16 @@ class FrameWidgets(ttk.Frame): | ||||
|         with open(wg_set, 'r') as set_file4: | ||||
|             lines4 = set_file4.readlines() | ||||
|  | ||||
|         if lines4[7] != 'off': | ||||
|         if lines4[7] != 'off\n': | ||||
|             print(lines4[7]) | ||||
|             self.selected_option.set(1) | ||||
|             self.autoconnect_var.set('') | ||||
|             self.auto_con = lines4[7] | ||||
|  | ||||
|         else: | ||||
|  | ||||
|             self.wg_autostart.configure(state='disabled') | ||||
|             self.selected_option.set(0) | ||||
|             self.auto_con = _('no Autoconnect') | ||||
|  | ||||
|         self.autoconnect_var.set('') | ||||
|         self.autoconnect_var = tk.StringVar() | ||||
|         self.autoconnect_var.set(self.auto_con) | ||||
| @@ -1060,7 +1107,7 @@ class FrameWidgets(ttk.Frame): | ||||
|                 self.select_tunnel = self.l_box.curselection() | ||||
|                 select_tl = self.l_box.get(self.select_tunnel[0]) | ||||
|                 check_call(['nmcli', 'connection', 'up', select_tl]) | ||||
|                 wg_read = Path('/etc/wire_py') / str(select_tl + '.conf') | ||||
|                 wg_read = '/tmp/tlecdcwg/' + str(select_tl + '.conf') | ||||
|                 with open(wg_read, 'r') as file: | ||||
|                     data = Tunnel.con_to_dict(file) | ||||
|  | ||||
| @@ -1158,3 +1205,7 @@ if __name__ == '__main__': | ||||
|     window.tk.call('set', '::tk::dialog::file::showHiddenBtn', '0') | ||||
|     window.tk.call('set', '::tk::dialog::file::showHiddenVar', '0') | ||||
|     window.mainloop() | ||||
|  | ||||
| shutil.rmtree(dirname) | ||||
| Path.unlink('/tmp/.loguser') | ||||
| sys.exit(0) | ||||
| @@ -5,6 +5,6 @@ After=network-online.target | ||||
| [Service] | ||||
| Type=oneshot | ||||
| ExecStartPre=/bin/sleep 5 | ||||
| ExecStart=/usr/bin/start_wg.py | ||||
| ExecStart=/usr/local/bin/start_wg.py | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| WantedBy=default.target | ||||
|   | ||||
		Reference in New Issue
	
	Block a user