From cf915393c98d433ecc2ad1f18f8e6e0872ff5318 Mon Sep 17 00:00:00 2001 From: Justus Jan Nico Wolff Date: Thu, 22 Dec 2022 23:18:26 +0100 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9Epluginmak?= =?UTF-8?q?er=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pluginmaker/pluginconverter.py | 13 ++++++ pluginmaker/target.py | 73 ++++++++++++++++++++++++++++++++++ pluginmaker/texteditor.py | 46 +++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 pluginmaker/pluginconverter.py create mode 100644 pluginmaker/target.py create mode 100644 pluginmaker/texteditor.py diff --git a/pluginmaker/pluginconverter.py b/pluginmaker/pluginconverter.py new file mode 100644 index 0000000..987885b --- /dev/null +++ b/pluginmaker/pluginconverter.py @@ -0,0 +1,13 @@ +temp = open("pluginmaker/target.py", 'r') +temp = temp.read() +out = {} +name = input("name: ") +author = input("author: ") +id = input("id: ") +out["name"] = name +out["author"] = author +out["main"] = temp +out["extension"] = ".*" +temp2 = open("plugins/"+id+".plug", 'w') +temp2.write(str(out)) +temp2.close() \ No newline at end of file diff --git a/pluginmaker/target.py b/pluginmaker/target.py new file mode 100644 index 0000000..d1e114b --- /dev/null +++ b/pluginmaker/target.py @@ -0,0 +1,73 @@ +#path +import tkinter as tk +import easygui +from tkinter import messagebox + +def xor_encrypt(text, key): + text = text.encode('utf-8') + key = key.encode('utf-8') + encrypted_bytes = [] + for i, b in enumerate(text): + encrypted_bytes.append(b ^ key[i % len(key)]) + return ''.join(['%02x' % b for b in encrypted_bytes]) + +def xor_decrypt(encrypted, key): + key = key.encode('utf-8') + encrypted_bytes = [int(encrypted[i:i+2], 16) for i in range(0, len(encrypted), 2)] + decrypted_bytes = [] + for i, b in enumerate(encrypted_bytes): + decrypted_bytes.append(b ^ key[i % len(key)]) + decrypted = ''.join([chr(b) for b in decrypted_bytes]) + return decrypted + +container = tk.Tk("verschlüsseler") +dictionary = {'0000': '0', '0001': '1', '0002': '2', '0003': '3', '0004': '4', '0005': '5', '0006': '6', '0007': '7', '0008': '8', '0009': '9', '0010': 'a', '0011': 'b', '0012': 'c', '0013': 'd', '0014': 'e', '0015': 'f', '0016': 'g', '0017': 'h', '0018': 'i', '0019': 'j', '0020': 'k', '0021': 'l', '0022': 'm', '0023': 'n', '0024': 'o', '0025': 'p', '0026': 'q', '0027': 'r', '0028': 's', '0029': 't', '0030': 'u', '0031': 'v', '0032': 'w', '0033': 'x', '0034': 'y', '0035': 'z', '0036': 'A', '0037': 'B', '0038': 'C', '0039': 'D', '0040': 'E', '0041': 'F', '0042': 'G', '0043': 'H', '0044': 'I', '0045': 'J', '0046': 'K', '0047': 'L', '0048': 'M', '0049': 'N', '0050': 'O', '0051': 'P', '0052': 'Q', '0053': 'R', '0054': 'S', '0055': 'T', '0056': 'U', '0057': 'V', '0058': 'W', '0059': 'X', '0060': 'Y', '0061': 'Z', '0062': '!', '0063': '"', '0064': '#', '0065': '$', '0066': '%', '0067': '&', '0068': "'", '0069': '(', '0070': ')', '0071': '*', '0072': '+', '0073': ',', '0074': '-', '0075': '.', '0076': '/', '0077': ':', '0078': ';', '0079': '<', '0080': '=', '0081': '>', '0082': '?', '0083': '@', '0084': '[', '0085': '\\', '0086': ']', '0087': '^', '0088': '_', '0089': '`', '0090': '{', '0091': '|', '0092': '}', '0093': '~', '0094': ' ', '0095': '\t', '0096': '\n', '0097': '\r', '0098': '\x0b', '0099': '\x0c'} +def tonormal(text): + dictionary2 = {} + for i in dictionary: + dictionary2[dictionary[i]] = i + out = "" + for i in text: + out = out + dictionary2[i] + return out + +def totext(temp): + out = "" + for i in range(0, len(temp), 4): + temp2 = temp[i] + temp2 = temp2+temp[i+1] + temp2 = temp2+temp[i+2] + temp2 = temp2+temp[i+3] + if temp2 in dictionary: + out = out + dictionary[temp2] + return out + +def encrypt(): + password = easygui.enterbox("passwort eingeben", "verschlüsseln") + if password: + temp = open(path, 'r') + temp = temp.read() + out = xor_encrypt(temp, password) + out = tonormal(out) + temp = open(path, 'w') + temp.write(out) + temp.close() + +def decrypt(): + password = easygui.enterbox("passwort eingeben", "entschlüsseln") + temp = open(path, 'r') + temp = temp.read() + temp = totext(temp) + out = xor_decrypt(temp, password) + if out == False: + messagebox.showerror("fehler!", "das passwort ist falsch! bitte versuchen sie es erneut") + else: + temp = open(path, 'w') + temp.write(out) + temp.close() + +encryptbutton = tk.Button(container, text="verschlüsseln", command=encrypt) +encryptbutton.grid() +decryptbutton = tk.Button(container, text="entschlüsseln", command=decrypt) +decryptbutton.grid() +container.mainloop() \ No newline at end of file diff --git a/pluginmaker/texteditor.py b/pluginmaker/texteditor.py new file mode 100644 index 0000000..4133b86 --- /dev/null +++ b/pluginmaker/texteditor.py @@ -0,0 +1,46 @@ +#path +import tkinter as tk +dictionary = {'0000': '0', '0001': '1', '0002': '2', '0003': '3', '0004': '4', '0005': '5', '0006': '6', '0007': '7', '0008': '8', '0009': '9', '0010': 'a', '0011': 'b', '0012': 'c', '0013': 'd', '0014': 'e', '0015': 'f', '0016': 'g', '0017': 'h', '0018': 'i', '0019': 'j', '0020': 'k', '0021': 'l', '0022': 'm', '0023': 'n', '0024': 'o', '0025': 'p', '0026': 'q', '0027': 'r', '0028': 's', '0029': 't', '0030': 'u', '0031': 'v', '0032': 'w', '0033': 'x', '0034': 'y', '0035': 'z', '0036': 'A', '0037': 'B', '0038': 'C', '0039': 'D', '0040': 'E', '0041': 'F', '0042': 'G', '0043': 'H', '0044': 'I', '0045': 'J', '0046': 'K', '0047': 'L', '0048': 'M', '0049': 'N', '0050': 'O', '0051': 'P', '0052': 'Q', '0053': 'R', '0054': 'S', '0055': 'T', '0056': 'U', '0057': 'V', '0058': 'W', '0059': 'X', '0060': 'Y', '0061': 'Z', '0062': '!', '0063': '"', '0064': '#', '0065': '$', '0066': '%', '0067': '&', '0068': "'", '0069': '(', '0070': ')', '0071': '*', '0072': '+', '0073': ',', '0074': '-', '0075': '.', '0076': '/', '0077': ':', '0078': ';', '0079': '<', '0080': '=', '0081': '>', '0082': '?', '0083': '@', '0084': '[', '0085': '\\', '0086': ']', '0087': '^', '0088': '_', '0089': '`', '0090': '{', '0091': '|', '0092': '}', '0093': '~', '0094': ' ', '0095': '\t', '0096': '\n', '0097': '\r', '0098': '\x0b', '0099': '\x0c'} +def totext(): + out = "" + temp = open(path, 'r') + temp = temp.read() + for i in range(0, len(temp), 4): + temp2 = temp[i] + temp2 = temp2+temp[i+1] + temp2 = temp2+temp[i+2] + temp2 = temp2+temp[i+3] + if temp2 in dictionary: + out = out + dictionary[temp2] + return out + +def tonormal(text): + dictionary2 = {} + for i in dictionary: + dictionary2[dictionary[i]] = i + out = "" + for i in text: + out = out + dictionary2[i] + temp = open(path, 'w') + temp.write(out) + temp.close() + +def save(): + text = label.get("1.0", tk.END) + tonormal(text) + +container = tk.Tk("editor") +temp = totext() +scrollbar = tk.Scrollbar(container) +scrollbar.grid(row=0, column=1) +label = tk.Text(container, yscrollcommand=scrollbar.set) +label.insert(tk.INSERT, temp) +label.grid(row=0, column=0) +scrollbar.config(command=label.yview) +savebutton = tk.Button(container, text="speichern", command=save) +savebutton.grid() +container.mainloop() + + + +