-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
1436 lines (1249 loc) · 46.2 KB
/
app.py
File metadata and controls
1436 lines (1249 loc) · 46.2 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from pathlib import Path
from tkinter import (
Tk,
Canvas,
Entry,
Text,
Button,
PhotoImage,
messagebox,
Label,
StringVar,
filedialog
)
from Scripts.Hash import hash
from Scripts.Baval import bvl
"""
ToDo:
Add Select File button in Hash Panel
Update the 64 bit and 128 bit keys button to 256 and 512 bit respectively
"""
def gethash(Canvas, tag, text, algorithm):
"""
## Working
\nThe function hashes the given text and then configures the
\ntext value of canvase item with specified tag
## Input
\nNeeds 3 arguments
\n\tCanvas : The current running canvas
\n\tTag : The Tag of the canvas text that need to be edited
\n\ttext : The text to be Hashed
\n\talgorithm : The algorithm to be used to hash the text (md5,sha1,sha256,sha512)
### How the canvase item is configured
\nAfter getting the hash for the given text
\nIf the text is more then 256 characters long then it breaks it into two parts
\nand adds a new line character in between
"""
# Hasher to Hash the Entry Value
hasher = hash()
hasher.text(text)
if algorithm == "md5":
value = hasher._md5()
Canvas.itemconfig(tag, text=value)
elif algorithm == "sha1":
value = hasher._sha1()
Canvas.itemconfig(tag, text=value)
elif algorithm == "sha256":
value = hasher._sha256()
Canvas.itemconfig(tag, text=value)
elif algorithm == "sha512":
hash_value = hasher._sha512()
value = hash_value[:64] + "\n" + hash_value[64:]
print(hash_value)
print(value)
Canvas.itemconfig(tag, text=value)
def getfilehash(Canvas, tag: str, filepath: str, algorithm: str):
"""
## Working
\nThe function hashes a given file and then configures the
\ntext value of canvase item with specified tag
## Input
\nNeeds 3 arguments
\n\tCanvas : The current running canvas
\n\tTag : The Tag of the canvas text that need to be edited
\n\ttext : The text to be Hashed
\n\talgorithm : The algorithm to be used to hash the text (md5,sha1,sha256,sha512)
### How the canvase item is configured
\nAfter getting the hash for the given text
\nIf he text is more then 256 characters long then it breaks it into two parts
\nand adds a new line character in between
"""
# Hasher to Hash the Entry Value
hasher = hash()
algorithm = algorithm.lower()
if algorithm == "md5":
value = hasher.hashfile(filepath, "md5")
Canvas.itemconfig(tag, text=value)
elif algorithm == "sha1":
value = hasher.hashfile(filepath, "sha1")
Canvas.itemconfig(tag, text=value)
elif algorithm == "sha256":
value = hasher.hashfile(filepath, "sha256")
Canvas.itemconfig(tag, text=value)
elif algorithm == "sha512":
hash_value = hasher.hashfile(filepath, "sha512")
value = hash_value[:64] + "\n" + hash_value[64:]
print(hash_value)
print(value)
Canvas.itemconfig(tag, text=value)
class app:
def __init__(self) -> None:
"""Toolkit Class"""
self.window = Tk()
self.window.geometry("1445x813")
self.window.configure(bg="#053B50")
self.window.title("Hacking Toolkit") # Set window title
self.window
# Asset and Output Path
self.OUTPUT_PATH = Path(__file__).parent
self.ASSETS_PATH = self.OUTPUT_PATH / Path(r"./assets")
# Icon of the software
self.window.iconbitmap(self.OUTPUT_PATH / "assets" / "iconv2.ico") # Set window icon (ICO format)
# Don't Change these variables hex_conersion and str_conversion will use them in the Strings Panel
self.str_to_hex_value = ""
self.str_to_Bytes_value = ""
self.str_to_Bits_value = ""
self.hex_to_str_value = ""
self.hex_to_int_value = ""
# Original Encryption Key
self.encryption_key = ""
self.build_Menu()
def hex_conversion(self,Canvas, text: str) -> None:
"""
This fucntion is to use with the **Strings Panel** it takes the present canvas and the hex text
present in the hex_conversion_entry and updates the following value you see on Strings Panel :
\n
1) Int Values (tag: hextoint)
2) Str Value (tag: hextostr)
The converted strings can overflow the canvas thus, the value is truncated to 20 characters
for copy to clipboard purpose, it updates the following global variables :
\n
1) hex_to_int_value
2) hex_to_str_value
**So, you can pass these variables to copyToClipboard() function to copy the value to clipboard.**
"""
from Scripts.Strings import string
int_value = string.hex_To_Int_Or_String(text)[1]
str_value = string.hex_To_Int_Or_String(text)[0]
self.hex_to_int_value = str(int_value)
self.hex_to_str_value = str(str_value)
try:
Int_text = (
int_value if (len(str(int_value)) < 20) else str(int_value)[:20] + " ..."
)
except:
Int_text = "Error"
try:
Str_text = str_value if (len(str_value) < 20) else str_value[:20] + " ..."
except:
Str_text = "Error"
Canvas.itemconfig("hextoint", text=Int_text)
Canvas.itemconfig("hextostr", text=Str_text)
def str_conversion(self,Canvas, text: str) -> None:
"""
This fucntion is to use with the **Strings Panel** it takes the present canvas and the text
present in the string_conversion_entry and updates the following value you see on Strings Panel :
\n
1) Hex Values (tag: Hex)
2) Bytes Value (tag: Bytes)
3) Bits Value (tag: Bits)
The converted strings can overflow the canvas thus, the value is truncated to 40 characters
for copy to clipboard purpose it updates the following global variables :
\n
1) str_to_hex_value
2) str_to_Bytes_value
3) str_to_Bits_value
**So, you can pass these variables to copyToClipboard() function to copy the value to clipboard.**
"""
from Scripts.Strings import string
hex_value = string.str_To_Hex(text)
bytes_value = string.str_To_Bytes(text)
bits_value = string.str_To_Bits(text)
self.str_to_hex_value = hex_value
self.str_to_Bytes_value = bytes_value
self.str_to_Bits_value = bits_value
Hex_text = hex_value if (len(hex_value) < 40) else hex_value[:40] + " ..."
Bytes_text = bytes_value if (len(bytes_value) < 40) else bytes_value[:40] + " ..."
Bits_text = bits_value if (len(bits_value) < 40) else bits_value[:40] + " ..."
Canvas.itemconfig("Hex", text=Hex_text)
Canvas.itemconfig("Bytes", text=Bytes_text)
Canvas.itemconfig("Bits", text=Bits_text)
def check_str(self,Canvas, *args: str) -> None:
"""
This function works witht he Strings Panel and checks the 5 entry boxes
and updates the **True** or **False** value in the Strings Panel
"""
from Scripts.Strings import string
text_list = [i for i in args if i] # Remove empty strings
stinger = string(text_list)
if stinger.issame():
Canvas.itemconfig("trueorfalse", text="True")
else:
Canvas.itemconfig("trueorfalse", text="False")
print(text_list)
def get_key(self,Canvas, type=256) -> None:
"""
This function is to be used with the **Fcrypt Panel** it takes the present canvas and the type of encryption key
to be generated and updates the following value you see on Fcrypt Panel :
1) Key (tag: key)
The generated key can overflow the canvas thus, the value is truncated to 40 characters
for copy to clipboard purpose, it updates the following global variable :
1) encryption_key
**So, you can pass this variable to copyToClipboard() function to copy the value to clipboard.**
"""
from Scripts.Baval import bvl
bvl = bvl(bvl.generate_key(type))
key = bvl.get_key()
self.encryption_key = key
# Trims the original key so it fits in the canvas (40 characters)
encryption_key_text = key if (len(key) < 40) else str(key[:40])[2:-2] + " ..."
# Update the key in the canvas
Canvas.itemconfig("keyvalue", text=encryption_key_text)
def decrypt_file(self,file_path: str, encryption_key: bytes|str) -> bool:
from Scripts.Baval import bvl
if encryption_key[-1] == "'":
encryption_key = encryption_key[2:-1]
decrypter = bvl(encryption_key)
try:
decrypter.decrypt_file(file_path)
messagebox.showinfo("Success", "File Decrypted successfully")
except Exception as e:
print(e)
messagebox.showerror("Error", "Error in Decrypting file")
return False
return True
def encrypt_file(self,file_path: str, encryption_key: bytes|str) -> bool:
from Scripts.Baval import bvl
encryption_key = encryption_key[2:-1] # Remove b' from start and ' from end
bvl = bvl(encryption_key)
try:
bvl.encrypt_file(file_path, True)
messagebox.showinfo("Success", "File encrypted successfully")
except Exception as e:
print(e)
messagebox.showerror("Error", "Error in encrypting file")
return False
return True
def select_file(self,text_var: str) -> None:
"""
This function takes a Stringvar() as an argument and opens a file dialog box to select a file and
updates the Stringvar() with the selected file path.
Args:
text_var (str): The StringVar associated with the file path entry box
"""
file_path = filedialog.askopenfilename()
text_var.set(file_path)
def copyToClipboard(self, text):
"""\nCopies the given text to clipboard and returns True
\nRemoves any \\n characters from the text
"""
try:
text = text.replace("\n", "")
except:
pass
self.window.clipboard_clear()
self.window.clipboard_append(text)
print("Copied to clipboard : " + str(text))
def relative_to_assets(self, path: str) -> Path:
return self.ASSETS_PATH / Path(path)
def destroy(self, frame):
"""
\nInput:
\n\tframe: int (used to call a build function that creates the windows for a given frame)
\n## Frames:
\n\t Menu: 1
\n\t Strings: 2
\n\t Hash: 3
\n\t Fcrypt: 4
\n\t Sub-Domber: 5 (Not implemented)
\n### Output
\n\tRemoves all the children and calls another build function for creating the specified frame
"""
if frame in (1, 2, 3, 4):
for i in self.window.winfo_children():
i.destroy()
else:
messagebox.showerror(
"Sub-Domber Not Available",
"Sub-Domber is not yet implemented Please be Patient :)",
)
if frame == 1:
self.build_Menu()
elif frame == 2:
self.build_String()
elif frame == 3:
self.build_Hash()
elif frame == 4:
self.build_Fcrypt()
def build_Menu(self):
self.ASSETS_PATH = self.OUTPUT_PATH / Path(r"./assets/menu_panel")
canvas = Canvas(
self.window,
bg="#053B50",
height=813,
width=1445,
bd=0,
highlightthickness=0,
relief="ridge",
)
canvas.place(x=0, y=0)
canvas.create_text(
453.0,
7.0,
anchor="nw",
text="ToolKit",
fill="#EEEEEE",
font=("JetBrains Mono", 128 * -1, "bold"),
)
button_image_1 = PhotoImage(file=self.relative_to_assets("button_1.png"))
button_1 = Button(
image=button_image_1,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(3),
relief="flat",
)
button_1.place(x=454.0, y=182.0, width=536.3670654296875, height=105.0)
button_image_2 = PhotoImage(file=self.relative_to_assets("button_2.png"))
button_2 = Button(
image=button_image_2,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(2),
relief="flat",
)
button_2.place(x=454.0, y=337.0, width=536.3670654296875, height=105.0)
button_image_3 = PhotoImage(file=self.relative_to_assets("button_3.png"))
button_3 = Button(
image=button_image_3,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(4),
relief="flat",
)
button_3.place(x=454.0, y=491.0, width=536.3670654296875, height=105.0)
button_image_4 = PhotoImage(file=self.relative_to_assets("button_4.png"))
button_4 = Button(
image=button_image_4,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(5),
relief="flat",
)
button_4.place(x=454.0, y=628.0, width=536.3670654296875, height=105.0)
canvas.create_text(
1000.0,
658.0,
anchor="nw",
text="(Not Implemented)",
fill="#b3b0b0",
font=("JetBrains Mono", 32 * -1, "bold"),
)
self.window.mainloop()
def build_Hash(self):
self.ASSETS_PATH = self.OUTPUT_PATH / Path(
r"./assets/hashing_panel"
)
canvas = Canvas(
self.window,
bg="#053B50",
height=813,
width=1445,
bd=0,
highlightthickness=0,
relief="ridge",
)
# Entery Variables
string_entry_var = StringVar(self.window)
file_entry_var = StringVar(self.window)
# Entries
string_entry = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=string_entry_var,
)
string_entry_Image = PhotoImage(file=self.relative_to_assets("entry_1.png"))
string_entry.place(
x=420.1837158203125,
y=214.88853454589844,
width=605.2891845703125,
height=19.0,
)
canvas.create_image(
722.8283081054688, 225.38853454589844, image=string_entry_Image
)
file_entry = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=file_entry_var,
)
file_entry_image = PhotoImage(file=self.relative_to_assets("entry_2.png"))
canvas.create_image(
724.6285400390625, 533.7057952880859, image=file_entry_image
)
file_entry.place(
x=312.2752685546875,
y=521.3884887695312,
width=675.0,
height=23,
)
select_file_button_image = PhotoImage(
file=self.relative_to_assets("select_file_button.png")
)
select_file_button = Button(
image=select_file_button_image,
borderwidth=0,
highlightthickness=0,
command=lambda: self.select_file(file_entry_var),
relief="flat",
)
select_file_button.place(
x=1025.0,
y=512.0,
width=158.0,
height=44.0
)
canvas.place(x=0, y=0)
image_image_1 = PhotoImage(file=self.relative_to_assets("image_1.png"))
image_1 = canvas.create_image(722.0, 290.0, image=image_image_1)
image_image_2 = PhotoImage(file=self.relative_to_assets("image_2.png"))
image_2 = canvas.create_image(723.0, 609.0, image=image_image_2)
# String Hash and Its Value
canvas.create_text(
420.0,
337.0,
anchor="nw",
text=r"Hash:",
fill="#FFFFFF",
font=("JetBrains Mono", 24 * -1, "bold"),
)
canvas.create_text(
500.0,
343.0,
anchor="nw",
text="",
fill="#FFFFFF",
font=("JetBrains Mono", 14 * -1, "bold"),
tags="stringhash",
)
# File hash and Its Value
canvas.create_text(
320.0,
665.0,
anchor="nw",
text=r"File Hash:",
fill="#FFFFFF",
font=("JetBrains Mono", 24 * -1, "bold"),
)
canvas.create_text(
470.0,
672.0,
anchor="nw",
text=r"asdf198/*$sdasf%s133",
fill="#FFFFFF",
font=("JetBrains Mono", 14 * -1, "bold"),
tags="filehash",
)
# canvas.itemcget() : Gets the Value of specified option from a tag or id
# self.copyToClipboard : Saves the returned value to the clipboard
canvas.tag_bind(
"stringhash",
"<Button-1>",
lambda event, canvas=canvas: self.copyToClipboard(
canvas.itemcget("stringhash", "text")
),
)
canvas.tag_bind(
"filehash",
"<Button-1>",
lambda event, canvas=canvas: self.copyToClipboard(
canvas.itemcget("filehash", "text")
),
)
image_image_3 = PhotoImage(file=self.relative_to_assets("image_3.png"))
image_3 = canvas.create_image(
721.479248046875, 224.88853454589844, image=image_image_3
)
# Entry 2 Background Image
image_image_4 = PhotoImage(file=self.relative_to_assets("image_4.png"))
image_4 = canvas.create_image(
646.97802734375, 534.00390625, image=image_image_4
)
# md5 text button
md5_button_image_string = PhotoImage(
file=self.relative_to_assets("button_1.png")
)
md5_string = Button(
image=md5_button_image_string,
borderwidth=0,
highlightthickness=0,
command=lambda: gethash(canvas, "stringhash", string_entry.get(), "md5"),
relief="flat",
)
md5_string.place(x=552.0, y=263.0, width=70.0, height=45.0)
# md5 file button
md5_button_image_file = PhotoImage(file=self.relative_to_assets("button_2.png"))
md5_file = Button(
image=md5_button_image_file,
borderwidth=0,
highlightthickness=0,
command=lambda: getfilehash(canvas, "filehash", file_entry.get(), "md5"),
relief="flat",
)
md5_file.place(
x=488.0,
y=583.0,
width=95.375,
height=52.7884521484375,
)
# SHA1 text button
sha1_button_image_string = PhotoImage(
file=self.relative_to_assets("button_3.png")
)
sha1_string = Button(
image=sha1_button_image_string,
borderwidth=0,
highlightthickness=0,
command=lambda: gethash(canvas, "stringhash", string_entry.get(), "sha1"),
relief="flat",
)
sha1_string.place(x=643.0, y=263.0, width=70.0, height=45.0)
# SHA1 file button
sha1_button_image_file = PhotoImage(
file=self.relative_to_assets("button_4.png")
)
sha1_file = Button(
image=sha1_button_image_file,
borderwidth=0,
highlightthickness=0,
command=lambda: getfilehash(canvas, "filehash", file_entry.get(), "sha1"),
relief="flat",
)
sha1_file.place(
x=611.9874267578125,
y=583.0,
width=95.375,
height=52.7884521484375,
)
# S256 text button
sha256_button_image_string = PhotoImage(
file=self.relative_to_assets("button_5.png")
)
sha256_string = Button(
image=sha256_button_image_string,
borderwidth=0,
highlightthickness=0,
command=lambda: gethash(canvas, "stringhash", string_entry.get(), "sha256"),
relief="flat",
)
sha256_string.place(x=734.0, y=263.0, width=70.0, height=45.0)
# S256 file button
sha256_button_image_file = PhotoImage(
file=self.relative_to_assets("button_6.png")
)
sha256_file = Button(
image=sha256_button_image_file,
borderwidth=0,
highlightthickness=0,
command=lambda: getfilehash(canvas, "filehash", file_entry.get(), "sha256"),
relief="flat",
)
sha256_file.place(
x=735.9749755859375,
y=583.0,
width=95.375,
height=52.7884521484375,
)
# S512 text button
sha512_button_image_string = PhotoImage(
file=self.relative_to_assets("button_7.png")
)
sha512_string = Button(
image=sha512_button_image_string,
borderwidth=0,
highlightthickness=0,
command=lambda: gethash(canvas, "stringhash", string_entry.get(), "sha512"),
relief="flat",
)
sha512_string.place(
x=825.0,
y=263.0,
width=70.0,
height=45.0,
)
# S512 file button
sha512_button_image_file = PhotoImage(
file=self.relative_to_assets("button_8.png")
)
sha512_file = Button(
image=sha512_button_image_file,
borderwidth=0,
highlightthickness=0,
command=lambda: getfilehash(canvas, "filehash", file_entry.get(), "sha512"),
relief="flat",
)
sha512_file.place(
x=859.9625244140625,
y=583.0,
width=95.375,
height=52.7884521484375,
)
canvas.create_text(
607.0,
15.0,
anchor="nw",
text="Hash",
fill="#EEEEEE",
font=("JetBrains Mono", 96 * -1, "bold"),
)
button_image_11 = PhotoImage(file=self.relative_to_assets("button_11.png"))
button_11 = Button(
image=button_image_11,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(1),
relief="flat",
)
button_11.place(x=37.0, y=34.0, width=150.0, height=71.0)
button_image_12 = PhotoImage(file=self.relative_to_assets("button_12.png"))
button_12 = Button(
image=button_image_12,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(2),
relief="flat",
)
button_12.place(x=1300.0, y=290.0, width=118.0, height=70.0)
button_image_13 = PhotoImage(file=self.relative_to_assets("button_13.png"))
button_13 = Button(
image=button_image_13,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(4),
relief="flat",
)
button_13.place(x=1300.0, y=375.0, width=118.0, height=70.0)
button_image_14 = PhotoImage(file=self.relative_to_assets("button_14.png"))
button_14 = Button(
image=button_image_14,
borderwidth=0,
highlightthickness=0,
command=lambda: self.destroy(5),
relief="flat",
)
button_14.place(x=1300.0, y=460.0, width=118.0, height=70.0)
self.window.mainloop()
def build_String(self):
self.ASSETS_PATH = self.OUTPUT_PATH / Path(
r"./assets/strings_panel"
)
canvas = Canvas(
self.window,
bg="#053B50",
height=813,
width=1445,
bd=0,
highlightthickness=0,
relief="ridge",
)
canvas.place(x=0, y=0)
image_image_1 = PhotoImage(file=self.relative_to_assets("image_1.png"))
image_1 = canvas.create_image(307.0, 416.8606872558594, image=image_image_1)
canvas.create_rectangle(157.0, 474.0, 454.0, 479.0, fill="#E0E5E7", outline="")
image_image_2 = PhotoImage(file=self.relative_to_assets("image_2.png"))
image_2 = canvas.create_image(308.0, 270.0, image=image_image_2)
image_image_3 = PhotoImage(file=self.relative_to_assets("image_3.png"))
image_3 = canvas.create_image(308.0, 326.0, image=image_image_3)
image_image_4 = PhotoImage(file=self.relative_to_assets("image_4.png"))
image_4 = canvas.create_image(308.0, 382.0, image=image_image_4)
image_image_5 = PhotoImage(file=self.relative_to_assets("image_5.png"))
image_5 = canvas.create_image(308.0, 438.0, image=image_image_5)
# Similar String Entries
# The entries are not in order okey
entry_1_var = StringVar(self.window)
entry_2_var = StringVar(self.window)
entry_3_var = StringVar(self.window)
entry_4_var = StringVar(self.window)
entry_5_var = StringVar(self.window)
string_conversion_entry_var = StringVar(self.window)
hex_conversion_entry_var = StringVar(self.window)
# From entry 5 to entry 1 : Check Similar Strings
# Order of the entries
# entrylst = [entry_5_var,entry_1_var,entry_2_var,entry_3_var,entry_4_var,entry_6_var,entry_7_var,]
entry_image_5 = PhotoImage(file=self.relative_to_assets("entry_5.png"))
entry_bg_5 = canvas.create_image(
306.62701416015625, 213.2492218017578, image=entry_image_5
)
entry_5 = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=entry_5_var,
)
entry_5.place(
x=135,
y=203,
width=346.75,
height=21,
)
entry_image_1 = PhotoImage(file=self.relative_to_assets("entry_1.png"))
entry_bg_1 = canvas.create_image(
306.62701416015625, 269.5154724121094, image=entry_image_1
)
entry_1 = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=entry_1_var,
)
entry_1.place(
x=135,
y=259,
width=346.7459716796875,
height=21,
)
entry_image_2 = PhotoImage(file=self.relative_to_assets("entry_2.png"))
entry_bg_2 = canvas.create_image(
306.62701416015625, 325.78173828125, image=entry_image_2
)
entry_2 = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=entry_2_var,
)
entry_2.place(x=135, y=316, width=346.7459716796875, height=21)
entry_image_3 = PhotoImage(file=self.relative_to_assets("entry_3.png"))
entry_bg_3 = canvas.create_image(
306.62701416015625, 382.0479736328125, image=entry_image_3
)
entry_3 = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=entry_3_var,
)
entry_3.place(x=135, y=372, width=346.7459716796875, height=21)
entry_image_4 = PhotoImage(file=self.relative_to_assets("entry_4.png"))
entry_bg_4 = canvas.create_image(
306.62701416015625, 438.3142395019531, image=entry_image_4
)
entry_4 = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=entry_4_var,
)
entry_4.place(
x=135,
y=428,
width=346.7459716796875,
height=19.0,
)
# Background Colors using Images
image_image_8 = PhotoImage(file=self.relative_to_assets("image_8.png"))
image_8 = canvas.create_image(915.0, 324.0, image=image_image_8)
image_image_9 = PhotoImage(file=self.relative_to_assets("image_9.png"))
image_9 = canvas.create_image(
914.479248046875, 212.88853454589844, image=image_image_9
)
image_image_10 = PhotoImage(file=self.relative_to_assets("image_10.png"))
image_10 = canvas.create_image(914.0, 642.0, image=image_image_10)
image_image_11 = PhotoImage(file=self.relative_to_assets("image_11.png"))
image_11 = canvas.create_image(915.0, 606.0, image=image_image_11)
# String to Hex, Bytes, Bits
string_conversion_entry_image = PhotoImage(
file=self.relative_to_assets("entry_6.png")
)
string_conversion_entry_bg = canvas.create_image(
915.8283081054688, 213.38853454589844, image=string_conversion_entry_image
)
string_conversion_entry = Entry(
bd=0,
bg="#053B50",
fg="#EEEEEE",
highlightthickness=0,
font=("JetBrains Mono", 16 * -1, "bold"),
textvariable=string_conversion_entry_var,
)
string_conversion_entry.place(
x=613.1837158203125,
y=202.88853454589844,
width=605.2891845703125,
height=19.0,
)
# Convert Button
convert_button_image = PhotoImage(file=self.relative_to_assets("button_1.png"))
convert_button = Button(
image=convert_button_image,
borderwidth=0,
highlightthickness=0,
command=lambda: self.str_conversion(canvas, string_conversion_entry.get()),
relief="flat",
)
convert_button.place(
x=798.0,
y=244.0,
width=233.453369140625,
height=51.21671676635742,
)
# Hex and its Value
canvas.create_text(
613.472900390625,
324.1393127441406,
anchor="nw",
text="Hex:",
fill="#FFFFFF",
font=("JetBrains Mono", 24 * -1, "bold"),
)
canvas.create_text(
680,
330,
anchor="nw",
text="4a f5 e9 07",
fill="#FFFFFF",
font=("JetBrains Mono", 16 * -1),
tags="Hex",
)
# Bytes and its Value
canvas.create_text(
613.472900390625,
372.1393127441406,
anchor="nw",
text="Bytes:",
fill="#FFFFFF",
font=("JetBrains Mono", 24 * -1, "bold"),
)
canvas.create_text(
710.472900390625,
378,
anchor="nw",
text="11100010 11110100 01110100 01010100",
fill="#FFFFFF",
font=("JetBrains Mono", 16 * -1),
tags="Bytes",
)
# Bits and its Value
canvas.create_text(
613.472900390625,
420.1393127441406,
anchor="nw",
text="Bits:",
fill="#FFFFFF",
font=("JetBrains Mono", 24 * -1, "bold"),
)
canvas.create_text(
695,
427,
anchor="nw",
text="111000101111010001110100010101000111",
fill="#FFFFFF",
font=("JetBrains Mono", 16 * -1),
tags="Bits",
)
# Copy to Clipboard Hex, Bits and Bytes
canvas.tag_bind(