optimized remove with open

This commit is contained in:
2025-04-29 12:32:23 +02:00
parent 213f772f40
commit 19d413ea97
3 changed files with 10 additions and 14 deletions

View File

@ -8,8 +8,7 @@ from subprocess import check_call
uname: Path = Path("/tmp/.log_user")
with open(uname, "r", encoding="utf-8") as f:
log_name = f.readline()
log_name = Path(uname).read_text(encoding="utf-8")
# Folder Name "tlecdewg" = Tunnel Encrypt Decrypt Wireguard
folder_path: Path = Path("/tmp/tlecdcwg/")
@ -31,5 +30,6 @@ if os.path.exists(f"{folder_path2}pbwgk.pem"):
for detunnels in detl:
tlname2 = f"{detunnels[:-4]}.conf"
extpath = f"{folder_path}/{tlname2}"
check_call(["openssl", "pkeyutl", "-decrypt", "-inkey", PKEYFILE, "-in", detunnels, "-out", extpath])
check_call(["openssl", "pkeyutl", "-decrypt", "-inkey", PKEYFILE, "-in", detunnels,
"-out", extpath])
shutil.chown(extpath, 1000, 1000)