04-06-2025_large_update #35
@@ -62,6 +62,7 @@ class Create:
 | 
				
			|||||||
            text=True,
 | 
					            text=True,
 | 
				
			||||||
            check=False,
 | 
					            check=False,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Output from Openssl Error
 | 
					        # Output from Openssl Error
 | 
				
			||||||
        if process.stderr:
 | 
					        if process.stderr:
 | 
				
			||||||
            print(process.stderr)
 | 
					            print(process.stderr)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,7 @@ License along with this library.  If not, see
 | 
				
			|||||||
  <action id="org.ssl_encrypt">
 | 
					  <action id="org.ssl_encrypt">
 | 
				
			||||||
    <defaults>
 | 
					    <defaults>
 | 
				
			||||||
      <allow_any>auth_admin_keep</allow_any>
 | 
					      <allow_any>auth_admin_keep</allow_any>
 | 
				
			||||||
 | 
					      <allow_inactive>auth_admin_keep</allow_inactive>
 | 
				
			||||||
      <allow_active>yes</allow_active>
 | 
					      <allow_active>yes</allow_active>
 | 
				
			||||||
    </defaults>
 | 
					    </defaults>
 | 
				
			||||||
    <annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/ssl_encrypt.py</annotate>
 | 
					    <annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/ssl_encrypt.py</annotate>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ from subprocess import CompletedProcess
 | 
				
			|||||||
import subprocess
 | 
					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().strip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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")
 | 
					path_of_crypted_tunnel: Path = Path(f"/home/{log_name}/.config/wire_py")
 | 
				
			||||||
@@ -60,7 +60,7 @@ if AppConfig.PUBLICKEY.exists:
 | 
				
			|||||||
            text=True,
 | 
					            text=True,
 | 
				
			||||||
            check=False,
 | 
					            check=False,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        shutil.chown(f"{AppConfig.TEMP_DIR}/{base_name}.conf", 1000, 1000)
 | 
				
			||||||
        print(f"Processing of the file: {tunnel_path}")
 | 
					        print(f"Processing of the file: {tunnel_path}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if process.stdout:
 | 
					        if process.stdout:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,17 @@
 | 
				
			|||||||
#!/usr/bin/python3
 | 
					#!/usr/bin/python3
 | 
				
			||||||
""" This Script encrypt Wireguardfiles for Wirepy users for more Security """
 | 
					""" This Script encrypt Wireguardfiles for Wirepy users for more Security """
 | 
				
			||||||
 | 
					 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
from subprocess import CompletedProcess
 | 
					from subprocess import CompletedProcess
 | 
				
			||||||
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().strip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
keyfile: Path = Path(f"/home/{log_name}/.config/wire_py/pbwgk.pem")
 | 
					keyfile: Path = Path(f"/home/{log_name}/.config/wire_py/pbwgk.pem")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target: Path = Path(f"/home/{log_name}/.config/wire_py/")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if not keyfile.is_file():
 | 
					if not keyfile.is_file():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    process: CompletedProcess[str] = subprocess.run(
 | 
					    process: CompletedProcess[str] = subprocess.run(
 | 
				
			||||||
@@ -44,8 +45,9 @@ if not keyfile.is_file():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    shutil.chown(keyfile, 1000, 1000)
 | 
					    shutil.chown(keyfile, 1000, 1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if AppConfig.TEMP_DIR.exists() and not any(AppConfig.TEMP_DIR.iterdir()):
 | 
					# any() get True when directory is not empty
 | 
				
			||||||
        clear_files = [str(file) for file in path_of_crypted_tunnel.glob()]
 | 
					if AppConfig.TEMP_DIR.exists() and any(AppConfig.TEMP_DIR.iterdir()):
 | 
				
			||||||
 | 
					    clear_files = [str(file) for file in AppConfig.TEMP_DIR.glob("*.conf")]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for config_file in clear_files:
 | 
					    for config_file in clear_files:
 | 
				
			||||||
        base_name = Path(config_file).stem
 | 
					        base_name = Path(config_file).stem
 | 
				
			||||||
@@ -60,7 +62,7 @@ if not keyfile.is_file():
 | 
				
			|||||||
                "-in",
 | 
					                "-in",
 | 
				
			||||||
                config_file,
 | 
					                config_file,
 | 
				
			||||||
                "-out",
 | 
					                "-out",
 | 
				
			||||||
                    f"{AppConfig.CONFIG_DIR}/{base_name}.dat",
 | 
					                f"{target}/{base_name}.dat",
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            capture_output=True,
 | 
					            capture_output=True,
 | 
				
			||||||
            text=True,
 | 
					            text=True,
 | 
				
			||||||
@@ -69,9 +71,6 @@ if not keyfile.is_file():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        print(f"Processing of the file: {config_file}")
 | 
					        print(f"Processing of the file: {config_file}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if process.stdout:
 | 
					 | 
				
			||||||
                print(process.stdout)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Output from Openssl Error
 | 
					        # Output from Openssl Error
 | 
				
			||||||
        if process.stderr:
 | 
					        if process.stderr:
 | 
				
			||||||
            print("(Error):", process.stderr)
 | 
					            print("(Error):", process.stderr)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -713,6 +713,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                                ],
 | 
					                                ],
 | 
				
			||||||
                                text=True,
 | 
					                                text=True,
 | 
				
			||||||
                            )
 | 
					                            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            Create.encrypt()
 | 
					                            Create.encrypt()
 | 
				
			||||||
                        else:
 | 
					                        else:
 | 
				
			||||||
                            shutil.copy(filepath, f"{AppConfig.TEMP_DIR}/")
 | 
					                            shutil.copy(filepath, f"{AppConfig.TEMP_DIR}/")
 | 
				
			||||||
@@ -735,8 +736,8 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                                ],
 | 
					                                ],
 | 
				
			||||||
                                text=True,
 | 
					                                text=True,
 | 
				
			||||||
                            )
 | 
					                            )
 | 
				
			||||||
                            Create.encrypt()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            Create.encrypt()
 | 
				
			||||||
                        self.str_var.set("")
 | 
					                        self.str_var.set("")
 | 
				
			||||||
                        self.a = Tunnel.active()
 | 
					                        self.a = Tunnel.active()
 | 
				
			||||||
                        self.l_box.insert(0, self.a)
 | 
					                        self.l_box.insert(0, self.a)
 | 
				
			||||||
@@ -774,6 +775,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                                "no",
 | 
					                                "no",
 | 
				
			||||||
                            ]
 | 
					                            ]
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            elif ("PrivateKey = " in read) and ("Endpoint = " in read):
 | 
					            elif ("PrivateKey = " in read) and ("Endpoint = " in read):
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user