-
Notifications
You must be signed in to change notification settings - Fork 48
/
subbrute_protocols.c
902 lines (815 loc) · 27.1 KB
/
subbrute_protocols.c
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
#include "subbrute_protocols.h"
#include "math.h"
#define TAG "SubBruteProtocols"
/**
* CAME 12bit 303MHz
*/
const SubBruteProtocol subbrute_protocol_came_12bit_303 = {
.frequency = 303875000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = CAMEFileProtocol};
/**
* CAME 12bit 307MHz
*/
const SubBruteProtocol subbrute_protocol_came_12bit_307 = {
.frequency = 307800000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = CAMEFileProtocol};
/**
* CAME 12bit 315MHz
*/
const SubBruteProtocol subbrute_protocol_came_12bit_315 = {
.frequency = 315000000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = CAMEFileProtocol};
/**
* CAME 12bit 330MHz
*/
const SubBruteProtocol subbrute_protocol_came_12bit_330 = {
.frequency = 330000000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = CAMEFileProtocol};
/**
* CAME 12bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_came_12bit_433 = {
.frequency = 433920000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = CAMEFileProtocol};
/**
* CAME 12bit 868MHz
*/
const SubBruteProtocol subbrute_protocol_came_12bit_868 = {
.frequency = 868350000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = CAMEFileProtocol};
/**
* NICE 12bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_nice_12bit_433 = {
.frequency = 433920000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = NICEFileProtocol};
/**
* NICE 12bit 868MHz
*/
const SubBruteProtocol subbrute_protocol_nice_12bit_868 = {
.frequency = 868350000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = NICEFileProtocol};
/**
* Ansonic 12bit 433.075MHz
*/
const SubBruteProtocol subbrute_protocol_ansonic_12bit_433075 = {
.frequency = 433075000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPreset2FSKDev238Async,
.file = AnsonicFileProtocol};
/**
* Ansonic 12bit 433.92MHz
*/
const SubBruteProtocol subbrute_protocol_ansonic_12bit_433 = {
.frequency = 433920000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPreset2FSKDev238Async,
.file = AnsonicFileProtocol};
/**
* Ansonic 12bit 434.075MHz
*/
const SubBruteProtocol subbrute_protocol_ansonic_12bit_434 = {
.frequency = 434075000,
.bits = 12,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPreset2FSKDev238Async,
.file = AnsonicFileProtocol};
/**
* Chamberlain 9bit 300MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_9bit_300 = {
.frequency = 300000000,
.bits = 9,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 9bit 315MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_9bit_315 = {
.frequency = 315000000,
.bits = 9,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 9bit 318MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_9bit_318 = {
.frequency = 318000000,
.bits = 9,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 9bit 390MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_9bit_390 = {
.frequency = 390000000,
.bits = 9,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 9bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_9bit_433 = {
.frequency = 433920000,
.bits = 9,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 8bit 300MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_8bit_300 = {
.frequency = 300000000,
.bits = 8,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 8bit 315MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_8bit_315 = {
.frequency = 315000000,
.bits = 8,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 8bit 390MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_8bit_390 = {
.frequency = 390000000,
.bits = 8,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 7bit 300MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_7bit_300 = {
.frequency = 300000000,
.bits = 7,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 7bit 315MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_7bit_315 = {
.frequency = 315000000,
.bits = 7,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Chamberlain 7bit 390MHz
*/
const SubBruteProtocol subbrute_protocol_chamberlain_7bit_390 = {
.frequency = 390000000,
.bits = 7,
.te = 0,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = ChamberlainFileProtocol};
/**
* Linear 10bit 300MHz
*/
const SubBruteProtocol subbrute_protocol_linear_10bit_300 = {
.frequency = 300000000,
.bits = 10,
.te = 0,
.repeat = 5,
.preset = FuriHalSubGhzPresetOok650Async,
.file = LinearFileProtocol};
/**
* Linear 10bit 310MHz
*/
const SubBruteProtocol subbrute_protocol_linear_10bit_310 = {
.frequency = 310000000,
.bits = 10,
.te = 0,
.repeat = 5,
.preset = FuriHalSubGhzPresetOok650Async,
.file = LinearFileProtocol};
/**
* Linear Delta 3 8bit 310MHz
*/
const SubBruteProtocol subbrute_protocol_linear_delta_8bit_310 = {
.frequency = 310000000,
.bits = 8,
.te = 0,
.repeat = 5,
.preset = FuriHalSubGhzPresetOok650Async,
.file = LinearDeltaFileProtocol};
/**
* UNILARM 24bit 330MHz
*/
const SubBruteProtocol subbrute_protocol_unilarm_24bit_330 = {
.frequency = 330000000,
.bits = 25,
.te = 209,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = UNILARMFileProtocol};
/**
* UNILARM 24bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_unilarm_24bit_433 = {
.frequency = 433920000,
.bits = 25,
.te = 209,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = UNILARMFileProtocol};
/**
* SMC5326 24bit 330MHz
*/
const SubBruteProtocol subbrute_protocol_smc5326_24bit_330 = {
.frequency = 330000000,
.bits = 25,
.te = 320,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = SMC5326FileProtocol};
/**
* SMC5326 24bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_smc5326_24bit_433 = {
.frequency = 433920000,
.bits = 25,
.te = 320,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = SMC5326FileProtocol};
/**
* PT2260 (Princeton) 24bit 315MHz
*/
const SubBruteProtocol subbrute_protocol_pt2260_24bit_315 = {
.frequency = 315000000,
.bits = 24,
.te = 286,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = PT2260FileProtocol};
/**
* PT2260 (Princeton) 24bit 330MHz
*/
const SubBruteProtocol subbrute_protocol_pt2260_24bit_330 = {
.frequency = 330000000,
.bits = 24,
.te = 286,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = PT2260FileProtocol};
/**
* PT2260 (Princeton) 24bit 390MHz
*/
const SubBruteProtocol subbrute_protocol_pt2260_24bit_390 = {
.frequency = 390000000,
.bits = 24,
.te = 286,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = PT2260FileProtocol};
/**
* PT2260 (Princeton) 24bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_pt2260_24bit_433 = {
.frequency = 433920000,
.bits = 24,
.te = 286,
.repeat = 4,
.preset = FuriHalSubGhzPresetOok650Async,
.file = PT2260FileProtocol};
/**
* Holtek FM 12bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_holtek_12bit_433 = {
.frequency = 433920000,
.bits = 12,
.te = 204,
.repeat = 4,
.preset = FuriHalSubGhzPreset2FSKDev476Async,
.file = HoltekFileProtocol};
/**
* Holtek AM 12bit 433MHz
*/
const SubBruteProtocol subbrute_protocol_holtek_12bit_am_433 = {
.frequency = 433920000,
.bits = 12,
.te = 433,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = HoltekFileProtocol};
/**
* Holtek AM 12bit 315MHz
*/
const SubBruteProtocol subbrute_protocol_holtek_12bit_am_315 = {
.frequency = 315000000,
.bits = 12,
.te = 433,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = HoltekFileProtocol};
/**
* Holtek AM 12bit 868MHz
*/
const SubBruteProtocol subbrute_protocol_holtek_12bit_am_868 = {
.frequency = 868350000,
.bits = 12,
.te = 433,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = HoltekFileProtocol};
/**
* Holtek AM 12bit 915MHz
*/
const SubBruteProtocol subbrute_protocol_holtek_12bit_am_915 = {
.frequency = 915000000,
.bits = 12,
.te = 433,
.repeat = 3,
.preset = FuriHalSubGhzPresetOok650Async,
.file = HoltekFileProtocol};
/**
* BF existing dump
*/
const SubBruteProtocol subbrute_protocol_load_file =
{0, 0, 0, 3, FuriHalSubGhzPresetOok650Async, UnknownFileProtocol};
static const char* subbrute_protocol_names[] = {
[SubBruteAttackCAME12bit303] = "CAME 12bit 303MHz",
[SubBruteAttackCAME12bit307] = "CAME 12bit 307MHz",
[SubBruteAttackCAME12bit315] = "CAME 12bit 315MHz",
[SubBruteAttackCAME12bit330] = "CAME 12bit 330MHz",
[SubBruteAttackCAME12bit433] = "CAME 12bit 433MHz",
[SubBruteAttackCAME12bit868] = "CAME 12bit 868MHz",
[SubBruteAttackNICE12bit433] = "NICE 12bit 433MHz",
[SubBruteAttackNICE12bit868] = "NICE 12bit 868MHz",
[SubBruteAttackAnsonic12bit433075] = "Ansonic 12bit 433.07MHz",
[SubBruteAttackAnsonic12bit433] = "Ansonic 12bit 433.92MHz",
[SubBruteAttackAnsonic12bit434] = "Ansonic 12bit 434.07MHz",
[SubBruteAttackHoltek12bitFM433] = "Holtek FM 12bit 433MHz",
[SubBruteAttackHoltek12bitAM433] = "Holtek AM 12bit 433MHz",
[SubBruteAttackHoltek12bitAM315] = "Holtek AM 12bit 315MHz",
[SubBruteAttackHoltek12bitAM868] = "Holtek AM 12bit 868MHz",
[SubBruteAttackHoltek12bitAM915] = "Holtek AM 12bit 915MHz",
[SubBruteAttackChamberlain9bit300] = "Chamberlain 9bit 300MHz",
[SubBruteAttackChamberlain9bit315] = "Chamberlain 9bit 315MHz",
[SubBruteAttackChamberlain9bit318] = "Chamberlain 9bit 318MHz",
[SubBruteAttackChamberlain9bit390] = "Chamberlain 9bit 390MHz",
[SubBruteAttackChamberlain9bit433] = "Chamberlain 9bit 433MHz",
[SubBruteAttackChamberlain8bit300] = "Chamberlain 8bit 300MHz",
[SubBruteAttackChamberlain8bit315] = "Chamberlain 8bit 315MHz",
[SubBruteAttackChamberlain8bit390] = "Chamberlain 8bit 390MHz",
[SubBruteAttackChamberlain7bit300] = "Chamberlain 7bit 300MHz",
[SubBruteAttackChamberlain7bit315] = "Chamberlain 7bit 315MHz",
[SubBruteAttackChamberlain7bit390] = "Chamberlain 7bit 390MHz",
[SubBruteAttackLinear10bit300] = "Linear 10bit 300MHz",
[SubBruteAttackLinear10bit310] = "Linear 10bit 310MHz",
[SubBruteAttackLinearDelta8bit310] = "LinearDelta3 8bit 310MHz",
[SubBruteAttackUNILARM24bit330] = "UNILARM 25bit 330MHz",
[SubBruteAttackUNILARM24bit433] = "UNILARM 25bit 433MHz",
[SubBruteAttackSMC532624bit330] = "SMC5326 25bit 330MHz",
[SubBruteAttackSMC532624bit433] = "SMC5326 25bit 433MHz",
[SubBruteAttackPT226024bit315] = "PT2260 24bit 315MHz",
[SubBruteAttackPT226024bit330] = "PT2260 24bit 330MHz",
[SubBruteAttackPT226024bit390] = "PT2260 24bit 390MHz",
[SubBruteAttackPT226024bit433] = "PT2260 24bit 433MHz",
[SubBruteAttackLoadFile] = "BF existing dump",
[SubBruteAttackTotalCount] = "Total Count",
};
static const char* subbrute_protocol_presets[] = {
[FuriHalSubGhzPresetIDLE] = "FuriHalSubGhzPresetIDLE",
[FuriHalSubGhzPresetOok270Async] = "FuriHalSubGhzPresetOok270Async",
[FuriHalSubGhzPresetOok650Async] = "FuriHalSubGhzPresetOok650Async",
[FuriHalSubGhzPreset2FSKDev238Async] = "FuriHalSubGhzPreset2FSKDev238Async",
[FuriHalSubGhzPreset2FSKDev476Async] = "FuriHalSubGhzPreset2FSKDev476Async",
[FuriHalSubGhzPresetMSK99_97KbAsync] = "FuriHalSubGhzPresetMSK99_97KbAsync",
[FuriHalSubGhzPresetGFSK9_99KbAsync] = "FuriHalSubGhzPresetGFSK9_99KbAsync",
};
const SubBruteProtocol* subbrute_protocol_registry[] = {
[SubBruteAttackCAME12bit303] = &subbrute_protocol_came_12bit_303,
[SubBruteAttackCAME12bit307] = &subbrute_protocol_came_12bit_307,
[SubBruteAttackCAME12bit315] = &subbrute_protocol_came_12bit_315,
[SubBruteAttackCAME12bit330] = &subbrute_protocol_came_12bit_330,
[SubBruteAttackCAME12bit433] = &subbrute_protocol_came_12bit_433,
[SubBruteAttackCAME12bit868] = &subbrute_protocol_came_12bit_868,
[SubBruteAttackNICE12bit433] = &subbrute_protocol_nice_12bit_433,
[SubBruteAttackNICE12bit868] = &subbrute_protocol_nice_12bit_868,
[SubBruteAttackAnsonic12bit433075] = &subbrute_protocol_ansonic_12bit_433075,
[SubBruteAttackAnsonic12bit433] = &subbrute_protocol_ansonic_12bit_433,
[SubBruteAttackAnsonic12bit434] = &subbrute_protocol_ansonic_12bit_434,
[SubBruteAttackHoltek12bitFM433] = &subbrute_protocol_holtek_12bit_433,
[SubBruteAttackHoltek12bitAM433] = &subbrute_protocol_holtek_12bit_am_433,
[SubBruteAttackHoltek12bitAM315] = &subbrute_protocol_holtek_12bit_am_315,
[SubBruteAttackHoltek12bitAM868] = &subbrute_protocol_holtek_12bit_am_868,
[SubBruteAttackHoltek12bitAM915] = &subbrute_protocol_holtek_12bit_am_915,
[SubBruteAttackChamberlain9bit300] = &subbrute_protocol_chamberlain_9bit_300,
[SubBruteAttackChamberlain9bit315] = &subbrute_protocol_chamberlain_9bit_315,
[SubBruteAttackChamberlain9bit318] = &subbrute_protocol_chamberlain_9bit_318,
[SubBruteAttackChamberlain9bit390] = &subbrute_protocol_chamberlain_9bit_390,
[SubBruteAttackChamberlain9bit433] = &subbrute_protocol_chamberlain_9bit_433,
[SubBruteAttackChamberlain8bit300] = &subbrute_protocol_chamberlain_8bit_300,
[SubBruteAttackChamberlain8bit315] = &subbrute_protocol_chamberlain_8bit_315,
[SubBruteAttackChamberlain8bit390] = &subbrute_protocol_chamberlain_8bit_390,
[SubBruteAttackChamberlain7bit300] = &subbrute_protocol_chamberlain_7bit_300,
[SubBruteAttackChamberlain7bit315] = &subbrute_protocol_chamberlain_7bit_315,
[SubBruteAttackChamberlain7bit390] = &subbrute_protocol_chamberlain_7bit_390,
[SubBruteAttackLinear10bit300] = &subbrute_protocol_linear_10bit_300,
[SubBruteAttackLinear10bit310] = &subbrute_protocol_linear_10bit_310,
[SubBruteAttackLinearDelta8bit310] = &subbrute_protocol_linear_delta_8bit_310,
[SubBruteAttackUNILARM24bit330] = &subbrute_protocol_unilarm_24bit_330,
[SubBruteAttackUNILARM24bit433] = &subbrute_protocol_unilarm_24bit_433,
[SubBruteAttackSMC532624bit330] = &subbrute_protocol_smc5326_24bit_330,
[SubBruteAttackSMC532624bit433] = &subbrute_protocol_smc5326_24bit_433,
[SubBruteAttackPT226024bit315] = &subbrute_protocol_pt2260_24bit_315,
[SubBruteAttackPT226024bit330] = &subbrute_protocol_pt2260_24bit_330,
[SubBruteAttackPT226024bit390] = &subbrute_protocol_pt2260_24bit_390,
[SubBruteAttackPT226024bit433] = &subbrute_protocol_pt2260_24bit_433,
[SubBruteAttackLoadFile] = &subbrute_protocol_load_file};
static const char* subbrute_protocol_file_types[] = {
[CAMEFileProtocol] = "CAME",
[NICEFileProtocol] = "Nice FLO",
[ChamberlainFileProtocol] = "Cham_Code",
[LinearFileProtocol] = "Linear",
[LinearDeltaFileProtocol] = "LinearDelta3",
[PrincetonFileProtocol] = "Princeton",
[RAWFileProtocol] = "RAW",
[BETTFileProtocol] = "BETT",
[ClemsaFileProtocol] = "Clemsa",
[DoitrandFileProtocol] = "Doitrand",
[GateTXFileProtocol] = "GateTX",
[MagellanFileProtocol] = "Magellan",
[IntertechnoV3FileProtocol] = "Intertechno_V3",
[AnsonicFileProtocol] = "Ansonic",
[SMC5326FileProtocol] = "SMC5326",
[UNILARMFileProtocol] = "SMC5326",
[PT2260FileProtocol] = "Princeton",
[HoneywellFileProtocol] = "Honeywell",
[HoltekFileProtocol] = "Holtek_HT12X",
[LegrandFileProtocol] = "Legrand",
[HollarmileProtocol] = "Hollarm",
[GangQiFileProtocol] = "GangQi",
[Marantec24FileProtocol] = "Marantec24",
[UnknownFileProtocol] = "Unknown"};
/**
* Values to not use less memory for packet parse operations
*/
static const char* subbrute_key_file_start_no_tail =
"Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\n";
static const char* subbrute_key_file_start_with_tail =
"Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\nTE: %d\n";
static const char* subbrute_key_small_no_tail = "Bit: %d\nKey: %s\nRepeat: %d\n";
//static const char* subbrute_key_small_raw =
// "Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\n";
static const char* subbrute_key_small_with_tail = "Bit: %d\nKey: %s\nTE: %d\nRepeat: %d\n";
const uint8_t lut_uni_alarm_smsc[] = {0x00, 0x02, 0x03}; // 00, 10, 11
const uint8_t lut_pt2260[] = {0x00, 0x01, 0x03}; // 00, 01, 11
const uint64_t gate_smsc = 0x01D5; // 111010101
//const uint8_t gate2 = 0x0175; // 101110101
const uint64_t gate_pt2260 = 0x03; // 11
//const uint8_t button_lock = 0x0C; // 1100
//const uint8_t button_stop = 0x30; // 110000
//const uint8_t button_close = 0xC0; // 11000000
const uint64_t gate_uni_alarm = 3 << 7;
//const uint8_t gate2 = 3 << 5;
const char* subbrute_protocol_name(SubBruteAttacks index) {
return subbrute_protocol_names[index];
}
const SubBruteProtocol* subbrute_protocol(SubBruteAttacks index) {
return subbrute_protocol_registry[index];
}
uint8_t subbrute_protocol_repeats_count(SubBruteAttacks index) {
return subbrute_protocol_registry[index]->repeat;
}
const char* subbrute_protocol_preset(FuriHalSubGhzPreset preset) {
return subbrute_protocol_presets[preset];
}
const char* subbrute_protocol_file(SubBruteFileProtocol protocol) {
return subbrute_protocol_file_types[protocol];
}
FuriHalSubGhzPreset subbrute_protocol_convert_preset(FuriString* preset_name) {
for(size_t i = FuriHalSubGhzPresetIDLE; i < FuriHalSubGhzPresetCustom; i++) {
if(furi_string_cmp_str(preset_name, subbrute_protocol_presets[i]) == 0) {
return i;
}
}
return FuriHalSubGhzPresetIDLE;
}
SubBruteFileProtocol subbrute_protocol_file_protocol_name(FuriString* name) {
for(size_t i = CAMEFileProtocol; i < TotalFileProtocol - 1; i++) {
if(furi_string_cmp_str(name, subbrute_protocol_file_types[i]) == 0) {
return i;
}
}
return UnknownFileProtocol;
}
void subbrute_protocol_create_candidate_for_existing_file(
FuriString* candidate,
uint64_t step,
size_t bit_index,
uint64_t file_key,
bool two_bytes) {
uint8_t p[8] = {0};
for(int i = 0; i < 8; i++) {
p[i] = (uint8_t)(file_key >> 8 * (7 - i)) & 0xFF;
}
uint8_t low_byte = step & (0xff);
uint8_t high_byte = (step >> 8) & 0xff;
size_t size = sizeof(uint64_t);
for(size_t i = 0; i < size; i++) {
if(i == bit_index - 1 && two_bytes) {
furi_string_cat_printf(candidate, "%02X %02X", high_byte, low_byte);
i++;
} else if(i == bit_index) {
furi_string_cat_printf(candidate, "%02X", low_byte);
} else if(p[i] != 0) {
furi_string_cat_printf(candidate, "%02X", p[i]);
} else {
furi_string_cat_printf(candidate, "%s", "00");
}
if(i < size - 1) {
furi_string_push_back(candidate, ' ');
}
}
#ifdef FURI_DEBUG
FURI_LOG_D(TAG, "file candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
#endif
}
void subbrute_protocol_create_candidate_for_default(
FuriString* candidate,
SubBruteFileProtocol file,
uint64_t step) {
uint8_t p[8] = {0};
uint64_t total = 0;
if(file == SMC5326FileProtocol) {
for(size_t j = 0; j < 8; j++) {
total |= lut_uni_alarm_smsc[step % 3] << (2 * j);
double sub_step = (double)step / 3;
step = (uint64_t)floor(sub_step);
}
total <<= 9;
total |= gate_smsc;
for(int i = 0; i < 8; i++) {
p[i] = (uint8_t)(total >> 8 * (7 - i)) & 0xFF;
}
} else if(file == UNILARMFileProtocol) {
for(size_t j = 0; j < 8; j++) {
total |= lut_uni_alarm_smsc[step % 3] << (2 * j);
double sub_step = (double)step / 3;
step = (uint64_t)floor(sub_step);
}
total <<= 9;
total |= gate_uni_alarm;
for(int i = 0; i < 8; i++) {
p[i] = (uint8_t)(total >> 8 * (7 - i)) & 0xFF;
}
} else if(file == PT2260FileProtocol) {
for(size_t j = 0; j < 8; j++) {
total |= lut_pt2260[step % 3] << (2 * j);
double sub_step = (double)step / 3;
step = (uint64_t)floor(sub_step);
}
total <<= 8;
total |= gate_pt2260;
for(int i = 0; i < 8; i++) {
p[i] = (uint8_t)(total >> 8 * (7 - i)) & 0xFF;
}
} else {
for(int i = 0; i < 8; i++) {
p[i] = (uint8_t)(step >> 8 * (7 - i)) & 0xFF;
}
}
size_t size = sizeof(uint64_t);
for(size_t i = 0; i < size; i++) {
if(p[i] != 0) {
furi_string_cat_printf(candidate, "%02X", p[i]);
} else {
furi_string_cat_printf(candidate, "%s", "00");
}
if(i < size - 1) {
furi_string_push_back(candidate, ' ');
}
}
#ifdef FURI_DEBUG
FURI_LOG_D(TAG, "candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
#endif
}
void subbrute_protocol_default_payload(
Stream* stream,
SubBruteFileProtocol file,
uint64_t step,
uint8_t bits,
uint32_t te,
uint8_t repeat) {
FuriString* candidate = furi_string_alloc();
subbrute_protocol_create_candidate_for_default(candidate, file, step);
#ifdef FURI_DEBUG
FURI_LOG_D(
TAG,
"candidate: %s, step: %lld, repeat: %d, te: %s",
furi_string_get_cstr(candidate),
step,
repeat,
te ? "true" : "false");
#endif
stream_clean(stream);
if(te) {
stream_write_format(
stream,
subbrute_key_small_with_tail,
bits,
furi_string_get_cstr(candidate),
te,
repeat);
} else {
stream_write_format(
stream, subbrute_key_small_no_tail, bits, furi_string_get_cstr(candidate), repeat);
}
furi_string_free(candidate);
}
void subbrute_protocol_file_payload(
Stream* stream,
uint64_t step,
uint8_t bits,
uint32_t te,
uint8_t repeat,
uint8_t bit_index,
uint64_t file_key,
bool two_bytes) {
FuriString* candidate = furi_string_alloc();
subbrute_protocol_create_candidate_for_existing_file(
candidate, step, bit_index, file_key, two_bytes);
#ifdef FURI_DEBUG
FURI_LOG_D(
TAG,
"candidate: %s, step: %lld, repeat: %d, te: %s",
furi_string_get_cstr(candidate),
step,
repeat,
te ? "true" : "false");
#endif
stream_clean(stream);
if(te) {
stream_write_format(
stream,
subbrute_key_small_with_tail,
bits,
furi_string_get_cstr(candidate),
te,
repeat);
} else {
stream_write_format(
stream, subbrute_key_small_no_tail, bits, furi_string_get_cstr(candidate), repeat);
}
furi_string_free(candidate);
}
void subbrute_protocol_default_generate_file(
Stream* stream,
uint32_t frequency,
FuriHalSubGhzPreset preset,
SubBruteFileProtocol file,
uint64_t step,
uint8_t bits,
uint32_t te) {
FuriString* candidate = furi_string_alloc();
subbrute_protocol_create_candidate_for_default(candidate, file, step);
#ifdef FURI_DEBUG
FURI_LOG_D(TAG, "candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
#endif
stream_clean(stream);
if(te) {
stream_write_format(
stream,
subbrute_key_file_start_with_tail,
frequency,
subbrute_protocol_preset(preset),
subbrute_protocol_file(file),
bits,
furi_string_get_cstr(candidate),
te);
} else {
stream_write_format(
stream,
subbrute_key_file_start_no_tail,
frequency,
subbrute_protocol_preset(preset),
subbrute_protocol_file(file),
bits,
furi_string_get_cstr(candidate));
}
furi_string_free(candidate);
}
void subbrute_protocol_file_generate_file(
Stream* stream,
uint32_t frequency,
FuriHalSubGhzPreset preset,
SubBruteFileProtocol file,
uint64_t step,
uint8_t bits,
uint32_t te,
uint8_t bit_index,
uint64_t file_key,
bool two_bytes) {
FuriString* candidate = furi_string_alloc();
subbrute_protocol_create_candidate_for_existing_file(
candidate, step, bit_index, file_key, two_bytes);
stream_clean(stream);
if(te) {
stream_write_format(
stream,
subbrute_key_file_start_with_tail,
frequency,
subbrute_protocol_preset(preset),
subbrute_protocol_file(file),
bits,
furi_string_get_cstr(candidate),
te);
} else {
stream_write_format(
stream,
subbrute_key_file_start_no_tail,
frequency,
subbrute_protocol_preset(preset),
subbrute_protocol_file(file),
bits,
furi_string_get_cstr(candidate));
}
furi_string_free(candidate);
}
uint64_t
subbrute_protocol_calc_max_value(SubBruteAttacks attack_type, uint8_t bits, bool two_bytes) {
uint64_t max_value;
if(attack_type == SubBruteAttackLoadFile) {
max_value = two_bytes ? 0xFFFF : 0xFF;
} else if(
attack_type == SubBruteAttackSMC532624bit330 ||
attack_type == SubBruteAttackSMC532624bit433 ||
attack_type == SubBruteAttackUNILARM24bit330 ||
attack_type == SubBruteAttackUNILARM24bit433 ||
attack_type == SubBruteAttackPT226024bit315 ||
attack_type == SubBruteAttackPT226024bit330 ||
attack_type == SubBruteAttackPT226024bit390 ||
attack_type == SubBruteAttackPT226024bit433) {
max_value = 6561;
} else {
FuriString* max_value_s;
max_value_s = furi_string_alloc();
for(uint8_t i = 0; i < bits; i++) {
furi_string_cat_printf(max_value_s, "1");
}
max_value = (uint64_t)strtol(furi_string_get_cstr(max_value_s), NULL, 2);
furi_string_free(max_value_s);
}
return max_value;
}