-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSLGScriptTool_GUI.py
1733 lines (1603 loc) · 94.6 KB
/
SLGScriptTool_GUI.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
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
import locale
import os
import tkinter as tk
from tkinter import ttk, filedialog, messagebox
import ctypes
import threading
import codecs
from SLG_Crypto import SLG_Crypto
from SLG_Scripts_NEW import SLG_Scripts_NEW
class SLGScriptTool_GUI:
top_name_lib = {
"eng": "SLGSystemScriptTool by Tester",
"rus": "SLGSystemScriptTool от Tester-а"
}
strings_lib = {
"eng": (
"РУССКИЙ",
"ENGLISH",
"Main Section",
"Crypto Module",
"0-Version Script",
"1+ Versions Scripts"
),
"rus": (
"РУССКИЙ",
"ENGLISH",
"Главный раздел",
"Криптомодуль",
"Скрипт версии 0",
"Скрипты версий 1+"
)
}
_top_relief_lib = {
"eng": (
tk.RAISED,
tk.SUNKEN
),
"rus": (
tk.SUNKEN,
tk.RAISED
)
}
def __init__(self):
self._window = tk.Tk()
self._width = 600
self._height = 400
self._lang = self._define_language()
self._current_panel = 0
self._window.geometry('{}x{}+{}+{}'.format(
self._width,
self._height,
self._window.winfo_screenwidth() // 2 - self._width // 2,
self._window.winfo_screenheight() // 2 - self._height // 2))
self._window.resizable(width=False, height=False)
self._window["bg"] = 'grey'
self._top_buttons = []
self._top_buttons.append(tk.Button(master=self._window,
command=self.to_Russian,
relief=tk.RAISED,
font=('Helvetica', 14)))
self._top_buttons.append(tk.Button(master=self._window,
command=self.to_English,
relief=tk.RAISED,
font=('Helvetica', 14)))
self._top_buttons[0].place(relx=0.0, rely=0.0, relwidth=0.5, relheight=0.1)
self._top_buttons[1].place(relx=0.5, rely=0.0, relwidth=0.5, relheight=0.1)
self._razdel_button = []
for i in range(4):
self._razdel_button.append(tk.Button(master=self._window,
relief=tk.RAISED,
borderwidth=8,
font=('Helvetica', 12)))
self._razdel_button[i].place(relx=0.025 + (0.5 * (i % 2)), rely=0.1125 * (int(not (i < 2)) + 1),
relwidth=0.45, relheight=0.1)
# self._razdel_button[i]["text"] = str(i) #Сие для тестов.
self._razdel_button[0]["command"] = self.to_zero_panel
self._razdel_button[1]["command"] = self.to_first_panel
self._razdel_button[2]["command"] = self.to_second_panel
self._razdel_button[3]["command"] = self.to_third_panel
self._frame = []
self._frame.append(SLG_MainFrame(self._window))
self._frame.append(SLG_CryptoFrame(self._window))
self._frame.append(SLG_ScriptZeroFrame(self._window))
self._frame.append(SLG_ScriptLaterFrame(self._window))
self._change_language()
self._change_frame()
self._window.mainloop()
def to_zero_panel(self):
self._current_panel = 0
self._change_frame()
def to_first_panel(self):
self._current_panel = 1
self._change_frame()
def to_second_panel(self):
self._current_panel = 2
self._change_frame()
def to_third_panel(self):
self._current_panel = 3
self._change_frame()
def _change_frame(self):
for i in range(len(self._frame)):
if (i == self._current_panel):
self._frame[i].place(relx=0.025, rely=0.35, relwidth=0.95, relheight=0.635)
self._razdel_button[i]["relief"] = tk.SUNKEN
self._razdel_button[i]["state"] = tk.DISABLED
else:
self._frame[i].place_forget()
self._razdel_button[i]["relief"] = tk.RAISED
self._razdel_button[i]["state"] = tk.NORMAL
def to_Russian(self):
self._lang = 'rus'
self._change_language()
def to_English(self):
self._lang = 'eng'
self._change_language()
def _change_language(self):
failer = True
for i in self.strings_lib:
if (self._lang == i):
failer = False
if (failer):
print("Verily, sorry I am!\nThis language is not supportred!")
self._lang = 'eng'
for i in range(len(self._top_buttons)): # 2
self._top_buttons[i]["text"] = self.strings_lib[self._lang][i] # 0, 1.
self._top_buttons[i]["relief"] = self._top_relief_lib[self._lang][i]
for i in range(len(self._frame)): # 4
self._razdel_button[i]["text"] = self.strings_lib[self._lang][i + 2] # 2, 3, 4, 5.
self._frame[i].translate_to(self._lang)
self._window.title(self.top_name_lib[self._lang])
def _define_language(self):
is_rus = False
windll = ctypes.windll.kernel32
superlocale = locale.windows_locale[windll.GetUserDefaultUILanguage()][:2]
if (superlocale == 'ru'):
is_rus = True
elif (superlocale == 'uk'):
is_rus = True
elif (superlocale == 'sr'):
is_rus = True
elif (superlocale == 'bg'):
is_rus = True
elif (superlocale == 'kk'):
is_rus = True
elif (superlocale == 'be'):
is_rus = True
elif (superlocale == 'hy'):
is_rus = True
elif (superlocale == 'az'):
is_rus = True
if (is_rus):
return 'rus'
else:
return 'eng'
@staticmethod
def show_message(self, title, message):
messagebox.showinfo(title, message)
class SLG_MasterFrame(tk.Frame):
strings_lib = {
'eng': ('none'),
'rus': ('ничего')
}
def __init__(self, master):
super(SLG_MasterFrame, self).__init__()
self.master = master
self["background"] = 'white'
self["relief"] = tk.RAISED
self["borderwidth"] = 5
def translate_to_eng(self):
self.translate_to('eng')
def translate_to_rus(self):
self.translate_to('rus')
def translate_to(self, language):
pass
class SLG_MainFrame(SLG_MasterFrame):
strings_lib = {
'eng': (
'About SLG System',
'About tool',
'Game\'s versions',
'Game\'s keys',
'Help',
'''SLG System Engine is not very popular, but also not very obsqure engine, used in Gesen 18 (may be not '''
'''only whose) games. It's in fact some sort of modified Tenka Touitsu ADVANCE engine. There are a lot '''
'''of good visual novels and jRPG's uses it, such as Sengoku Hime and Sankoku Hime series.\n\nOldest '''
'''versions of it, such as Shihen 69's version or version "0", does use just a simple script .sd. Older '''
'''versions does use multicomponent script from a group of files, that differ depending of the game '''
'''version. The main file of it is .sd, but you cannot simply edit only one this file, because it will '''
'''break offset-links between files and so the game won't run correctly. You need to edit all files '''
'''synchronically and reflect changes in one file in others.\n\nSince third version of the engine (or '''
'''even the latest games of second version) commonly use DRM and the scripts and files of supplement '''
'''structures encryption.''',
'''COMMMON DATA ABOUT THE TOOL.\n\n\n'''
'''Dual languaged GUI tool for (de)compiling and (de/en)crypting (with key finding) scripts of SLG '''
'''System engine. Supports all known versions of SLG System: 0, 1, 2, 3 (3.0, 3.1), 4 (4.0, 4.1), but '''
'''may lack of support of some it's variations. If this tool does not support a game, write an "Issue" '''
'''on github page with attached unsupported scripts and highlighting the game name. With this tool you '''
'''can: decompile and compile script of SLG System, (en/de)crypt script of any game on SLG System, find '''
'''key of any game on SLG System via cryptoattack.\n\nIt has following features:\n- Help module.\n- '''
'''Crypto module (for (en/de)cryptions and cryptoattacks).\n- Scripts version 0 module (separate module '''
'''because version 0 scripts are too different from the rest).\n- Script older versions module.\n\n> '''
'''Tested with\n- Shihen 69 \~Shin'en no Messiah\~;\n- Sengoku Hime \~Ransei, Tenka Sanbun no Kei\~ '''
'''Renewal;\n- Sengoku Hime \~Senran no Yo ni Honoo Tatsu\~;\n- Sengoku Hime 2 \~Senran no Yo, Gun'yuu '''
'''Arashi no Gotoku\~;\n- Sengoku Hime 3 \~Tenka o Kirisaku Hikari to Kage\~;\n- Sengoku Hime 4 \~Souha '''
'''Hyakkei, Hana Mamoru Chikai\~;\n- Sengoku Hime 5 \~Senka Tatsu Haou no Keifu\~;\n- Sengoku Hime 6 '''
''''\~Tenka Kakusei, Shingetsu no Kirameki\~. ''',
'''THE TOOL USAGE: CRYPTOATTACKS.\n\n\n'''
'''1. Start the tool.\n2. Go to "Crypto Module" and focus on the right half of the screen.\n3. Choose '''
'''the main.sd **(and only the main.sd!)** script.\n4. Choose the output text file (with the '''
'''cryptoattack result).\n5. Choose the attack type. Almost all games are weak for "2 0 0 2 0", but an '''
'''earlier games may be weak for "2 0 2 0 0". **There is only one possible type for each main.sd!**\n6. '''
'''Choose the attack mode of operation -- find only one possible key (may not work depending on '''
'''settings) or all.\n7. Choose the attack mode of attack. Earlier games (elder of version 2 and version '''
'''3) use second (i-(key>>16)&0xff), but version 4 games use first (i^(key&0xff)).\n8. Run it! **If you '''
'''picked attack mode and type correctly, you'll likely get first correct key in 1 minute!** If you '''
'''can't get any key in 5 minutes, just try other settings.''',
'''THE TOOL USAGE: (DE/EN)CRYPTION\n\n\n'''
'''1. Start the tool.\n2. Go to "Crypto Module" and focus on the left half of the screen.\n3. Choose the '''
'''processing mode (per file or per folder).\n4. Choose the input and output files or folders.\n5. '''
'''Choose the key. You can choose known key in the ComboBox vidjet, but also can write your own key '''
'''''''**(in hex form!)**\n6. Choose the encryption mode. Earlier games (elder of version 2 and version '''
'''3) scripts use second (i-(key>>16)&0xff), but version 4 games use first (i^(key&0xff)). Almost all '''
'''supplement data files use the first mode.\n7. Run it! Soon it will be (de/en)crypted...''',
'''THE TOOL USAGE: VERSION 0 SCRIPTS (DE)COMPILATION\n\n\n'''
'''1. Start the tool.\n2. Go to "0-Version Script".\n3. Choose the processing mode (per file or per '''
'''folder).\n4. Choose the input and output files or folders.\n5. Choose the encoding (of both script '''
'''and decompiled file). If you want to create script with different encoding, just decompile it with '''
'''old encoding, change encoding of decompiled script (txt) and create a new script with new '''
'''encoding.\n6. Run it! Soon it will be (de)compiled...''',
'''THE TOOL USAGE: ELDER VERSIONS SCRIPTS (DE)COMPILATION\n\n\n'''
'''1. Start the tool.\n2. Go to "1+ Versions Scripts".\n3. Choose the decompilation mode (to file or to '''
'''folder). This mode is also complitation mode: from file or from folder.\n4. Choose the script '''
'''folder and base (name of script files without extension). You may want to click at "..." button at '''
'''the right of "script name" field and choose the ".sd" script, and boyh name without extension and '''
'''folder will be filled authomatically.\n5. Choose the decompiled txt script file or folder. Do note, '''
'''even if you decompile it to one file, there will be some technical files starting "__" in the same '''
'''folder.\n6. Choose the encoding (of both script and decompiled file). If you want to create script '''
'''with different encoding, just decompile it with old encoding, change encoding of decompiled script '''
'''''''(txt) and create a new script with new encoding.\n7. Choose the version via ComboBox vidget.\n8. '''
'''Run it! Soon it will be (de)compiled... But, to be fair, even if commonly (de)compilation takes '''
'''about 1 minute, compilation from multiple files (from a folder) takes several minutes.''',
'''LINE AND MESSAGE BREAKS HELP\n\n\n'''
'''Sometimes there could be a very big problem: text may not fully get in textbox. But with this tool '''
'''thou don't need to cut some part of text, no. Thou can use line and message breaks. Methods are '''
'''below.\n### For line breaks insert in the current message this.\n```\n\\n\n```\n### For message '''
'''breaks duplicate the message command and "WAIT_FOR_CLICK" (if existed). It's preferable to edit '''
'''''''"postcommand args", but not mandatory. It has worked in my tests even without editing them.\n### '''
'''Example below is from Sengoku Hime 4.\n>>> Old code.\n```\n#1: ["MESSAGE", 159, 43]\n[\n "*",\n '''
'''''''"**",\n "???",\n [\n "GROUP",\n [\n '''
'''''''"「追加ができたぞー♪ 皆、どんどん食べてくれ」",\n 0,\n 0,\n -4276546,\n '''
'''''''-1\n ]\n ]\n]\n#1: ["WAIT_FOR_CLICK", 159, 45]\n[]\n```\n>>> New code.\n```\n#1: '''
'''''''["MESSAGE", 159, 43]\n[\n "*",\n "**",\n "???",\n [\n "GROUP",\n [\n '''
'''''''"「追加ができたぞー♪ 皆、どんどん食べてくれ」",\n 0,\n 0,\n -4276546,\n '''
'''''''-1\n ]\n ]\n]\n#1: ["WAIT_FOR_CLICK", 159, 44]\n[]\n#1: ["MESSAGE", 159, 45]\n[\n '''
'''''''"*",\n "**",\n "???",\n [\n "GROUP",\n [\n '''
'''''''"「追加ができたぞー♪ 皆、どんどん食べてくれ」",\n 0,\n 0,\n -4276546,\n '''
'''''''-1\n ]\n ]\n]\n#1: ["WAIT_FOR_CLICK", 159, 46]\n[]\n```''',
),
'rus': (
'О движке SLG System',
'О средстве',
'Версии игр',
'Ключи игр',
'Справка',
'''SLG System является не слишком популярным, но и не слишком неизвестным движком, используемым в играх '''
'''Gesen 18 и, вероятно, Unicorn-A. На самом деле является своего рода модификацией движка Тэнка то:ицу '''
'''ADVANCE. На нём написано немало сдобный визуальных новелл и японских ролевых игр (jRPG), например '''
'''серии Принцессы Сэнгоку и Принцессы Троецарствия.\n\nВерсия "0" данного движка используют '''
'''однофайловые скрипты .sd, более поздние -- многокомпонентные скрипты из ряда файлов, которые меняются '''
'''зависимости от версий и число которых обычно составляет от 9 до 11, причём все файлы связаны. Главным '''
'''файлом таких многокомпонентных скриптов является .sd, хотя работать только с одним сим файлом, не '''
'''меняя другие в соответствии со сделанными изменениями, нельзя, так как связность между ними сломается '''
'''и игра не будет работать корректно.\n\nИгры на движке, начиная с третьей версии (или даже последних '''
'''игр второй версии) обычно содержат технические средства защиты цифровых прав, DRM, а также шифрование '''
'''скриптов и файлов вспомогательных структур данных.''',
'''ОБЩИЕ СВЕДЕНИЯ О СРЕДСТВЕ.\n\n\n'''
'''Двуязычное средство с графическим интерфейсом пользователя для (де)компилирования и (рас)шифровки (с '''
'''нахождением ключей) скриптов движка SLG System. Поддерживает все известные версии SLG System: 0, 1, '''
'''2, 3 (3.0, 3.1), 4 (4.0, 4.1), хотя может и не поддерживать некоторые их вариации. Коль средство не '''
'''поддерживает какую-то игру, пишите в "Issues" к сему средству, приложив скрипты и указав игру. С сим '''
'''средством вы можете: декомпилировать и компилировать скрипты SLG System, (рас)шифровывать скрипты '''
'''любых игр, находить ключ любой игры на SLG System посредством криптоатаки.\n\nУ неё есть следующие '''
'''функции:\n- Справочный модуль.\n- Криптографический модуль (для (рас)шифровки и криптоатак).\n- '''
'''Модуль для работы со скриптами версии 0 (отдельный модуль, понеже скрипты версии 0 слишком отличаются '''
'''от остальных).\n- Модуль для работы со скриптами более старых версий.\n\n> Протестировано с\n- '''
'''Псалтырь 69: Мессия пустоты;\n- Принцессы Троецарствия: Неспокойные времена, план Трёх царств '''
'''(Обновлённая версия);\n- Принцессы Сэнгоку: Огни мира войны;\n- Принцессы Сэнгоку 2: В мире войны '''
'''буря бушует меж феодалами;\n- Принцессы Сэнгоку 3: Свет и тьма рассекают мир;\n- Принцессы Сэнгоку 4: '''
'''Все средства для победы, клятва защитить цветы;\n- Принцессы Сэнгоку 5: Родословная правителя, '''
'''потушившего пламя войны;\n- Принцессы Сэнгоку 6: Пробуждение державы, блеск новой Луны.''',
'''ИСПОЛЬЗОВАНИЕ СРЕДСТВА: КРИПТОАТАКИ.\n\n\n'''
'''1. Запустите средство.\n2. Перейдите во вкладку "Криптомодуль" и сосредоточьте взгляд на правой части '''
'''экрана.\n3. Выберите скрипт main.sd **(обязательно скрипт именно с таким названием!)**\n4. Выберите '''
'''выходной текстовый файл (для вывода результатов криптоатаки).\n5. Выберите тип атаки. Обычно все игры '''
'''уязвимы пред "2 0 0 2 0", но ранние могут быть уязвимы лишь пред "2 0 2 0 0". **Для каждого main.sd '''
'''есть лишь один корректный тип криптоатаки!**\n6. Выберите режим обработки атаки -- находить один '''
'''возможный ключ (что может и не работать в зависимости от настроек) иль все.\n7. Выберите режим '''
'''собственно атаки. В ранних играх (версии 3 и поздние 2-й версии) используйте второй '''
'''''''(i-(key>>16)&0xff), но для тех, что на 4, первый -- (i^(key&0xff)).\n8. Запускайте! **Коль вы '''
'''выбрали правильные режим и тип атаки, то скорее всего получите первый корректный ключ аж за '''
'''минуту!** Коль не можете получить никакого ключа за 5 минут, просто попробуйте иные настройки.''',
'''ИСПОЛЬЗОВАНИЕ СРЕДСТВА: (РАС)ШИФРОВАНИЕ\n\n\n'''
'''1. Запустите средство.\n2. Перейдите на вкладку "Криптомодуль" и сосредоточьте взгляд на левой части '''
'''экрана.\n3. Выберите режим обработки (по файлу или по папке).\n4. Выберите входные и выходные файлы '''
'''или папки.\n5. Выберите ключ. Можно как выбрать уже известный ключ с помощью виджета ComboBox, так и '''
'''написать свой **(в шестнадцатеричной форме!)**\n6. Выберите режим шифрования. В ранних играх (версии '''
'''3 и поздние 2-й версии) используйте второй (i-(key>>16)&0xff), но для тех, что на 4, первый -- '''
'''(i^(key&0xff)). Почти все файлы вспомогательных структур данных используют первый режим.\n7. '''
''''Запускайте! Вскоре нужное будет (рас)шифровано...''',
'''ИСПОЛЬЗОВАНИЕ СРЕДСТВА: (ДЕ)КОМПИЛЯЦИЯ СКРИПТОВ ВЕРСИИ 0\n\n\n'''
'''1. Запустите средство.\n2. Перейдите на вкладку "Скрипт версии 0".\n3. Выберите режим обработки (по '''
'''файлу или по папке).\n4. Выберите входные и выходные файлы или папки.\n5. Выберите кодировку (что '''
'''применяется как для компилированного скрипта, так и декомпилированного txt). Ежели вы хотите сменить '''
'''кодировку скрипта, то сперва декомпилируйте скрипт со старой, затем измените кодировку полученного '''
'''текстового файла и создайте скрипт с новой кодировкой.\n6. Запускайте! Вскоре нужное будет '''
'''(де)компилировано...''',
'''ИСПОЛЬЗОВАНИЕ СРЕДСТВА: (ДЕ)КОМПИЛЯЦИЯ СКРИПТОВ СТАРШИХ ВЕРСИЙ\n\n\n'''
'''1. Запустите средство.\n2. Перейдите на вкладку "Скрипты версий 1+".\n3. Выберите режим рекомпиляции '''
'''''''(в файл или папку). Сей режим также относится и к компиляции: из файла иль из папки.\n4. Выберите '''
'''папку и основу имени скрипта (имя скрипта без расширения). Может быть удобно кликнуть на кнопку "..." '''
'''с правой части подраздела "имени скрипта" и выбрать скрипт ".sd", после чего папка и основа имени '''
'''скрипта будет заполнены автоматически.\n5. Выберите файл или папку декомпилированного скрипта в '''
'''текстовом формате. Заметьте, что, даже ежели вы декомпилируете скрипт в один файл, в той же '''
'''директории появятся технические файлы, имена коих начинаются с "__".\n5. Выберите кодировку (что '''
'''применяется как для компилированного скрипта, так и декомпилированного txt). Ежели вы хотите сменить '''
'''кодировку скрипта, то сперва декомпилируйте скрипт со старой, затем измените кодировку полученного '''
'''текстового файла и создайте скрипт с новой кодировкой.\n8. Посредством виджета ComboBox выберите '''
'''версию.\n9. Запускайте! Вскоре нужное будет (де)компилировано... Хотя, справедливости ради, если '''
'''обычно (де)компиляция выполняется примерно за минуту, то компиляция из множества файлов (из папки) '''
'''может занять уже несколько минут.''',
'''СПРАВКА О ПЕРЕНОСАХ ПО СТРОКАМ И СООБЩЕНИЯМ\n\n\n'''
'''Иногда можно столкнуться с одной большой-пребольшой проблемой: текст может не полностью влезать в '''
'''текстовое окно. Однако, с сим средством вам не нужно обрезать его, отнюдь. Вы можете организовывать '''
'''переносы по строкам и сообщениям. Методы указаны ниже.\n### Для переносов по строкам добавьте в '''
'''текущее сообщение следующее.\n```\n\\n\n```\n### Для переносов по сообщениям продублируйте текущую '''
'''команду сообщения и "WAIT_FOR_CLICK" (при наличии). Рекомендуется также изменить т.н. "посткомандные '''
'''аргументы", но это не обязательно, так как в моих тестах работало и без изменений их.\n### Пример '''
'''ниже представлен для Принцесс Сэнгоку 4.\n>>> Старый код.\n```\n#1: ["MESSAGE", 159, 43]\n[\n '''
'''''''"*",\n "**",\n "???",\n [\n "GROUP",\n [\n '''
'''''''"「追加ができたぞー♪ 皆、どんどん食べてくれ」",\n 0,\n 0,\n -4276546,\n '''
'''''''-1\n ]\n ]\n]\n#1: ["WAIT_FOR_CLICK", 159, 45]\n[]\n```\n>>> Новый код.\n```\n#1: '''
'''''''["MESSAGE", 159, 43]\n[\n "*",\n "**",\n "???",\n [\n "GROUP",\n [\n '''
'''''''"「追加ができたぞー♪ 皆、どんどん食べてくれ」",\n 0,\n 0,\n -4276546,\n '''
'''''''-1\n ]\n ]\n]\n#1: ["WAIT_FOR_CLICK", 159, 44]\n[]\n#1: ["MESSAGE", 159, 45]\n[\n '''
'''''''"*",\n "**",\n "???",\n [\n "GROUP",\n [\n '''
'''''''"「追加ができたぞー♪ 皆、どんどん食べてくれ」",\n 0,\n 0,\n -4276546,\n '''
'''''''-1\n ]\n ]\n]\n#1: ["WAIT_FOR_CLICK", 159, 46]\n[]\n```''',
)
}
def __init__(self, master):
super(SLG_MainFrame, self).__init__(master)
self.master = master
self["background"] = 'white'
self["relief"] = tk.RAISED
self["borderwidth"] = 5
self._language = ''
self._main_button = []
self._help_func = [self._engine_help, self._tool_help, self._version_help, self._keys_help]
butter = 0.135
yutter = 0.25
wider = 0.315
yider = 0.2
for i in range(4):
self._main_button.append(tk.Button(master=self,
command=self._help_func[i],
relief=tk.RAISED,
font=('Helvetica', 13)))
self._main_button[i].place(relx=abs((i % 2) - butter) - wider * (i % 2),
rely=abs(int(i > 1) - yutter) - yider * int(i > 1),
relwidth=wider, relheight=yider)
self._possible_keys = ''
for i in SLG_Crypto.basic_keys:
self._possible_keys += hex(i[0]) + ' - ' + i[1] + ';\n'
self._possible_keys = self._possible_keys[:-2] + '.'
self._possible_versions = ''
for i in SLG_Scripts_NEW.game_versions:
self._possible_versions += str(i[0]) + ' - '
for k in i[1]:
self._possible_versions += k + ', '
self._possible_versions = self._possible_versions[:-2] + ';\n'
self._possible_versions = self._possible_versions[:-2] + '.'
def _engine_help(self):
print("Engine help!/Помощь о движке!")
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][4],
self.strings_lib[self._language][5])
def _tool_help(self):
print("Tool help!/Помощь о средстве!")
for i in range(6):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][4],
self.strings_lib[self._language][6+i])
def _version_help(self):
print("Version help!/Помощь о версиях!")
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][4],
self._possible_versions)
def _keys_help(self):
print("Keys help!/Помощь о ключах!")
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][4],
self._possible_keys)
def translate_to(self, language):
self._language = language
for i in range(len(self._main_button)): # 4
self._main_button[i]["text"] = self.strings_lib[self._language][i]
# 4 -- справка.
# 5 -- помощь о движке.
# 6 -- помощь о средстве..
# 7-9 -- использование.
# 10 -- добавление строк/сообщений.
class SLG_CryptoFrame(SLG_MasterFrame):
strings_lib = {
'eng': ('(En/de)cryption',
'Cryptoattacks',
'Choose encrypted main.sd script:',
'Choose output .txt file:',
'Choose the cryptoattack type:',
'Choose the cryptoattack modes:',
'Begin cryptoattack!',
'...',
'...',
'First possible key',
'All possible keys',
'main.sd script',
'main.sd',
'All files',
'*',
'Text files',
'*.txt',
'Error!',
'Cryptoattack type is not correct!',
'Such main.sd script is not exist!',
'Text file with such name cannot be created!',
'i^(key&0xff)',
'(i-(key>>16))&0xff',
'(i+(key>>16))&0xff',
'Choose the processing mode:',
'Choose the input file/folder:',
'Choose the output file/folder:',
'Choose the parameters:',
'Decrypt',
'Encrypt',
'Per file',
'Per folder',
'There is no such input file!',
'There is no such input folder!',
'Output file with such name cannot be created!',
'Output folder with such name cannot be created!',
'The encryption key is incorrect!',
'Input and output files should be different!',
'Input and output folders should be different!'),
'rus': ('(Рас)шифрование',
'Криптоатаки',
'Выберите шифрованный скрипт main.sd:',
'Выберите выходной текстовый файл:',
'Выберите тип криптоатаки:',
'Выберите режимы криптоатаки:',
'Начать криптоатаку!',
'...',
'...',
'Первый возможный ключ',
'Все возможные ключи',
'Скрипт main.sd',
'main.sd',
'Все файлы',
'*',
'Текстовые файлы',
'*.txt',
'Ошибка!',
'Тип криптоатаки некорректен!',
'Такого скрипта main.sd не существует!',
'Текстовый файл с таким названием невозможно создать!',
'i^(key&0xff)',
'(i-(key>>16))&0xff',
'(i+(key>>16))&0xff',
'Выберите режим обработки:',
'Выберите файл/папку ввода:',
'Выберите файл/папку вывода:',
'Выберите параметры:',
'Расшифровать',
'Зашифровать',
'По файлу',
'По папке',
'Нет такого файла (на ввод)!',
'Нет такой папки (на ввод)!',
'Нельзя создать файл с таким названием (на вывод)!',
'Нельзя создать папку с таким названием (на выход)!',
'Ключ шифрования некорректен!',
'Файл на ввод и файл на вывод не должны быть одинаковыми!',
'Папка на ввод и папка на вывод не должны быть одинаковыми!')
}
def __init__(self, master):
super(SLG_CryptoFrame, self).__init__(master)
self.master = master
self["background"] = 'white'
self["relief"] = tk.RAISED
self["borderwidth"] = 5
self._language = ''
self._attack_sd_var = tk.StringVar()
self._attack_txt_var = tk.StringVar()
self._attack_type = tk.StringVar()
first_string = ''
for i in SLG_Crypto.common_script_attacks[0]:
first_string += str(i)
first_string += ' '
first_string = first_string.rstrip()
self._attack_type.set(first_string)
self._attack_mode = tk.IntVar()
self._attack_mode.set(0)
self._attack_mode_two = tk.IntVar()
self._attack_mode_two.set(0)
self._attack_frame = []
for i in range(2):
self._attack_frame.append(tk.LabelFrame(master=self, # Шифрование, криптоатаки.
font=('Helvetica', 14),
bg='white',
relief=tk.RAISED))
self._attack_frame[i].place(relx=0.0 + i * 0.5, rely=0.0, relwidth=0.5, relheight=1.0)
self._attack_label = []
for i in range(4): # .sd, .txt, режим, тип.
self._attack_label.append(tk.Label(
master=self._attack_frame[1],
bg='white',
font=('Helvetica', 10)
))
self._attack_label[i].place(relx=0.0, rely=0.2 * i, relwidth=1.0, relheight=0.1)
self._attack_button = tk.Button(master=self._attack_frame[1],
command=self._cryptoattack,
font=('Helvetica', 14))
self._attack_button.place(relx=0.0, rely=0.9, relwidth=1.0, relheight=0.1)
self._attack_file_text = []
self._attack_file_btn = []
for i in range(2):
self._attack_file_text.append(tk.Entry(
master=self._attack_frame[1],
font=('Helvetica', 8),
borderwidth=5
))
self._attack_file_btn.append(tk.Button(
master=self._attack_frame[1],
relief=tk.RAISED,
font=('Helvetica', 14),
))
widther = 0.85
self._attack_file_text[i].place(relx=0.0, rely=0.1 + (0.2 * i), relwidth=widther, relheight=0.1)
self._attack_file_btn[i].place(relx=widther, rely=0.1 + (0.2 * i), relwidth=1.0 - widther, relheight=0.1)
self._attack_file_btn[0]["command"] = self._attack_what_sd
self._attack_file_text[0]["textvariable"] = self._attack_sd_var
self._attack_file_btn[1]["command"] = self._attack_what_txt
self._attack_file_text[1]["textvariable"] = self._attack_txt_var
self._attack_typer_txt = tk.Entry(
master=self._attack_frame[1],
font=('Helvetica', 8),
borderwidth=5,
textvariable=self._attack_type,
)
self._attack_typer_cmb = ttk.Combobox(
master=self._attack_frame[1],
font=('Helvetica', 12),
values=SLG_Crypto.common_script_attacks,
textvariable=self._attack_type,
state='readonly'
)
self._attack_typer_txt.place(relx=0.0, rely=0.5, relwidth=0.5, relheight=0.1)
self._attack_typer_cmb.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.1)
self._attack_radio = []
for i in range(2):
self._attack_radio.append(tk.Radiobutton(master=self._attack_frame[1],
background='white',
font=('Helvetica', 7),
variable=self._attack_mode,
value=i))
self._attack_radio[i].place(relx=0.0 + (0.5 * i), rely=0.7, relwidth=0.5, relheight=0.1)
self._attack_radio_two = []
for i in range(3):
self._attack_radio_two.append(tk.Radiobutton(master=self._attack_frame[1],
background='white',
font=('Helvetica', 6 + (2 * int(i == 0))),
variable=self._attack_mode_two,
value=i))
self._attack_radio_two[i].place(relx=0.0 + (0.33 * i), rely=0.8, relwidth=0.33, relheight=0.1)
# Подмодуль шифровки/дешифровки:
self._proc_mode = tk.IntVar()
self._proc_mode.set(0)
self._old_proc_mode = self._proc_mode.get()
self._proc_mode.trace_add('write', self._crypto_changer)
self._crypto_input = tk.StringVar()
self._crypto_output = tk.StringVar()
key_variants = []
for i in SLG_Crypto.basic_keys:
new_string = hex(i[0])
new_string += ' - '
new_string += i[1]
key_variants.append(new_string)
key_variants = tuple(key_variants)
self._crypto_key = tk.StringVar()
self._crypto_mode = tk.IntVar()
self._crypto_mode.set(0)
self._crypto_label = []
for i in range(4):
self._crypto_label.append(tk.Label(
master=self._attack_frame[0],
bg='white',
font=('Helvetica', 10)
))
self._crypto_label[i].place(relx=0.0, rely=0.2 * i, relwidth=1.0, relheight=0.1)
self._crypto_main_btn = []
for i in range(2):
self._crypto_main_btn.append(tk.Button(
master=self._attack_frame[0],
relief=tk.RAISED,
font=('Helvetica', 14),
))
self._crypto_main_btn[i].place(relx=0.5 * i, rely=0.9, relwidth=0.5, relheight=0.1)
self._crypto_main_btn[0]["command"] = self._decrypt_base
self._crypto_main_btn[1]["command"] = self._encrypt_base
self._crypto_proc_mode = []
for i in range(2):
self._crypto_proc_mode.append(tk.Radiobutton(master=self._attack_frame[0],
background='white',
font=('Helvetica', 12),
variable=self._proc_mode,
value=i))
self._crypto_proc_mode[i].place(relx=0.5 * i, rely=0.1, relwidth=0.5, relheight=0.1)
self._crypto_file_txt = []
self._crypto_file_btn = []
for i in range(2):
self._crypto_file_txt.append(tk.Entry(
master=self._attack_frame[0],
font=('Helvetica', 8),
borderwidth=5
))
self._crypto_file_btn.append(tk.Button(
master=self._attack_frame[0],
relief=tk.RAISED,
font=('Helvetica', 14),
))
widther = 0.85
self._crypto_file_txt[i].place(relx=0.0, rely=0.3 + (0.2 * i), relwidth=widther, relheight=0.1)
self._crypto_file_btn[i].place(relx=widther, rely=0.3 + (0.2 * i), relwidth=1.0 - widther, relheight=0.1)
self._crypto_file_txt[0]["textvariable"] = self._crypto_input
self._crypto_file_txt[1]["textvariable"] = self._crypto_output
self._crypto_file_btn[0]["command"] = self._crypto_what_input
self._crypto_file_btn[1]["command"] = self._crypto_what_output
self._crypto_typer_txt = tk.Entry(
master=self._attack_frame[0],
font=('Helvetica', 8),
borderwidth=5,
textvariable=self._crypto_key,
)
self._crypto_typer_cmb = ttk.Combobox(
master=self._attack_frame[0],
font=('Helvetica', 12),
values=key_variants,
textvariable=self._crypto_key,
state='readonly'
)
wider = 0.25
self._crypto_typer_txt.place(relx=0.0, rely=0.7, relwidth=wider, relheight=0.1)
self._crypto_typer_cmb.place(relx=wider, rely=0.7, relwidth=1.0 - wider, relheight=0.1)
self._crypto_key.trace_add('write', self._crypto_chkey)
self._crypto_key.set(key_variants[0])
self._crypto_mode_rbtn = []
for i in range(2):
self._crypto_mode_rbtn.append(tk.Radiobutton(master=self._attack_frame[0],
background='white',
font=('Helvetica', 10),
variable=self._crypto_mode,
value=i))
self._crypto_mode_rbtn[i].place(relx=0.5 * i, rely=0.8, relwidth=0.5, relheight=0.1)
self._kill_all_reptiloids = 0
# Методы криптоатак:
def _cryptoattack(self):
input_file = self._attack_sd_var.get()
if (not (os.path.isfile(input_file))):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][19])
return False
output_file = self._attack_txt_var.get()
if (not (os.path.isfile(output_file))):
try:
new_file = open(output_file, 'w')
new_file.close()
except:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][20])
return False
attack_type = self._correct_attack_type(self._attack_type.get())
if (attack_type == False):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][18])
return False
stat = False
if (stat):
print('Входной .sd файл:', input_file)
print('Выходной текстовый файл:', output_file)
print('Тип атаки:', attack_type)
print('Режим атаки:', self._attack_mode.get())
print('Режим атаки два:', self._attack_mode_two.get())
print("Криптоатака начата!/Cryptoattack started!")
self._attack_button["state"] = tk.DISABLED
hack_thread = threading.Thread(target=self._crypto_attack, args=(input_file, attack_type,
self._attack_mode.get(), output_file,
self._attack_mode_two.get()))
hack_thread.start()
return True
def _crypto_attack(self, input_file, attack_type, attack_mode, output_file, attack_mode_two):
try:
HackEmAll = SLG_Crypto(input_file, attack_type, attack_mode, -1)
HackEmAll.attack(output_file, attack_mode_two)
del HackEmAll
except Exception as ex:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17], str(ex))
finally:
self._attack_button["state"] = tk.NORMAL
def _correct_attack_type(self, typer):
new_type = []
exer = typer.split(' ')
try:
for i in exer:
new_type.append(int(i))
except:
return False
return tuple(new_type)
def _attack_what_sd(self):
ftypes = [(self.strings_lib[self._language][11], self.strings_lib[self._language][12]),
(self.strings_lib[self._language][13], self.strings_lib[self._language][14])]
dialg = filedialog.Open(self._attack_frame[1], filetypes=ftypes, initialdir=os.getcwd())
file = dialg.show()
if (file != ''):
self._attack_sd_var.set(file)
def _attack_what_txt(self):
ftypes = [(self.strings_lib[self._language][15], self.strings_lib[self._language][16]),
(self.strings_lib[self._language][13], self.strings_lib[self._language][14])]
dialg = filedialog.Open(self._attack_frame[1], filetypes=ftypes, initialdir=os.getcwd())
file = dialg.show()
if (file != ''):
self._attack_txt_var.set(file)
# Методы (де)шифрования:
def _encrypt_base(self):
def _enc_thread_start(inper, outer):
for i in range(len(self._crypto_main_btn)):
self._crypto_main_btn[i]["state"] = tk.DISABLED
print('Encryption/Шифрование:', inper, '->', outer)
enc_thread = threading.Thread(target=self._encrypt, args=(inper,
outer,
int(self._crypto_key.get(), 16),
self._crypto_mode.get()))
enc_thread.start()
if (not (self._crypto_is_correct_data())):
return False
if (self._proc_mode.get() == 0): # Файл.
_enc_thread_start(self._crypto_input.get(), self._crypto_output.get())
else: # Директория.
for root, dirs, files in os.walk(self._crypto_input.get()):
self._kill_all_reptiloids = len(files)
for file in files:
new_file_base = os.path.join(root, file)[len(self._crypto_input.get()) + 1:]
new_file_in = os.path.join(self._crypto_input.get(), new_file_base)
new_file_out = os.path.join(self._crypto_output.get(), new_file_base)
# print(new_file_base, ":", new_file_in, new_file_out)
_enc_thread_start(new_file_in, new_file_out)
return True
def _encrypt(self, input_file, output_file, enc_key, enc_mode):
try:
EncryptEmAll = SLG_Crypto(input_file, (2, 0, 0, 2, 0), 0, enc_key)
EncryptEmAll.encrypt(output_file, enc_mode)
del EncryptEmAll
except Exception as ex:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17], str(ex))
finally:
self._kill_all_reptiloids -= 1
if (self._kill_all_reptiloids <= 0):
for i in range(len(self._crypto_main_btn)):
self._crypto_main_btn[i]["state"] = tk.NORMAL
def _decrypt_base(self):
def _dec_thread_start(inper, outer):
for i in range(len(self._crypto_main_btn)):
self._crypto_main_btn[i]["state"] = tk.DISABLED
print('Decryption/Дешифрование:', inper, '->', outer)
dec_thread = threading.Thread(target=self._decrypt, args=(inper,
outer,
int(self._crypto_key.get(), 16),
self._crypto_mode.get()))
dec_thread.start()
if (not (self._crypto_is_correct_data())):
return False
if (self._proc_mode.get() == 0): # Файл.
_dec_thread_start(self._crypto_input.get(), self._crypto_output.get())
else: # Директория.
for root, dirs, files in os.walk(self._crypto_input.get()):
self._kill_all_reptiloids = len(files)
for file in files:
new_file_base = os.path.join(root, file)[len(self._crypto_input.get()) + 1:]
new_file_in = os.path.join(self._crypto_input.get(), new_file_base)
new_file_out = os.path.join(self._crypto_output.get(), new_file_base)
# print(new_file_base, ":", new_file_in, new_file_out)
_dec_thread_start(new_file_in, new_file_out)
return True
def _decrypt(self, input_file, output_file, enc_key, enc_mode):
try:
DecryptEmAll = SLG_Crypto(input_file, (2, 0, 0, 2, 0), 0, enc_key)
DecryptEmAll.decrypt(output_file, enc_mode)
del DecryptEmAll
except Exception as ex:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17], str(ex))
finally:
self._kill_all_reptiloids -= 1
if (self._kill_all_reptiloids <= 0):
for i in range(len(self._crypto_main_btn)):
self._crypto_main_btn[i]["state"] = tk.NORMAL
def _crypto_is_correct_data(self):
if (self._proc_mode.get() == 0): # Файл.
if (not (os.path.isfile(self._crypto_input.get()))):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][32])
return False
if (not (os.path.isfile(self._crypto_output.get()))):
try:
if (os.path.split(self._crypto_output.get())[0] != ''):
os.makedirs(os.path.split(self._crypto_output.get())[0], exist_ok=True)
zlo = open(self._crypto_output.get(), 'wb')
zlo.close()
except:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][34])
return False
if (self._crypto_output.get() == self._crypto_input.get()):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][37])
return False
else: # Директория.
if (not (os.path.isdir(self._crypto_input.get()))):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][33])
return False
if (not (os.path.isdir(self._crypto_output.get()))):
try:
os.makedirs(self._crypto_output.get(), exist_ok=True)
except:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][35])
return False
if (self._crypto_output.get() == self._crypto_input.get()):
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][38])
return False
try:
int(self._crypto_key.get(), 16)
except:
SLGScriptTool_GUI.show_message(self, self.strings_lib[self._language][17],
self.strings_lib[self._language][36])
return False
return True
def _crypto_what_input(self):
if (self._proc_mode.get() == 0): # По файлу.
ftypes = [(self.strings_lib[self._language][13], self.strings_lib[self._language][14])]
dialg = filedialog.Open(self._attack_frame[0], filetypes=ftypes, initialdir=os.getcwd())
file = dialg.show()
if (file != ''):
self._crypto_input.set(file)
else: # По папке.
direr = filedialog.askdirectory()
if (direr != ''):
self._crypto_input.set(direr)
def _crypto_what_output(self):
if (self._proc_mode.get() == 0): # По файлу.
ftypes = [(self.strings_lib[self._language][13], self.strings_lib[self._language][14])]
dialg = filedialog.Open(self._attack_frame[0], filetypes=ftypes, initialdir=os.getcwd())
file = dialg.show()
if (file != ''):
self._crypto_output.set(file)
else: # По папке.
direr = filedialog.askdirectory()
if (direr != ''):
self._crypto_output.set(direr)
def _crypto_changer(self, *args):
if (self._old_proc_mode == self._proc_mode.get()):
return False
else:
self._old_proc_mode = self._proc_mode.get()
if (self._old_proc_mode == 0):
self._crypto_input.set('')
self._crypto_output.set('')
else:
self._crypto_input.set(os.path.split(self._crypto_input.get())[0])
self._crypto_output.set(os.path.split(self._crypto_output.get())[0])
return True
def _crypto_chkey(self, *args):
true_key = self._crypto_key.get().split(' - ')[0]
self._crypto_key.set(true_key)
# self._crypto_typer_txt["textvariable"] = self._crypto_key
# self._crypto_typer_cmb["textvariable"] = self._crypto_key
self._crypto_typer_txt.update()
self._crypto_typer_cmb.update()
# Прочие методы:
def translate_to(self, language):
self._language = language
for i in range(len(self._attack_frame)): # 2
self._attack_frame[i]["text"] = self.strings_lib[language][i]
for i in range(len(self._attack_label)): # 4
self._attack_label[i]["text"] = self.strings_lib[language][i + 2]
self._attack_button["text"] = self.strings_lib[language][6] # 1
for i in range(len(self._attack_file_btn)): # 2
self._attack_file_btn[i]["text"] = self.strings_lib[language][i + 7]
for i in range(len(self._attack_radio)): # 2
self._attack_radio[i]["text"] = self.strings_lib[language][i + 9]
for i in range(len(self._attack_radio_two)): # 3
self._attack_radio_two[i]["text"] = self.strings_lib[language][i + 21]
# 24+
for i in range(len(self._crypto_label)): # 4
self._crypto_label[i]["text"] = self.strings_lib[language][i + 24]
for i in range(len(self._crypto_main_btn)): # 2
self._crypto_main_btn[i]["text"] = self.strings_lib[language][i + 28]
for i in range(len(self._crypto_proc_mode)): # 2
self._crypto_proc_mode[i]["text"] = self.strings_lib[language][i + 30]
for i in range(len(self._crypto_file_btn)): # Не считается!