04-06-2025_large_update #35
										
											Binary file not shown.
										
									
								
							@@ -111,7 +111,7 @@ class Create:
 | 
				
			|||||||
                print(f"Error with the following code... {process.returncode}")
 | 
					                print(f"Error with the following code... {process.returncode}")
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            print(_("Ready for import"))
 | 
					            print(_("Ready for import"))
 | 
				
			||||||
            
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def encrypt():
 | 
					    def encrypt():
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
@@ -138,7 +138,7 @@ def uos():
 | 
				
			|||||||
    This method displays the user name of the logged-in user,
 | 
					    This method displays the user name of the logged-in user,
 | 
				
			||||||
    even if you are rooted in a shell
 | 
					    even if you are rooted in a shell
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    logname = str(Path.home())[6:]
 | 
					    logname = f"{Path.home()}"[6:]
 | 
				
			||||||
    file = Path.home() / "/tmp/.loguser"
 | 
					    file = Path.home() / "/tmp/.loguser"
 | 
				
			||||||
    with open(file, "w", encoding="utf-8") as f:
 | 
					    with open(file, "w", encoding="utf-8") as f:
 | 
				
			||||||
        f.write(logname)
 | 
					        f.write(logname)
 | 
				
			||||||
@@ -181,10 +181,10 @@ class GiteaUpdate:
 | 
				
			|||||||
        this is for download new Version of wirepy
 | 
					        this is for download new Version of wirepy
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            to_down = "wget -qP " + str(Path.home()) + " " + urld
 | 
					            to_down = f"wget -qP {Path.home()} {" "} {urld}"
 | 
				
			||||||
            result = subprocess.call(to_down, shell=True)
 | 
					            result = subprocess.call(to_down, shell=True)
 | 
				
			||||||
            if result == 0:
 | 
					            if result == 0:
 | 
				
			||||||
                shutil.chown(str(Path.home()) + f"/{res}.zip", 1000, 1000)
 | 
					                shutil.chown(f"{Path.home()}/{res}.zip", 1000, 1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                # img_w, img_i, w_title, w_txt hand over
 | 
					                # img_w, img_i, w_title, w_txt hand over
 | 
				
			||||||
                iw = r"/usr/share/icons/lx-icons/64/info.png"
 | 
					                iw = r"/usr/share/icons/lx-icons/64/info.png"
 | 
				
			||||||
@@ -342,17 +342,17 @@ class Tunnel:
 | 
				
			|||||||
        in the user's home directory with correct right
 | 
					        in the user's home directory with correct right
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        now_time = datetime.now()
 | 
					        now_time = datetime.now()
 | 
				
			||||||
        now_datetime = now_time.strftime("wg-exp-" + "%m-%d-%Y" + "-" + "%H:%M")
 | 
					        now_datetime = now_time.strftime(f"wg-exp-%m-%d-%Y-%H:%M")
 | 
				
			||||||
        tl = Tunnel.list()
 | 
					        tl = Tunnel.list()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            if len(tl) != 0:
 | 
					            if len(tl) != 0:
 | 
				
			||||||
                wg_tar = str(Path.home()) + "/" + now_datetime
 | 
					                wg_tar = f"{Path.home()}/{now_datetime}"
 | 
				
			||||||
                shutil.copytree("/tmp/tlecdcwg/", "/tmp/wire_py", dirs_exist_ok=True)
 | 
					                shutil.copytree("/tmp/tlecdcwg/", "/tmp/wire_py", dirs_exist_ok=True)
 | 
				
			||||||
                source = Path("/tmp/wire_py")
 | 
					                source = Path("/tmp/wire_py")
 | 
				
			||||||
                shutil.make_archive(wg_tar, "zip", source)
 | 
					                shutil.make_archive(wg_tar, "zip", source)
 | 
				
			||||||
                shutil.rmtree(source)
 | 
					                shutil.rmtree(source)
 | 
				
			||||||
                with zipfile.ZipFile((wg_tar + ".zip"), "r") as zf:
 | 
					                with zipfile.ZipFile(f"{wg_tar}.zip", "r") as zf:
 | 
				
			||||||
                    if len(zf.namelist()) != 0:
 | 
					                    if len(zf.namelist()) != 0:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        # img_w, img_i, w_title, w_txt hand over
 | 
					                        # img_w, img_i, w_title, w_txt hand over
 | 
				
			||||||
@@ -461,14 +461,21 @@ class Tooltip:
 | 
				
			|||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        x, y, _, _ = self.widget.bbox("insert")
 | 
					        x, y, _, _ = self.widget.bbox("insert")
 | 
				
			||||||
        x += self.widget.winfo_rootx() + 40
 | 
					        x += self.widget.winfo_rootx() + 65
 | 
				
			||||||
        y += self.widget.winfo_rooty() + 40
 | 
					        y += self.widget.winfo_rooty() + 40
 | 
				
			||||||
        self.tooltip_window = tw = tk.Toplevel(self.widget)
 | 
					        self.tooltip_window = tw = tk.Toplevel(self.widget)
 | 
				
			||||||
        tw.wm_overrideredirect(True)
 | 
					        tw.wm_overrideredirect(True)
 | 
				
			||||||
        tw.wm_geometry(f"+{x}+{y}")
 | 
					        tw.wm_geometry(f"+{x}+{y}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        label = tk.Label(
 | 
					        label = tk.Label(
 | 
				
			||||||
            tw, text=self.text, relief="solid", borderwidth=1, padx=5, pady=5
 | 
					            tw,
 | 
				
			||||||
 | 
					            text=self.text,
 | 
				
			||||||
 | 
					            background="lightgreen",
 | 
				
			||||||
 | 
					            foreground="black",
 | 
				
			||||||
 | 
					            relief="solid",
 | 
				
			||||||
 | 
					            borderwidth=1,
 | 
				
			||||||
 | 
					            padx=5,
 | 
				
			||||||
 | 
					            pady=5,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        label.grid()
 | 
					        label.grid()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,16 +33,16 @@ if not keyfile.is_file():
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
    shutil.chown(keyfile, 1000, 1000)
 | 
					    shutil.chown(keyfile, 1000, 1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dirname2 = "/home/" + logname + "/.config/wire_py/"
 | 
					dirname2 = f"/home/{logname}/.config/wire_py/"
 | 
				
			||||||
detl = os.listdir(dirname2)
 | 
					detl = os.listdir(dirname2)
 | 
				
			||||||
os.chdir(dirname2)
 | 
					os.chdir(dirname2)
 | 
				
			||||||
detl.remove("keys")
 | 
					detl.remove("keys")
 | 
				
			||||||
detl.remove("settings")
 | 
					detl.remove("settings")
 | 
				
			||||||
if os.path.exists(dirname2 + "pbwgk.pem"):
 | 
					if os.path.exists(f"{dirname2}pbwgk.pem"):
 | 
				
			||||||
    detl.remove("pbwgk.pem")
 | 
					    detl.remove("pbwgk.pem")
 | 
				
			||||||
    for detunnels in detl:
 | 
					    for detunnels in detl:
 | 
				
			||||||
        tlname2 = detunnels[:-4] + ".conf"
 | 
					        tlname2 = f"{detunnels[:-4]}.conf"
 | 
				
			||||||
        extpath = str(dirname) + "/" + tlname2
 | 
					        extpath = f"{dirname}/{tlname2}"
 | 
				
			||||||
        check_call(
 | 
					        check_call(
 | 
				
			||||||
            [
 | 
					            [
 | 
				
			||||||
                "openssl",
 | 
					                "openssl",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,14 +33,14 @@ if not keyfile.is_file():
 | 
				
			|||||||
    shutil.chown(keyfile, 1000, 1000)
 | 
					    shutil.chown(keyfile, 1000, 1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if dirname.exists():
 | 
					    if dirname.exists():
 | 
				
			||||||
        tl = os.listdir(str(dirname))
 | 
					        tl = os.listdir(f"{dirname}")
 | 
				
			||||||
        CPTH = str(keyfile)
 | 
					        CPTH = f"{keyfile}"
 | 
				
			||||||
        CRYPTFILES = CPTH[:-9]
 | 
					        CRYPTFILES = CPTH[:-9]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if keyfile.exists() and len(tl) != 0:
 | 
					        if keyfile.exists() and len(tl) != 0:
 | 
				
			||||||
            for tunnels in tl:
 | 
					            for tunnels in tl:
 | 
				
			||||||
                sourcetl = str(dirname) + "/" + tunnels
 | 
					                sourcetl = f"{dirname}/{tunnels}"
 | 
				
			||||||
                tlname = CRYPTFILES + tunnels[:-5] + ".dat"
 | 
					                tlname = f"{CRYPTFILES}{tunnels[:-5]}.dat"
 | 
				
			||||||
                check_call(
 | 
					                check_call(
 | 
				
			||||||
                    [
 | 
					                    [
 | 
				
			||||||
                        "openssl",
 | 
					                        "openssl",
 | 
				
			||||||
@@ -59,14 +59,14 @@ if not keyfile.is_file():
 | 
				
			|||||||
else:
 | 
					else:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if dirname.exists():
 | 
					    if dirname.exists():
 | 
				
			||||||
        tl = os.listdir(str(dirname))
 | 
					        tl = os.listdir(f"{dirname}")
 | 
				
			||||||
        CPTH = str(keyfile)
 | 
					        CPTH = f"{keyfile}"
 | 
				
			||||||
        CRYPTFILES = CPTH[:-9]
 | 
					        CRYPTFILES = CPTH[:-9]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if keyfile.exists() and len(tl) != 0:
 | 
					        if keyfile.exists() and len(tl) != 0:
 | 
				
			||||||
            for tunnels in tl:
 | 
					            for tunnels in tl:
 | 
				
			||||||
                sourcetl = str(dirname) + "/" + tunnels
 | 
					                sourcetl = f"{dirname}/{tunnels}"
 | 
				
			||||||
                tlname = CRYPTFILES + tunnels[:-5] + ".dat"
 | 
					                tlname = f"{CRYPTFILES}{tunnels[:-5]}.dat"
 | 
				
			||||||
                check_call(
 | 
					                check_call(
 | 
				
			||||||
                    [
 | 
					                    [
 | 
				
			||||||
                        "openssl",
 | 
					                        "openssl",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										105
									
								
								wirepy.py
									
									
									
									
									
								
							
							
						
						
									
										105
									
								
								wirepy.py
									
									
									
									
									
								
							@@ -67,7 +67,7 @@ class Wirepy(tk.Tk):
 | 
				
			|||||||
        self.rowconfigure(0, weight=1)
 | 
					        self.rowconfigure(0, weight=1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.style = ttk.Style(self)
 | 
					        self.style = ttk.Style(self)
 | 
				
			||||||
        self.tk.call("source", str(tcl_path) + "/water.tcl")
 | 
					        self.tk.call("source", f"{tcl_path}/water.tcl")
 | 
				
			||||||
        with open(wg_set, "r", encoding="utf-8") as read_file:
 | 
					        with open(wg_set, "r", encoding="utf-8") as read_file:
 | 
				
			||||||
            lines = read_file.readlines()
 | 
					            lines = read_file.readlines()
 | 
				
			||||||
            if "light\n" in lines:
 | 
					            if "light\n" in lines:
 | 
				
			||||||
@@ -261,7 +261,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            set_update.set(value=0)
 | 
					            set_update.set(value=0)
 | 
				
			||||||
            text = f"Update {res} " + _("available!")
 | 
					            text = f"Update {res} {_("available!")}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Update BTN Menu
 | 
					            # Update BTN Menu
 | 
				
			||||||
            self.update_btn = ttk.Menubutton(self.menu_frame, text=text)
 | 
					            self.update_btn = ttk.Menubutton(self.menu_frame, text=text)
 | 
				
			||||||
@@ -303,9 +303,8 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
        # Bottom Frame 4
 | 
					        # Bottom Frame 4
 | 
				
			||||||
        self.lb_frame3 = ttk.Frame(self)
 | 
					        self.lb_frame3 = ttk.Frame(self)
 | 
				
			||||||
        self.lb_frame3.configure(relief="flat")
 | 
					        self.lb_frame3.configure(relief="flat")
 | 
				
			||||||
        self.lb_frame3.grid(
 | 
					        self.lb_frame3.grid(column=0, row=5, columnspan=4, sticky="snew", 
 | 
				
			||||||
            column=0, row=5, columnspan=4, sticky="snew", padx=2, pady=2
 | 
					            padx=2, pady=2)
 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Bottom Frame 5
 | 
					        # Bottom Frame 5
 | 
				
			||||||
        self.lb_frame4 = ttk.Frame(self)
 | 
					        self.lb_frame4 = ttk.Frame(self)
 | 
				
			||||||
@@ -364,7 +363,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
        # Button Vpn
 | 
					        # Button Vpn
 | 
				
			||||||
        if self.a != "":
 | 
					        if self.a != "":
 | 
				
			||||||
            self.stop()
 | 
					            self.stop()
 | 
				
			||||||
            wg_read = "/tmp/tlecdcwg/" + str(self.a + ".conf")
 | 
					            wg_read = f"/tmp/tlecdcwg/{self.a}.conf"
 | 
				
			||||||
            with open(wg_read, "r", encoding="utf-8") as file:
 | 
					            with open(wg_read, "r", encoding="utf-8") as file:
 | 
				
			||||||
                data = Tunnel.con_to_dict(file)
 | 
					                data = Tunnel.con_to_dict(file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -382,12 +381,8 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
            self.show_data()
 | 
					            self.show_data()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Button Import
 | 
					        # Button Import
 | 
				
			||||||
        self.btn_i = ttk.Button(
 | 
					        self.btn_i = ttk.Button(self.lb_frame_btn_lbox, image=self.imp_pic,
 | 
				
			||||||
            self.lb_frame_btn_lbox,
 | 
					            command=self.import_sl, padding=0)
 | 
				
			||||||
            image=self.imp_pic,
 | 
					 | 
				
			||||||
            command=self.import_sl,
 | 
					 | 
				
			||||||
            padding=0,
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        self.btn_i.grid(column=0, row=1, padx=15, pady=8)
 | 
					        self.btn_i.grid(column=0, row=1, padx=15, pady=8)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Tooltip(self.btn_i, _("Click to import a Wireguard Tunnel"), tips)
 | 
					        Tooltip(self.btn_i, _("Click to import a Wireguard Tunnel"), tips)
 | 
				
			||||||
@@ -399,8 +394,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
            try:
 | 
					            try:
 | 
				
			||||||
                self.select_tunnel = self.l_box.curselection()
 | 
					                self.select_tunnel = self.l_box.curselection()
 | 
				
			||||||
                select_tl = self.l_box.get(self.select_tunnel[0])
 | 
					                select_tl = self.l_box.get(self.select_tunnel[0])
 | 
				
			||||||
                with open(
 | 
					                with open(f"/tmp/tlecdcwg/{select_tl}.conf", "r+", encoding="utf-8"
 | 
				
			||||||
                    "/tmp/tlecdcwg/" + select_tl + ".conf", "r+", encoding="utf-8"
 | 
					 | 
				
			||||||
                ) as file2:
 | 
					                ) as file2:
 | 
				
			||||||
                    key = Tunnel.con_to_dict(file2)
 | 
					                    key = Tunnel.con_to_dict(file2)
 | 
				
			||||||
                    pre_key = key[3]
 | 
					                    pre_key = key[3]
 | 
				
			||||||
@@ -417,24 +411,16 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                            set_file7.writelines(lines6)
 | 
					                            set_file7.writelines(lines6)
 | 
				
			||||||
                        self.selected_option.set(0)
 | 
					                        self.selected_option.set(0)
 | 
				
			||||||
                        self.autoconnect_var.set(_("no Autoconnect"))
 | 
					                        self.autoconnect_var.set(_("no Autoconnect"))
 | 
				
			||||||
                is_encrypt = Path.home() / ".config/wire_py" / str(select_tl + ".dat")
 | 
					                is_encrypt = Path.home() / f".config/wire_py/{select_tl}.dat"
 | 
				
			||||||
                if is_encrypt.is_file():
 | 
					                if is_encrypt.is_file():
 | 
				
			||||||
                    Path.unlink(
 | 
					                    Path.unlink(f"{Path.home()}/.config/wire_py/{select_tl}.dat")
 | 
				
			||||||
                        str(Path.home()) + "/.config/wire_py/" + str(select_tl + ".dat")
 | 
					                Path.unlink(f"/tmp/tlecdcwg/{select_tl}.conf")
 | 
				
			||||||
                    )
 | 
					                with open(f"{Path.home()}/.config/wire_py/keys", "r", encoding="utf-8") as readfile:
 | 
				
			||||||
                Path.unlink(Path("/tmp/tlecdcwg") / str(select_tl + ".conf"))
 | 
					                    with open(f"{Path.home()}/.config/wire_py/keys2", "w", encoding="utf-8") as writefile:
 | 
				
			||||||
                with open(
 | 
					 | 
				
			||||||
                    str(Path.home()) + "/.config/wire_py/keys", "r", encoding="utf-8"
 | 
					 | 
				
			||||||
                ) as readfile:
 | 
					 | 
				
			||||||
                    with open(
 | 
					 | 
				
			||||||
                        str(Path.home()) + "/.config/wire_py/keys2",
 | 
					 | 
				
			||||||
                        "w",
 | 
					 | 
				
			||||||
                        encoding="utf-8",
 | 
					 | 
				
			||||||
                    ) as writefile:
 | 
					 | 
				
			||||||
                        for line in readfile:
 | 
					                        for line in readfile:
 | 
				
			||||||
                            if pre_key not in line.strip("\n"):
 | 
					                            if pre_key not in line.strip("\n"):
 | 
				
			||||||
                                writefile.write(line)
 | 
					                                writefile.write(line)
 | 
				
			||||||
                file_one = Path(str(Path.home()) + "/.config/wire_py/keys2")
 | 
					                file_one = Path(f"{Path.home()}/.config/wire_py/keys2")
 | 
				
			||||||
                file_two = file_one.with_name("keys")
 | 
					                file_two = file_one.with_name("keys")
 | 
				
			||||||
                file_one.replace(file_two)
 | 
					                file_one.replace(file_two)
 | 
				
			||||||
                self.wg_autostart.configure(state="disabled")
 | 
					                self.wg_autostart.configure(state="disabled")
 | 
				
			||||||
@@ -443,21 +429,13 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                if self.l_box.size() == 0:
 | 
					                if self.l_box.size() == 0:
 | 
				
			||||||
                    self.wg_autostart.configure(state="disabled")
 | 
					                    self.wg_autostart.configure(state="disabled")
 | 
				
			||||||
                    self.lb_rename.configure(state="disabled")
 | 
					                    self.lb_rename.configure(state="disabled")
 | 
				
			||||||
                    Tooltip(
 | 
					                    Tooltip(self.wg_autostart, _("You must have at least one\ntunnel",
 | 
				
			||||||
                        self.wg_autostart,
 | 
					                        "in the list,to use the autostart"), tips)
 | 
				
			||||||
                        _(
 | 
					 | 
				
			||||||
                            "You must have at least one\ntunnel in the list,to use the autostart"
 | 
					 | 
				
			||||||
                        ),
 | 
					 | 
				
			||||||
                        tips,
 | 
					 | 
				
			||||||
                    )
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Tooltip(self.btn_exp, _("No Tunnels in List for Export"), tips)
 | 
					                    Tooltip(self.btn_exp, _("No Tunnels in List for Export"), tips)
 | 
				
			||||||
                    Tooltip(self.btn_stst, _("No tunnels to start in the list"), tips)
 | 
					                    Tooltip(self.btn_stst, _("No tunnels to start in the list"), tips)
 | 
				
			||||||
                    Tooltip(
 | 
					                    Tooltip(self.lb_rename, _("To rename a tunnel, at least one must",
 | 
				
			||||||
                        self.lb_rename,
 | 
					                        "be in the list"), tips,)
 | 
				
			||||||
                        _("To rename a tunnel, at least one must be in the list"),
 | 
					 | 
				
			||||||
                        tips,
 | 
					 | 
				
			||||||
                    )
 | 
					 | 
				
			||||||
                    self.lb_rename.insert(0, _("Max. 12 characters!"))
 | 
					                    self.lb_rename.insert(0, _("Max. 12 characters!"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if self.a != "" and self.a == select_tl:
 | 
					                if self.a != "" and self.a == select_tl:
 | 
				
			||||||
@@ -503,9 +481,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
        if self.l_box.size() == 0:
 | 
					        if self.l_box.size() == 0:
 | 
				
			||||||
            Tooltip(self.btn_tr, _("No tunnels to delete in the list"), tips)
 | 
					            Tooltip(self.btn_tr, _("No tunnels to delete in the list"), tips)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            Tooltip(
 | 
					            Tooltip(self.btn_tr, _("Click to delete a Wireguard Tunnel\nSelect from the list!"),
 | 
				
			||||||
                self.btn_tr,
 | 
					 | 
				
			||||||
                _("Click to delete a Wireguard Tunnel\nSelect from the list!"),
 | 
					 | 
				
			||||||
                tips,
 | 
					                tips,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -520,7 +496,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            Tooltip(
 | 
					            Tooltip(
 | 
				
			||||||
                self.btn_exp,
 | 
					                self.btn_exp,
 | 
				
			||||||
                _("         Click to export all\nWireguard Tunnel to Zipfile"),
 | 
					                _("Click to export all\nWireguard Tunnel to Zipfile"),
 | 
				
			||||||
                tips,
 | 
					                tips,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -593,12 +569,11 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                            self.lb_rename.get(),
 | 
					                            self.lb_rename.get(),
 | 
				
			||||||
                        ]
 | 
					                        ]
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
                    source = Path("/tmp/tlecdcwg") / str(select_tl + ".conf")
 | 
					                    source = Path(f"/tmp/tlecdcwg/{select_tl}.conf")
 | 
				
			||||||
                    destination = source.with_name(str(self.lb_rename.get() + ".conf"))
 | 
					                    destination = source.with_name(f"{self.lb_rename.get()}.conf")
 | 
				
			||||||
                    source.replace(destination)
 | 
					                    source.replace(destination)
 | 
				
			||||||
                    Path.unlink(
 | 
					                    Path.unlink(f"{Path.home()}/.config/wire_py/{select_tl}.dat")
 | 
				
			||||||
                        str(Path.home()) + "/.config/wire_py/" + str(select_tl + ".dat")
 | 
					
 | 
				
			||||||
                    )
 | 
					 | 
				
			||||||
                    self.l_box.delete(self.select_tunnel[0])
 | 
					                    self.l_box.delete(self.select_tunnel[0])
 | 
				
			||||||
                    self.l_box.insert("end", self.lb_rename.get())
 | 
					                    self.l_box.insert("end", self.lb_rename.get())
 | 
				
			||||||
                    self.l_box.update()
 | 
					                    self.l_box.update()
 | 
				
			||||||
@@ -703,7 +678,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            filepath = filedialog.askopenfilename(
 | 
					            filepath = filedialog.askopenfilename(
 | 
				
			||||||
                initialdir=str(Path.home()),
 | 
					                initialdir=f"{Path.home()}",
 | 
				
			||||||
                title=_("Select Wireguard config File"),
 | 
					                title=_("Select Wireguard config File"),
 | 
				
			||||||
                filetypes=[(_("WG config files"), "*.conf")],
 | 
					                filetypes=[(_("WG config files"), "*.conf")],
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
@@ -723,13 +698,9 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                    key = Tunnel.con_to_dict(file)
 | 
					                    key = Tunnel.con_to_dict(file)
 | 
				
			||||||
                    pre_key = key[3]
 | 
					                    pre_key = key[3]
 | 
				
			||||||
                    if len(pre_key) != 0:
 | 
					                    if len(pre_key) != 0:
 | 
				
			||||||
                        with open(
 | 
					                        with open(f"{Path.home()}/.config/wire_py/keys", "r", encoding="utf-8") as readfile:
 | 
				
			||||||
                            str(Path.home()) + "/.config/wire_py/keys",
 | 
					 | 
				
			||||||
                            "r",
 | 
					 | 
				
			||||||
                            encoding="utf-8",
 | 
					 | 
				
			||||||
                        ) as readfile:
 | 
					 | 
				
			||||||
                            p_key = readfile.readlines()
 | 
					                            p_key = readfile.readlines()
 | 
				
			||||||
                            if pre_key in p_key or pre_key + "\n" in p_key:
 | 
					                            if pre_key in p_key or f"{pre_key}\n" in p_key:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                # img_w, img_i, w_title, w_txt hand over
 | 
					                                # img_w, img_i, w_title, w_txt hand over
 | 
				
			||||||
                                iw = r"/usr/share/icons/lx-icons/64/error.png"
 | 
					                                iw = r"/usr/share/icons/lx-icons/64/error.png"
 | 
				
			||||||
@@ -742,21 +713,17 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                            else:
 | 
					                            else:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                with open(
 | 
					                                with open(f"{Path.home()}/.config/wire_py/keys", "a", encoding="utf-8") as keyfile:
 | 
				
			||||||
                                    str(Path.home()) + "/.config/wire_py/keys",
 | 
					                                    keyfile.write(f"{pre_key}\r")
 | 
				
			||||||
                                    "a",
 | 
					 | 
				
			||||||
                                    encoding="utf-8",
 | 
					 | 
				
			||||||
                                ) as keyfile:
 | 
					 | 
				
			||||||
                                    keyfile.write(pre_key + "\r")
 | 
					 | 
				
			||||||
                                    if len(path_split1) > 17:
 | 
					                                    if len(path_split1) > 17:
 | 
				
			||||||
                                        p1 = shutil.copy(filepath, "/tmp/tlecdcwg/")
 | 
					                                        p1 = shutil.copy(filepath, "/tmp/tlecdcwg/")
 | 
				
			||||||
                                        path_split = path_split1[
 | 
					                                        path_split = path_split1[
 | 
				
			||||||
                                            len(path_split1) - 17 :
 | 
					                                            len(path_split1) - 17 :
 | 
				
			||||||
                                        ]
 | 
					                                        ]
 | 
				
			||||||
                                        os.rename(
 | 
					                                        os.rename(
 | 
				
			||||||
                                            p1, "/tmp/tlecdcwg/" + str(path_split)
 | 
					                                            p1, f"/tmp/tlecdcwg/{path_split}"
 | 
				
			||||||
                                        )
 | 
					                                        )
 | 
				
			||||||
                                        new_conf = "/tmp/tlecdcwg/" + path_split
 | 
					                                        new_conf = f"/tmp/tlecdcwg/{path_split}"
 | 
				
			||||||
                                        if self.a != "":
 | 
					                                        if self.a != "":
 | 
				
			||||||
                                            check_call(
 | 
					                                            check_call(
 | 
				
			||||||
                                                [
 | 
					                                                [
 | 
				
			||||||
@@ -859,7 +826,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                                    self.str_var.set(self.a)
 | 
					                                    self.str_var.set(self.a)
 | 
				
			||||||
                                    self.color_label()
 | 
					                                    self.color_label()
 | 
				
			||||||
                                    self.stop()
 | 
					                                    self.stop()
 | 
				
			||||||
                                    wg_read = "/tmp/tlecdcwg/" + str(self.a + ".conf")
 | 
					                                    wg_read = f"/tmp/tlecdcwg/{self.a}.conf"
 | 
				
			||||||
                                    with open(
 | 
					                                    with open(
 | 
				
			||||||
                                        wg_read, "r", encoding="utf-8"
 | 
					                                        wg_read, "r", encoding="utf-8"
 | 
				
			||||||
                                    ) as file_for_key:
 | 
					                                    ) as file_for_key:
 | 
				
			||||||
@@ -976,11 +943,11 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        # Address Label
 | 
					        # Address Label
 | 
				
			||||||
        self.add = tk.StringVar()
 | 
					        self.add = tk.StringVar()
 | 
				
			||||||
        self.add.set(_("Address:    ") + data[0])
 | 
					        self.add.set(f"{_("Address:    ")}{data[0]}")
 | 
				
			||||||
        self.DNS = tk.StringVar()
 | 
					        self.DNS = tk.StringVar()
 | 
				
			||||||
        self.DNS.set("       DNS:    " + data[1])
 | 
					        self.DNS.set(f"       DNS:   {data[1]}")
 | 
				
			||||||
        self.enp = tk.StringVar()
 | 
					        self.enp = tk.StringVar()
 | 
				
			||||||
        self.enp.set(_("Endpoint:    ") + data[2])
 | 
					        self.enp.set(f"{_("Endpoint:    ")}{data[2]}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def label_empty(self):
 | 
					    def label_empty(self):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
@@ -1078,7 +1045,7 @@ class FrameWidgets(ttk.Frame):
 | 
				
			|||||||
                self.select_tunnel = self.l_box.curselection()
 | 
					                self.select_tunnel = self.l_box.curselection()
 | 
				
			||||||
                select_tl = self.l_box.get(self.select_tunnel[0])
 | 
					                select_tl = self.l_box.get(self.select_tunnel[0])
 | 
				
			||||||
                check_call(["nmcli", "connection", "up", select_tl])
 | 
					                check_call(["nmcli", "connection", "up", select_tl])
 | 
				
			||||||
                wg_read = "/tmp/tlecdcwg/" + str(select_tl + ".conf")
 | 
					                wg_read = f"/tmp/tlecdcwg/{select_tl}.conf"
 | 
				
			||||||
                with open(wg_read, "r", encoding="utf-8") as file:
 | 
					                with open(wg_read, "r", encoding="utf-8") as file:
 | 
				
			||||||
                    data = Tunnel.con_to_dict(file)
 | 
					                    data = Tunnel.con_to_dict(file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user