-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
28 lines (23 loc) · 1.07 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import subprocess
import shutil
import tkinter as tk
from tkinter import filedialog
def decrypt_lua_files(directory, base_output_dir):
for root, _, files in os.walk(directory):
for file in files:
if file.endswith('.lua'):
file_path = os.path.join(root, file)
decrypted_file_path = os.path.join(base_output_dir, file.replace('.lua', '_decrypt.lua'))
command = f'java -jar unluac.jar "{file_path}" > "{decrypted_file_path}"'
subprocess.run(command, shell=True)
final_file_path = decrypted_file_path.replace('_decrypt.lua', '.lua')
os.rename(decrypted_file_path, final_file_path)
shutil.move(final_file_path, file_path)
if __name__ == "__main__":
root = tk.Tk()
root.withdraw()
directory = filedialog.askdirectory(title="Select Directory to Search for .lua Files")
if directory:
base_output_dir = os.path.dirname(__file__)
decrypt_lua_files(directory, base_output_dir)