Compare commits
	
		
			1 Commits
		
	
	
		
			2.06.1425
			...
			09-05-2025
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 6051ad1546 | 
							
								
								
									
										21
									
								
								Changelog
									
									
									
									
									
								
							
							
						
						@@ -6,25 +6,12 @@ My standard System: Linux Mint 22 Cinnamon
 | 
			
		||||
 - os import in common_tools.py replaced by other methods
 | 
			
		||||
 - If Wire-Py already runs, prevent further start
 | 
			
		||||
 - for loops with lists replaced by List Comprehensions
 | 
			
		||||
 - Tunnel in tk.canvas for modern look
 | 
			
		||||
 - Replace Download Button with Lx Tools installer
 | 
			
		||||
 | 
			
		||||
   ### Added
 | 
			
		||||
14-06-2025
 | 
			
		||||
 | 
			
		||||
 - replace msg_window with MassageDialog
 | 
			
		||||
 - vpn stop icon corrected
 | 
			
		||||
 | 
			
		||||
   ### Added
 | 
			
		||||
07-06-2025
 | 
			
		||||
 | 
			
		||||
 - ssl_decrypt now directly checks whether encrypted files are located in the specified directory. 
 | 
			
		||||
 - This method has been removed from common_tools. The path has been adjusted ssl_decrypt likely 
 | 
			
		||||
   had an incorrect path. No files were decrypted. This has been fixed. 
 | 
			
		||||
 - Key generation has been removed from ssl_decrypt, as it is only needed in ssl_encrypt.
 | 
			
		||||
 - Logviewer now in the settings menu. Moduls now as libs in share_libs.
 | 
			
		||||
 - The Lx Tools installer is there to ensure that everything required for the selected app is installed.
 | 
			
		||||
04-06-2025
 | 
			
		||||
 | 
			
		||||
 - large update in the module were outsourced and can now be used as
 | 
			
		||||
   dependencies to wirepy us other apps from git.ilunix.de
 | 
			
		||||
 | 
			
		||||
   ### Added
 | 
			
		||||
13-04-20255
 | 
			
		||||
@@ -64,14 +51,12 @@ My standard System: Linux Mint 22 Cinnamon
 | 
			
		||||
 - 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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 15 KiB  | 
| 
		 Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 5.7 KiB  | 
| 
		 Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.7 KiB  | 
| 
		 Before Width: | Height: | Size: 7.0 KiB  | 
| 
		 Before Width: | Height: | Size: 3.5 KiB  | 
| 
		 Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 15 KiB  | 
| 
		 Before Width: | Height: | Size: 40 KiB  | 
| 
		 Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 10 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 6.2 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 24 KiB  | 
| 
		 Before Width: | Height: | Size: 1.9 KiB  | 
| 
		 Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 5.1 KiB  | 
| 
		 Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.6 KiB  | 
| 
		 Before Width: | Height: | Size: 1.5 KiB  | 
| 
		 Before Width: | Height: | Size: 838 B  | 
| 
		 Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 6.1 KiB  | 
| 
		 Before Width: | Height: | Size: 5.8 KiB  | 
| 
		 Before Width: | Height: | Size: 3.5 KiB  | 
| 
		 Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 5.7 KiB  | 
| 
		 Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.2 KiB  | 
| 
		 Before Width: | Height: | Size: 2.3 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 7.1 KiB  | 
| 
		 Before Width: | Height: | Size: 5.3 KiB  | 
| 
		 Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 3.1 KiB  | 
| 
		 Before Width: | Height: | Size: 1.6 KiB  | 
| 
		 Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 8.7 KiB  | 
@@ -5,32 +5,53 @@ from pathlib import Path
 | 
			
		||||
import pwd
 | 
			
		||||
import shutil
 | 
			
		||||
from subprocess import CompletedProcess, run
 | 
			
		||||
from shared_libs.wp_app_config import AppConfig
 | 
			
		||||
from shared_libs.common_tools import LxTools
 | 
			
		||||
from shared_libs.message import MessageDialog
 | 
			
		||||
 | 
			
		||||
from shared_libs.wp_app_config import AppConfig, logging
 | 
			
		||||
 | 
			
		||||
parser = argparse.ArgumentParser()
 | 
			
		||||
parser.add_argument("--user", required=True, help="Username of the target file system")
 | 
			
		||||
args = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
_ = AppConfig.setup_translations()
 | 
			
		||||
try:
 | 
			
		||||
    # Retrieve UID and GID
 | 
			
		||||
    user_info = pwd.getpwnam(args.user)
 | 
			
		||||
    uid = user_info.pw_uid  # User ID (e.g., 1000)
 | 
			
		||||
    gid = user_info.pw_gid  # Group ID (e.g., 1000)
 | 
			
		||||
