Fix FloR-S and add test Keeloq uknown replay

This commit is contained in:
r3df0xx 2022-03-28 19:42:00 +03:00
parent 78accbb706
commit f12faff8b0
2 changed files with 22 additions and 15 deletions

View File

@ -154,6 +154,7 @@ static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instanc
code_found_reverse = subghz_protocol_blocks_reverse_key( code_found_reverse = subghz_protocol_blocks_reverse_key(
instance->generic.data, instance->generic.data_count_bit); instance->generic.data, instance->generic.data_count_bit);
hop = code_found_reverse & 0x00000000ffffffff; hop = code_found_reverse & 0x00000000ffffffff;
FURI_LOG_I(TAG, "hop = %X", hop);
break; break;
} }
break; break;
@ -163,11 +164,8 @@ static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instanc
uint64_t yek = (uint64_t)fix << 32 | hop; uint64_t yek = (uint64_t)fix << 32 | hop;
instance->generic.data = instance->generic.data =
subghz_protocol_blocks_reverse_key(yek, instance->generic.data_count_bit); subghz_protocol_blocks_reverse_key(yek, instance->generic.data_count_bit);
return true;
} else {
instance->manufacture_name = "Unknown";
return false;
} }
return true;
} }
bool subghz_protocol_keeloq_create_data( bool subghz_protocol_keeloq_create_data(

View File

@ -128,10 +128,10 @@ static bool
} }
instance->generic.cnt++; instance->generic.cnt++;
uint64_t decrypt = btn << 4 | 0x0 << 28 | instance->generic.serial << 16 | instance->generic.cnt; uint64_t decrypt = (uint64_t)instance->generic.serial << 16 | instance->generic.cnt;
FURI_LOG_I(TAG, "decrypt = %X", decrypt); FURI_LOG_I(TAG, "decrypt = %X", decrypt);
uint64_t temp_parcel = subghz_protocol_nice_flor_s_encrypt(decrypt, file_name); uint64_t enc_part = (uint64_t)subghz_protocol_nice_flor_s_encrypt(decrypt, file_name);
FURI_LOG_I(TAG, "temp_parcel = %X", temp_parcel); FURI_LOG_I(TAG, "enc_part = %X", enc_part);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
@ -150,16 +150,25 @@ static bool
0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8 } 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8 }
}; };
if (btn == 0x1) { if (btn == 0x1) {
instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[0][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); //Button 1
} else if (btn == 0x2) { instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[0][i]) << 44 | (enc_part);
instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[1][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); }
} else if (btn == 0x4) { if (btn == 0x2) {
instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[2][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); //Button 2
} else if (btn == 0x8) { instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[1][i]) << 44 | (enc_part);
instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[3][i]) << 44 | (temp_parcel & 0xFFFFFFFFFFF); }
if (btn == 0x4) {
//Button 3
instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[2][i]) << 44 | (enc_part);
}
if (btn == 0x8) {
//Button 4
instance->generic.data = btn << 4 | (0xF ^ btn ^ loops[3][i]) << 44 | (enc_part);
} }
FURI_LOG_I(TAG, "key = %X", instance->generic.data); FURI_LOG_I(TAG, "key = %X", instance->generic.data);
//Send header //Send header
for(uint8_t i = 35; i > 0; i--) { for(uint8_t i = 35; i > 0; i--) {
instance->encoder.upload[index++] = instance->encoder.upload[index++] =