04-06-2025_large_update #35
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,6 @@
 | 
				
			|||||||
debug.log
 | 
					debug.log
 | 
				
			||||||
.venv
 | 
					.venv
 | 
				
			||||||
 | 
					.venv.bak
 | 
				
			||||||
.idea
 | 
					.idea
 | 
				
			||||||
.vscode
 | 
					.vscode
 | 
				
			||||||
__pycache__
 | 
					__pycache__
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -90,20 +90,23 @@ class Create:
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        process: CompletedProcess[str] = subprocess.run(
 | 
					        process: CompletedProcess[str] = subprocess.run(
 | 
				
			||||||
            ["pkexec", "/usr/local/bin/ssl_decrypt.py"],
 | 
					            ["pkexec", "/usr/local/bin/ssl_decrypt.py"],
 | 
				
			||||||
            stdout=subprocess.PIPE,
 | 
					            capture_output=True,
 | 
				
			||||||
            text=True,
 | 
					            text=True,
 | 
				
			||||||
            check=True,
 | 
					            check=False,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        path: Path = Path.home() / ".config/wire_py/"
 | 
					 | 
				
			||||||
        file_in_path: list[Path] = list(path.rglob("*.dat"))
 | 
					 | 
				
			||||||
        if file_in_path:
 | 
					 | 
				
			||||||
            if process.returncode == 0:
 | 
					 | 
				
			||||||
                print("File successfully decrypted...")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            else:
 | 
					        # Output from Openssl
 | 
				
			||||||
                print(f"Error with the following code... {process.returncode}")
 | 
					        if process.stdout:
 | 
				
			||||||
 | 
					            print(process.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Output from Openssl Error
 | 
				
			||||||
 | 
					        if process.stderr:
 | 
				
			||||||
 | 
					            print(process.stderr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if process.returncode == 0:
 | 
				
			||||||
 | 
					            print("Datei entschlüsseln wurde erfolgreich entschlossen.")
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            print(_("Ready for import"))
 | 
					            print(f"Fehler bei der Verarbeitung von Dateien: Code {process.returncode}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def encrypt() -> str:
 | 
					    def encrypt() -> str:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,19 @@
 | 
				
			|||||||
#!/usr/bin/python3
 | 
					#!/usr/bin/python3
 | 
				
			||||||
""" This Script decrypt Wireguard files for Wirepy users """
 | 
					""" This Script decrypt Wireguard files for Wirepy users """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
import shutil
 | 
					 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
from subprocess import check_call
 | 
					import shutil
 | 
				
			||||||
 | 
					from subprocess import CompletedProcess
 | 
				
			||||||
 | 
					import subprocess
 | 
				
			||||||
from wp_app_config import AppConfig
 | 
					from wp_app_config import AppConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
log_name = AppConfig.USER_FILE.read_text()
 | 
					log_name = AppConfig.USER_FILE.read_text()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
keyfile: Path = Path(f"/home/{log_name}/.config/wire_py/pbwgk.pem")
 | 
					keyfile: Path = Path(f"/home/{log_name}/.config/wire_py/pbwgk.pem")
 | 
				
			||||||
 | 
					path_of_crypted_tunnel: Path = Path(f"/home/{log_name}/.config/wire_py")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if not keyfile.is_file():
 | 
					if not keyfile.is_file():
 | 
				
			||||||
 | 
					    process: CompletedProcess[str] = subprocess.run(
 | 
				
			||||||
    check_call(
 | 
					 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
            "openssl",
 | 
					            "openssl",
 | 
				
			||||||
            "rsa",
 | 
					            "rsa",
 | 
				
			||||||
@@ -24,21 +24,27 @@ if not keyfile.is_file():
 | 
				
			|||||||
            "-outform",
 | 
					            "-outform",
 | 
				
			||||||
            "PEM",
 | 
					            "PEM",
 | 
				
			||||||
            "-pubout",
 | 
					            "-pubout",
 | 
				
			||||||
        ]
 | 
					        ],
 | 
				
			||||||
 | 
					        capture_output=True,
 | 
				
			||||||
 | 
					        text=True,
 | 
				
			||||||
 | 
					        check=False,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					    print(process.stdout)
 | 
				
			||||||
 | 
					    if process.returncode == 0:
 | 
				
			||||||
 | 
					        print("Public key generated successfully.")
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        print(f"Error with the following code... {process.returncode}")
 | 
				
			||||||
    shutil.chown(keyfile, 1000, 1000)
 | 
					    shutil.chown(keyfile, 1000, 1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AppConfig.TEMP_DIR2 = f"/home/{log_name}/.config/wire_py/"
 | 
					if AppConfig.PUBLICKEY.exists:
 | 
				
			||||||
detl: list[str] = os.listdir(AppConfig.TEMP_DIR2)
 | 
					
 | 
				
			||||||
os.chdir(AppConfig.TEMP_DIR2)
 | 
					    crypted__tunnel = [str(file) for file in path_of_crypted_tunnel.glob("*.dat")]
 | 
				
			||||||
detl.remove("keys")
 | 
					
 | 
				
			||||||
detl.remove("settings")
 | 
					    for tunnel_path in crypted__tunnel:
 | 
				
			||||||
if os.path.exists(f"{AppConfig.TEMP_DIR2}pbwgk.pem"):
 | 
					
 | 
				
			||||||
    detl.remove("pbwgk.pem")
 | 
					        base_name = Path(tunnel_path).stem
 | 
				
			||||||
    for detunnels in detl:
 | 
					
 | 
				
			||||||
        tlname2 = f"{detunnels[:-4]}.conf"
 | 
					        process: CompletedProcess[str] = subprocess.run(
 | 
				
			||||||
        extpath = f"{AppConfig.TEMP_DIR}/{tlname2}"
 | 
					 | 
				
			||||||
        check_call(
 | 
					 | 
				
			||||||
            [
 | 
					            [
 | 
				
			||||||
                "openssl",
 | 
					                "openssl",
 | 
				
			||||||
                "pkeyutl",
 | 
					                "pkeyutl",
 | 
				
			||||||
@@ -46,9 +52,25 @@ if os.path.exists(f"{AppConfig.TEMP_DIR2}pbwgk.pem"):
 | 
				
			|||||||
                "-inkey",
 | 
					                "-inkey",
 | 
				
			||||||
                AppConfig.SYSTEM_PATHS["pkey_path"],
 | 
					                AppConfig.SYSTEM_PATHS["pkey_path"],
 | 
				
			||||||
                "-in",
 | 
					                "-in",
 | 
				
			||||||
                detunnels,
 | 
					                tunnel_path,  # full path to the file
 | 
				
			||||||
                "-out",
 | 
					                "-out",
 | 
				
			||||||
                extpath,
 | 
					                f"{AppConfig.TEMP_DIR}/{base_name}.conf",
 | 
				
			||||||
            ]
 | 
					            ],
 | 
				
			||||||
 | 
					            capture_output=True,
 | 
				
			||||||
 | 
					            text=True,
 | 
				
			||||||
 | 
					            check=False,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        shutil.chown(extpath, 1000, 1000)
 | 
					
 | 
				
			||||||
 | 
					        print(f"Processing of the file: {tunnel_path}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if process.stdout:
 | 
				
			||||||
 | 
					            print(process.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Output from Openssl Error
 | 
				
			||||||
 | 
					        if process.stderr:
 | 
				
			||||||
 | 
					            print("(Error):", process.stderr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if process.returncode == 0:
 | 
				
			||||||
 | 
					            print(f"File {base_name}.dat successfully decrypted.")
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            print(f"Error by {tunnel_path}: Code: {process.returncode}")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,8 +2,8 @@
 | 
				
			|||||||
""" This Script encrypt Wireguardfiles for Wirepy users for more Security """
 | 
					""" This Script encrypt Wireguardfiles for Wirepy users for more Security """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import shutil
 | 
					 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
 | 
					import shutil
 | 
				
			||||||
from subprocess import check_call
 | 
					from subprocess import check_call
 | 
				
			||||||
from wp_app_config import AppConfig
 | 
					from wp_app_config import AppConfig
 | 
				
			||||||
from common_tools import LxTools
 | 
					from common_tools import LxTools
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -874,7 +874,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        checkbox for enable autostart Tunnel
 | 
					        checkbox for enable autostart Tunnel
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Create.files_for_autostart()
 | 
					        AppConfig.get_autostart_content()
 | 
				
			||||||
        if self.l_box.size() != 0:
 | 
					        if self.l_box.size() != 0:
 | 
				
			||||||
            self.wg_autostart.configure(state="normal")
 | 
					            self.wg_autostart.configure(state="normal")
 | 
				
			||||||
            self.lb_rename.config(state="normal")
 | 
					            self.lb_rename.config(state="normal")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,18 +122,21 @@ class AppConfig:
 | 
				
			|||||||
        if not cls.SYSTEMD_USER_FOLDER.exists():
 | 
					        if not cls.SYSTEMD_USER_FOLDER.exists():
 | 
				
			||||||
            cls.SYSTEMD_USER_FOLDER.mkdir(parents=True, exist_ok=True)
 | 
					            cls.SYSTEMD_USER_FOLDER.mkdir(parents=True, exist_ok=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for line in SYSTEMD_FILE:
 | 
					        from subprocess import CompletedProcess
 | 
				
			||||||
            cls.AUTOSTART_SERVICE.write_text(line)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        process = subprocess.run(
 | 
					        if not cls.AUTOSTART_SERVICE.is_file():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            content = "\n".join([line for line in SYSTEMD_FILE])
 | 
				
			||||||
 | 
					            cls.AUTOSTART_SERVICE.write_text(content)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        process: CompletedProcess[str] = subprocess.run(
 | 
				
			||||||
            ["systemctl", "--user", "enable", "wg_start.service"],
 | 
					            ["systemctl", "--user", "enable", "wg_start.service"],
 | 
				
			||||||
            stdout=subprocess.PIPE,
 | 
					            capture_output=True,
 | 
				
			||||||
            text=True,
 | 
					            text=True,
 | 
				
			||||||
            check=True,
 | 
					            check=False,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        print(process.stdout)
 | 
					        print(process.stdout)
 | 
				
			||||||
        if process.returncode == 0:
 | 
					        if process.returncode == 0:
 | 
				
			||||||
            print("File for autostart created successfully")
 | 
					 | 
				
			||||||
            print(process.stdout)
 | 
					            print(process.stdout)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            print(f"Error with the following code... {process.returncode}")
 | 
					            print(f"Error with the following code... {process.returncode}")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user