|
@@ -1,4 +1,5 @@
|
|
|
#include "subbrute_protocols.h"
|
|
#include "subbrute_protocols.h"
|
|
|
|
|
+#include "math.h"
|
|
|
#include <string.h>
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define TAG "SubBruteProtocols"
|
|
#define TAG "SubBruteProtocols"
|
|
@@ -245,6 +246,94 @@ const SubBruteProtocol subbrute_protocol_linear_10bit_310 = {
|
|
|
.preset = FuriHalSubGhzPresetOok650Async,
|
|
.preset = FuriHalSubGhzPresetOok650Async,
|
|
|
.file = LinearFileProtocol};
|
|
.file = LinearFileProtocol};
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * UNILARM 24bit 330MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_unilarm_24bit_330 = {
|
|
|
|
|
+ .frequency = 330000000,
|
|
|
|
|
+ .bits = 25,
|
|
|
|
|
+ .te = 209,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = UNILARMFileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * UNILARM 24bit 433MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_unilarm_24bit_433 = {
|
|
|
|
|
+ .frequency = 433920000,
|
|
|
|
|
+ .bits = 25,
|
|
|
|
|
+ .te = 209,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = UNILARMFileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * SMC5326 24bit 330MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_smc5326_24bit_330 = {
|
|
|
|
|
+ .frequency = 330000000,
|
|
|
|
|
+ .bits = 25,
|
|
|
|
|
+ .te = 320,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = SMC5326FileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * SMC5326 24bit 433MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_smc5326_24bit_433 = {
|
|
|
|
|
+ .frequency = 433920000,
|
|
|
|
|
+ .bits = 25,
|
|
|
|
|
+ .te = 320,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = SMC5326FileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * PT2260 (Princeton) 24bit 315MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_pt2260_24bit_315 = {
|
|
|
|
|
+ .frequency = 315000000,
|
|
|
|
|
+ .bits = 24,
|
|
|
|
|
+ .te = 286,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = PT2260FileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * PT2260 (Princeton) 24bit 330MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_pt2260_24bit_330 = {
|
|
|
|
|
+ .frequency = 330000000,
|
|
|
|
|
+ .bits = 24,
|
|
|
|
|
+ .te = 286,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = PT2260FileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * PT2260 (Princeton) 24bit 390MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_pt2260_24bit_390 = {
|
|
|
|
|
+ .frequency = 390000000,
|
|
|
|
|
+ .bits = 24,
|
|
|
|
|
+ .te = 286,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = PT2260FileProtocol};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * PT2260 (Princeton) 24bit 433MHz
|
|
|
|
|
+ */
|
|
|
|
|
+const SubBruteProtocol subbrute_protocol_pt2260_24bit_433 = {
|
|
|
|
|
+ .frequency = 433920000,
|
|
|
|
|
+ .bits = 24,
|
|
|
|
|
+ .te = 286,
|
|
|
|
|
+ .repeat = 5,
|
|
|
|
|
+ .preset = FuriHalSubGhzPresetOok650Async,
|
|
|
|
|
+ .file = PT2260FileProtocol};
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* BF existing dump
|
|
* BF existing dump
|
|
|
*/
|
|
*/
|
|
@@ -274,6 +363,14 @@ static const char* subbrute_protocol_names[] = {
|
|
|
[SubBruteAttackChamberlain7bit390] = "Chamberlain 7bit 390MHz",
|
|
[SubBruteAttackChamberlain7bit390] = "Chamberlain 7bit 390MHz",
|
|
|
[SubBruteAttackLinear10bit300] = "Linear 10bit 300MHz",
|
|
[SubBruteAttackLinear10bit300] = "Linear 10bit 300MHz",
|
|
|
[SubBruteAttackLinear10bit310] = "Linear 10bit 310MHz",
|
|
[SubBruteAttackLinear10bit310] = "Linear 10bit 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",
|
|
[SubBruteAttackLoadFile] = "BF existing dump",
|
|
|
[SubBruteAttackTotalCount] = "Total Count",
|
|
[SubBruteAttackTotalCount] = "Total Count",
|
|
|
};
|
|
};
|
|
@@ -311,6 +408,14 @@ const SubBruteProtocol* subbrute_protocol_registry[] = {
|
|
|
[SubBruteAttackChamberlain7bit390] = &subbrute_protocol_chamberlain_7bit_390,
|
|
[SubBruteAttackChamberlain7bit390] = &subbrute_protocol_chamberlain_7bit_390,
|
|
|
[SubBruteAttackLinear10bit300] = &subbrute_protocol_linear_10bit_300,
|
|
[SubBruteAttackLinear10bit300] = &subbrute_protocol_linear_10bit_300,
|
|
|
[SubBruteAttackLinear10bit310] = &subbrute_protocol_linear_10bit_310,
|
|
[SubBruteAttackLinear10bit310] = &subbrute_protocol_linear_10bit_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};
|
|
[SubBruteAttackLoadFile] = &subbrute_protocol_load_file};
|
|
|
|
|
|
|
|
static const char* subbrute_protocol_file_types[] = {
|
|
static const char* subbrute_protocol_file_types[] = {
|
|
@@ -327,6 +432,9 @@ static const char* subbrute_protocol_file_types[] = {
|
|
|
[MagellanFileProtocol] = "Magellan",
|
|
[MagellanFileProtocol] = "Magellan",
|
|
|
[IntertechnoV3FileProtocol] = "Intertechno_V3",
|
|
[IntertechnoV3FileProtocol] = "Intertechno_V3",
|
|
|
[AnsonicFileProtocol] = "Ansonic",
|
|
[AnsonicFileProtocol] = "Ansonic",
|
|
|
|
|
+ [SMC5326FileProtocol] = "SMC5326",
|
|
|
|
|
+ [UNILARMFileProtocol] = "SMC5326",
|
|
|
|
|
+ [PT2260FileProtocol] = "Princeton",
|
|
|
[HoneywellFileProtocol] = "Honeywell",
|
|
[HoneywellFileProtocol] = "Honeywell",
|
|
|
[UnknownFileProtocol] = "Unknown"};
|
|
[UnknownFileProtocol] = "Unknown"};
|
|
|
|
|
|
|
@@ -338,6 +446,8 @@ static const char* subbrute_key_file_start_no_tail =
|
|
|
static const char* subbrute_key_file_start_with_tail =
|
|
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\nRepeat: %d\n";
|
|
"Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\nTE: %d\nRepeat: %d\n";
|
|
|
static const char* subbrute_key_small_no_tail = "Bit: %d\nKey: %s\nRepeat: %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";
|
|
static const char* subbrute_key_small_with_tail = "Bit: %d\nKey: %s\nTE: %d\nRepeat: %d\n";
|
|
|
|
|
|
|
|
const char* subbrute_protocol_name(SubBruteAttacks index) {
|
|
const char* subbrute_protocol_name(SubBruteAttacks index) {
|
|
@@ -416,10 +526,68 @@ void subbrute_protocol_create_candidate_for_existing_file(
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void subbrute_protocol_create_candidate_for_default(FuriString* candidate, uint64_t step) {
|
|
|
|
|
|
|
+void subbrute_protocol_create_candidate_for_default(
|
|
|
|
|
+ FuriString* candidate,
|
|
|
|
|
+ SubBruteFileProtocol file,
|
|
|
|
|
+ uint64_t step) {
|
|
|
uint8_t p[8];
|
|
uint8_t p[8];
|
|
|
- for(int i = 0; i < 8; i++) {
|
|
|
|
|
- p[i] = (uint8_t)(step >> 8 * (7 - i)) & 0xFF;
|
|
|
|
|
|
|
+ if(file == SMC5326FileProtocol) {
|
|
|
|
|
+ const uint8_t lut[] = {0x00, 0x02, 0x03}; // 00, 10, 11
|
|
|
|
|
+ const uint64_t gate1 = 0x01D5; // 111010101
|
|
|
|
|
+ //const uint8_t gate2 = 0x0175; // 101110101
|
|
|
|
|
+
|
|
|
|
|
+ uint64_t total = 0;
|
|
|
|
|
+ for(size_t j = 0; j < 8; j++) {
|
|
|
|
|
+ total |= lut[step % 3] << (2 * j);
|
|
|
|
|
+ double sub_step = step / 3;
|
|
|
|
|
+ step = (uint64_t)floor(sub_step);
|
|
|
|
|
+ }
|
|
|
|
|
+ total <<= 9;
|
|
|
|
|
+ total |= gate1;
|
|
|
|
|
+
|
|
|
|
|
+ for(int i = 0; i < 8; i++) {
|
|
|
|
|
+ p[i] = (uint8_t)(total >> 8 * (7 - i)) & 0xFF;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if(file == UNILARMFileProtocol) {
|
|
|
|
|
+ const uint8_t lut[] = {0x00, 0x02, 0x03}; // 00, 10, 11
|
|
|
|
|
+ const uint64_t gate1 = 3 << 7;
|
|
|
|
|
+ //const uint8_t gate2 = 3 << 5;
|
|
|
|
|
+
|
|
|
|
|
+ uint64_t total = 0;
|
|
|
|
|
+ for(size_t j = 0; j < 8; j++) {
|
|
|
|
|
+ total |= lut[step % 3] << (2 * j);
|
|
|
|
|
+ double sub_step = step / 3;
|
|
|
|
|
+ step = (uint64_t)floor(sub_step);
|
|
|
|
|
+ }
|
|
|
|
|
+ total <<= 9;
|
|
|
|
|
+ total |= gate1;
|
|
|
|
|
+
|
|
|
|
|
+ for(int i = 0; i < 8; i++) {
|
|
|
|
|
+ p[i] = (uint8_t)(total >> 8 * (7 - i)) & 0xFF;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if(file == PT2260FileProtocol) {
|
|
|
|
|
+ const uint8_t lut[] = {0x00, 0x01, 0x03}; // 00, 01, 11
|
|
|
|
|
+ const uint64_t button_open = 0x03; // 11
|
|
|
|
|
+ //const uint8_t button_lock = 0x0C; // 1100
|
|
|
|
|
+ //const uint8_t button_stop = 0x30; // 110000
|
|
|
|
|
+ //const uint8_t button_close = 0xC0; // 11000000
|
|
|
|
|
+
|
|
|
|
|
+ uint64_t total = 0;
|
|
|
|
|
+ for(size_t j = 0; j < 8; j++) {
|
|
|
|
|
+ total |= lut[step % 3] << (2 * j);
|
|
|
|
|
+ double sub_step = step / 3;
|
|
|
|
|
+ step = (uint64_t)floor(sub_step);
|
|
|
|
|
+ }
|
|
|
|
|
+ total <<= 8;
|
|
|
|
|
+ total |= button_open;
|
|
|
|
|
+
|
|
|
|
|
+ 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);
|
|
size_t size = sizeof(uint64_t);
|
|
@@ -442,12 +610,13 @@ void subbrute_protocol_create_candidate_for_default(FuriString* candidate, uint6
|
|
|
|
|
|
|
|
void subbrute_protocol_default_payload(
|
|
void subbrute_protocol_default_payload(
|
|
|
Stream* stream,
|
|
Stream* stream,
|
|
|
|
|
+ SubBruteFileProtocol file,
|
|
|
uint64_t step,
|
|
uint64_t step,
|
|
|
uint8_t bits,
|
|
uint8_t bits,
|
|
|
- uint8_t te,
|
|
|
|
|
|
|
+ uint32_t te,
|
|
|
uint8_t repeat) {
|
|
uint8_t repeat) {
|
|
|
FuriString* candidate = furi_string_alloc();
|
|
FuriString* candidate = furi_string_alloc();
|
|
|
- subbrute_protocol_create_candidate_for_default(candidate, step);
|
|
|
|
|
|
|
+ subbrute_protocol_create_candidate_for_default(candidate, file, step);
|
|
|
|
|
|
|
|
#ifdef FURI_DEBUG
|
|
#ifdef FURI_DEBUG
|
|
|
FURI_LOG_D(
|
|
FURI_LOG_D(
|
|
@@ -479,7 +648,7 @@ void subbrute_protocol_file_payload(
|
|
|
Stream* stream,
|
|
Stream* stream,
|
|
|
uint64_t step,
|
|
uint64_t step,
|
|
|
uint8_t bits,
|
|
uint8_t bits,
|
|
|
- uint8_t te,
|
|
|
|
|
|
|
+ uint32_t te,
|
|
|
uint8_t repeat,
|
|
uint8_t repeat,
|
|
|
uint8_t bit_index,
|
|
uint8_t bit_index,
|
|
|
uint64_t file_key,
|
|
uint64_t file_key,
|
|
@@ -522,10 +691,10 @@ void subbrute_protocol_default_generate_file(
|
|
|
SubBruteFileProtocol file,
|
|
SubBruteFileProtocol file,
|
|
|
uint64_t step,
|
|
uint64_t step,
|
|
|
uint8_t bits,
|
|
uint8_t bits,
|
|
|
- uint8_t te,
|
|
|
|
|
|
|
+ uint32_t te,
|
|
|
uint8_t repeat) {
|
|
uint8_t repeat) {
|
|
|
FuriString* candidate = furi_string_alloc();
|
|
FuriString* candidate = furi_string_alloc();
|
|
|
- subbrute_protocol_create_candidate_for_default(candidate, step);
|
|
|
|
|
|
|
+ subbrute_protocol_create_candidate_for_default(candidate, file, step);
|
|
|
|
|
|
|
|
#ifdef FURI_DEBUG
|
|
#ifdef FURI_DEBUG
|
|
|
FURI_LOG_D(TAG, "candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
|
|
FURI_LOG_D(TAG, "candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
|
|
@@ -565,7 +734,7 @@ void subbrute_protocol_file_generate_file(
|
|
|
SubBruteFileProtocol file,
|
|
SubBruteFileProtocol file,
|
|
|
uint64_t step,
|
|
uint64_t step,
|
|
|
uint8_t bits,
|
|
uint8_t bits,
|
|
|
- uint8_t te,
|
|
|
|
|
|
|
+ uint32_t te,
|
|
|
uint8_t repeat,
|
|
uint8_t repeat,
|
|
|
uint8_t bit_index,
|
|
uint8_t bit_index,
|
|
|
uint64_t file_key,
|
|
uint64_t file_key,
|
|
@@ -608,6 +777,16 @@ uint64_t
|
|
|
uint64_t max_value;
|
|
uint64_t max_value;
|
|
|
if(attack_type == SubBruteAttackLoadFile) {
|
|
if(attack_type == SubBruteAttackLoadFile) {
|
|
|
max_value = two_bytes ? 0xFFFF : 0xFF;
|
|
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 {
|
|
} else {
|
|
|
FuriString* max_value_s;
|
|
FuriString* max_value_s;
|
|
|
max_value_s = furi_string_alloc();
|
|
max_value_s = furi_string_alloc();
|