except KeyError:
 | 
			
		||||
    MessageDialog("error", _(f"User '{args.user}' not found."), title="Error decrypt")
 | 
			
		||||
 | 
			
		||||
    logging.error(f"User '{args.user}' not found.", exc_info=True)
 | 
			
		||||
    exit(1)
 | 
			
		||||
 | 
			
		||||
crypted_tunnel: Path = Path(f"/home/{args.user}/.config/wire_py")
 | 
			
		||||
keyfile: Path = Path(f"/home/{args.user}/.config/wire_py/pbwgk.pem")
 | 
			
		||||
path_of_crypted_tunnel: Path = Path(f"/home/{args.user}/.config/wire_py")
 | 
			
		||||
 | 
			
		||||
if len([str(file) for file in crypted_tunnel.glob("*.dat")]) == 0:
 | 
			
		||||
    pass
 | 
			
		||||
else:
 | 
			
		||||
    crypted__tunnel = [str(file) for file in crypted_tunnel.glob("*.dat")]
 | 
			
		||||
if not keyfile.is_file():
 | 
			
		||||
    process: CompletedProcess[str] = run(
 | 
			
		||||
        [
 | 
			
		||||
            "openssl",
 | 
			
		||||
            "rsa",
 | 
			
		||||
            "-in",
 | 
			
		||||
            AppConfig.SYSTEM_PATHS["pkey_path"],
 | 
			
		||||
            "-out",
 | 
			
		||||
            keyfile,
 | 
			
		||||
            "-outform",
 | 
			
		||||
            "PEM",
 | 
			
		||||
            "-pubout",
 | 
			
		||||
        ],
 | 
			
		||||
        capture_output=True,
 | 
			
		||||
        text=True,
 | 
			
		||||
        check=False,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    if process.returncode == 0:
 | 
			
		||||
        logging.info("Public key generated successfully.", exc_info=True)
 | 
			
		||||
    else:
 | 
			
		||||
        logging.error(
 | 
			
		||||
            f"Error with the following code... {process.returncode}", exc_info=True
 | 
			
		||||
        )
 | 
			
		||||
    shutil.chown(keyfile, uid, gid)
 | 
			
		||||
 | 
			
		||||
if AppConfig.PUBLICKEY.exists():
 | 
			
		||||
 | 
			
		||||
    crypted__tunnel = [str(file) for file in path_of_crypted_tunnel.glob("*.dat")]
 | 
			
		||||
 | 
			
		||||
    for tunnel_path in crypted__tunnel:
 | 
			
		||||
 | 
			
		||||
@@ -53,13 +74,11 @@ else:
 | 
			
		||||
            check=False,
 | 
			
		||||
        )
 | 
			
		||||
        shutil.chown(f"{AppConfig.TEMP_DIR}/{base_name}.conf", uid, gid)
 | 
			
		||||
        logging.info(f"Processing of the file: {tunnel_path}", exc_info=True)
 | 
			
		||||
 | 
			
		||||
        # Output from Openssl Error
 | 
			
		||||
        if process.stderr:
 | 
			
		||||
            MessageDialog(
 | 
			
		||||
                "erro",
 | 
			
		||||
                _(
 | 
			
		||||
                    f"{process.stderr} Error by [{tunnel_path}] Code: {process.returncode}"
 | 
			
		||||
                ),
 | 
			
		||||
                title="Error decrypt",
 | 
			
		||||
            logging.error(
 | 
			
		||||
                f"{process.stderr} Error by [{tunnel_path}] Code: {process.returncode}",
 | 
			
		||||
                exc_info=True,
 | 
			
		||||
            )
 | 
			
		||||
 
 | 
			
		||||
@@ -2,19 +2,16 @@
 | 
			
		||||
""" This Script encrypt Wireguardfiles for Wirepy users for more Security """
 | 
			
		||||
 | 
			
		||||
import argparse
 | 
			
		||||
import logging
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
import pwd
 | 
			
		||||
import shutil
 | 
			
		||||
from subprocess import CompletedProcess, run
 | 
			
		||||
from shared_libs.wp_app_config import AppConfig
 | 
			
		||||
from shared_libs.common_tools import LogConfig
 | 
			
		||||
from shared_libs.wp_app_config import AppConfig, logging
 | 
			
		||||
 | 
			
		||||
parser = argparse.ArgumentParser()
 | 
			
		||||
parser.add_argument("--user", required=True, help="Username of the target file system")
 | 
			
		||||
args = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
LogConfig.logger(f"/home/{args.user}/.local/share/lxlogs/wirepy.log")
 | 
			
		||||
try:
 | 
			
		||||
    # Retrieve UID and GID
 | 
			
		||||
    user_info = pwd.getpwnam(args.user)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								tunnel.py
									
									
									
									
									
								
							
							
						
						@@ -9,7 +9,6 @@ from subprocess import run, CompletedProcess
 | 
			
		||||
import secrets
 | 
			
		||||
from shared_libs.wp_app_config import AppConfig, Msg
 | 
			
		||||
from shared_libs.common_tools import LxTools, CryptoUtil
 | 
			
		||||
from shared_libs.message import MessageDialog
 | 
			
		||||
 | 
			
		||||
# Translate
 | 
			
		||||
_ = AppConfig.setup_translations()
 | 
			
		||||
@@ -173,8 +172,12 @@ class Tunnel:
 | 
			
		||||
            CryptoUtil.decrypt(getpass.getuser())
 | 
			
		||||
            if len([file.name for file in AppConfig.TEMP_DIR.glob("*.conf")]) == 0:
 | 
			
		||||
 | 
			
		||||
                MessageDialog("info", Msg.STR["tl_first"], title=Msg.STR["sel_tl"])
 | 
			
		||||
 | 
			
		||||
                LxTools.msg_window(
 | 
			
		||||
                    AppConfig.IMAGE_PATHS["icon_info"],
 | 
			
		||||
                    AppConfig.IMAGE_PATHS["icon_msg"],
 | 
			
		||||
                    Msg.STR["sel_tl"],
 | 
			
		||||
                    Msg.STR["tl_first"],
 | 
			
		||||
                )
 | 
			
		||||
                return False
 | 
			
		||||
            else:
 | 
			
		||||
                wg_tar: str = f"{AppConfig.BASE_DIR}/{now_datetime}"
 | 
			
		||||
@@ -183,20 +186,22 @@ class Tunnel:
 | 
			
		||||
                    with zipfile.ZipFile(f"{wg_tar}.zip", "r") as zf:
 | 
			
		||||
                        if zf.namelist():
 | 
			
		||||
 | 
			
		||||
                            MessageDialog(
 | 
			
		||||
                                "info",
 | 
			
		||||
                            LxTools.msg_window(
 | 
			
		||||
                                AppConfig.IMAGE_PATHS["icon_info"],
 | 
			
		||||
                                AppConfig.IMAGE_PATHS["icon_vpn"],
 | 
			
		||||
                                Msg.STR["exp_succ"],
 | 
			
		||||
                                Msg.STR["exp_in_home"],
 | 
			
		||||
                                title=Msg.STR["exp_succ"],
 | 
			
		||||
                            )
 | 
			
		||||
 | 
			
		||||
                        else:
 | 
			
		||||
                            logging.error(
 | 
			
		||||
                                "There was a mistake at creating the Zip file. File is empty."
 | 
			
		||||
                            )
 | 
			
		||||
                            MessageDialog(
 | 
			
		||||
                                "error", Msg.STR["exp_zip"], title=Msg.STR["exp_err"]
 | 
			
		||||
                            LxTools.msg_window(
 | 
			
		||||
                                AppConfig.IMAGE_PATHS["icon_error"],
 | 
			
		||||
                                AppConfig.IMAGE_PATHS["icon_msg"],
 | 
			
		||||
                                Msg.STR["exp_err"],
 | 
			
		||||
                                Msg.STR["exp_zip"],
 | 
			
		||||
                            )
 | 
			
		||||
 | 
			
		||||
                            return False
 | 
			
		||||
                        return True
 | 
			
		||||
                except PermissionError:
 | 
			
		||||
@@ -212,7 +217,12 @@ class Tunnel:
 | 
			
		||||
            pass
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            logging.error(f"Export failed: {str(e)}")
 | 
			
		||||
            MessageDialog("error", Msg.STR["exp_try"], title=Msg.STR["exp_err"])
 | 
			
		||||
            LxTools.msg_window(
 | 
			
		||||
                AppConfig.IMAGE_PATHS["icon_error"],
 | 
			
		||||
                AppConfig.IMAGE_PATHS["icon_msg"],
 | 
			
		||||
                Msg.STR["exp_err"],
 | 
			
		||||
                Msg.STR["exp_try"],
 | 
			
		||||
            )
 | 
			
		||||
            return False
 | 
			
		||||
 | 
			
		||||
        finally:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								wirepy.py
									
									
									
									
									
								
							
							
						
						@@ -8,12 +8,11 @@ import shutil
 | 
			
		||||
import sys
 | 
			
		||||
import tkinter as tk
 | 
			
		||||
import webbrowser
 | 
			
		||||
from functools import partial
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
from subprocess import CompletedProcess, run
 | 
			
		||||
from tkinter import TclError, filedialog, ttk
 | 
			
		||||
from tunnel import Tunnel
 | 
			
		||||
from shared_libs.message import MessageDialog
 | 
			
		||||
 | 
			
		||||
from shared_libs.gitea import GiteaUpdate
 | 
			
		||||
from shared_libs.common_tools import (
 | 
			
		||||
    LxTools,
 | 
			
		||||
@@ -463,6 +462,10 @@ class FrameWidgets(ttk.Frame):
 | 
			
		||||
        """
 | 
			
		||||
        a tk.Toplevel window
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
        def link_btn() -> None:
 | 
			
		||||
            webbrowser.open("https://git.ilunix.de/punix/Wire-Py")
 | 
			
		||||
 | 
			
		||||
        msg_t = _(
 | 
			
		||||
            "Wire-Py a simple Wireguard Gui for Linux systems.\n\n"
 | 
			
		||||
            "Wire-Py is open source software written in Python.\n\n"
 | 
			
		||||
@@ -470,17 +473,13 @@ class FrameWidgets(ttk.Frame):
 | 
			
		||||
            "Use without warranty!\n"
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        MessageDialog(
 | 
			
		||||
            "info",
 | 
			
		||||
        LxTools.msg_window(
 | 
			
		||||
            AppConfig.IMAGE_PATHS["icon_vpn"],
 | 
			
		||||
            AppConfig.IMAGE_PATHS["icon_vpn"],
 | 
			
		||||
            _("Info"),
 | 
			
		||||
            msg_t,
 | 
			
		||||
            buttons=["OK", _("Go to Wire-Py git")],
 | 
			
		||||
            title=_("Info"),
 | 
			
		||||
            commands=[
 | 
			
		||||
                None,
 | 
			
		||||
                partial(webbrowser.open, "https://git.ilunix.de/punix/Wire-Py"),
 | 
			
		||||
            ],
 | 
			
		||||
            icon=AppConfig.IMAGE_PATHS["icon_vpn"],
 | 
			
		||||
            wraplength=420,
 | 
			
		||||
            _("Go to Wire-Py git"),
 | 
			
		||||
            link_btn,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def update_setting(self, update_res) -> None:
 | 
			
		||||
@@ -849,7 +848,6 @@ class FrameWidgets(ttk.Frame):
 | 
			
		||||
            self.selected_option.set(1)
 | 
			
		||||
            self.autoconnect_var.set("")
 | 
			
		||||
            self.auto_con = ConfigManager.get("autostart")
 | 
			
		||||
            AppConfig.get_autostart_content()
 | 
			
		||||
 | 
			
		||||
        else:
 | 
			
		||||
            self.selected_option.set(0)
 | 
			
		||||
@@ -1146,9 +1144,10 @@ class FrameWidgets(ttk.Frame):
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    AppConfig.ensure_directories()
 | 
			
		||||
    AppConfig.create_default_settings()
 | 
			
		||||
    CryptoUtil.decrypt(getpass.getuser(), AppConfig.CONFIG_DIR)
 | 
			
		||||
    _ = AppConfig.setup_translations()
 | 
			
		||||
    LxTools.sigi(AppConfig.TEMP_DIR)
 | 
			
		||||
    CryptoUtil.decrypt(getpass.getuser())
 | 
			
		||||
 | 
			
		||||
    window = Wirepy()
 | 
			
		||||
    LogConfig.logger(ConfigManager.get("logfile"))
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ class AppConfig:
 | 
			
		||||
 | 
			
		||||
    # Updates
 | 
			
		||||
    # 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year
 | 
			
		||||
    VERSION: str = "v. 2.06.0725"
 | 
			
		||||
    VERSION: str = "v. 2.06.0425"
 | 
			
		||||
    UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases"
 | 
			
		||||
    DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive"
 | 
			
		||||
 | 
			
		||||
@@ -153,8 +153,6 @@ class AppConfig:
 | 
			
		||||
            text=True,
 | 
			
		||||
            check=False,
 | 
			
		||||
        )
 | 
			
		||||
        if process.returncode == 0:
 | 
			
		||||
            logging.info(process.stdout, exc_info=True)
 | 
			
		||||
 | 
			
		||||
        if process.stderr:
 | 
			
		||||
            logging.error(f"{process.stderr} Code: {process.returncode}", exc_info=True)
 | 
			
		||||
 
 | 
			
		||||