diff --git a/cffj.py b/cffj.py new file mode 100644 index 0000000..1fd2c15 --- /dev/null +++ b/cffj.py @@ -0,0 +1,51 @@ +def encode(targetdir): + import os + from tqdm import tqdm + directory = targetdir + selection = [] + files = {} + global total + total = 0 + def listdirs(target): + global total + scandirobj = os.scandir(target) + temp = 0 + for i in scandirobj: + temp += 1 + total += 0.1 + for it in os.scandir(target): + if it.is_dir(): + selection.append(it.path.replace(directory, "")) + listdirs(it) + else: + file = open(it.path, 'rb') + file = file.read() + files[it.path.replace(directory, "")] = file + + listdirs(directory) + output = {} + output["selection"] = selection + output["files"] = files + return output + +def decode(cffjdata): + from tkinter import messagebox + import os + from tqdm import tqdm + import ast + try: + file = cffjdata + if os.path.exists("output"): + os.rmdir("output") + os.mkdir("output") + else: + os.mkdir("output") + for i in file["selection"]: + os.makedirs("output/"+i) + for i in file["files"]: + file2 = open("output/"+i, 'wb') + file2.write(file["files"][i]) + file2.close() + except Exception as e: + messagebox.showerror("fehler", "fehler cffj datei korrupt fehler: {}".format(e)) + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1979e77 --- /dev/null +++ b/setup.py @@ -0,0 +1,10 @@ +import justserv +import ast +import cffj +target = input("download name: ") +obj = justserv.client.OnlineState("setup"+target) +obj = obj.getState() +obj = obj["mainsetupfile"] +obj = ast.literal_eval(obj) +cffj.decode(obj) +print("done") \ No newline at end of file