-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoder.py
More file actions
61 lines (41 loc) · 1.62 KB
/
decoder.py
File metadata and controls
61 lines (41 loc) · 1.62 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from tkinter import *
import json
import base64
def select_all(event):
text_field_1.tag_add(SEL, '1.0', END)
text_field_1.mark_set(INSERT, '1.0')
text_field_1.see(INSERT)
text_field_2.tag_add(SEL, '1.0', END)
text_field_2.mark_set(INSERT, '1.0')
text_field_2.see(INSERT)
return 'break'
def get_decode_data():
encode_data = text_field_1.get('1.0', END)
decode_data = base64.b64decode(encode_data).decode('UTF-8')
parsed = json.loads(decode_data)
text_field_2.insert('1.0', json.dumps(parsed, indent=4, sort_keys=True), END)
root = Tk()
root.title('SSL / Base64 to JSON decoder')
frame = Frame(root)
label_1 = Label(root, text='Enter SSL / Base64 format data: ')
text_field_1 = Text(root, height=30, width=90, background='gray89')
label_2 = Label(root, text='JSON view:')
text_field_2 = Text(root, height=30, width=90, background='gray89')
label_1.grid(row=0, column=0)
text_field_1.grid(row=1, column=0, sticky=W)
label_2.grid(row=0, column=1)
text_field_2.grid(row=1, column=1, sticky=E)
# checkbox = Checkbutton(root, text='Save to JSON file')
# checkbox.grid(columnspan=2)
decodeButton = Button(root, text='Decode', command=get_decode_data)
decodeButton.grid(columnspan=2)
text_field_1.bind('<Control-Key-a>', select_all)
text_field_1.bind('<Control-Key-A>', select_all)
text_field_1.bind('<Command-Key-a>', select_all)
text_field_1.bind('<Command-Key-A>', select_all)
text_field_2.bind('<Control-Key-a>', select_all)
text_field_2.bind('<Control-Key-A>', select_all)
text_field_2.bind('<Command-Key-a>', select_all)
text_field_2.bind('<Command-Key-A>', select_all)
frame.grid()
root.mainloop()