Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkorpionm <85568270+Skorpionm@users.noreply.github.com>2021-11-03 19:41:07 +0300
committerGitHub <noreply@github.com>2021-11-03 19:41:07 +0300
commit6d548637f25e8ebdd689d609a40fbccb398619a3 (patch)
treecb2d0c6d4494b48d6c2bd07f7f9bf57ae6aada5c /applications/subghz
parent300302cb7c93a1b006d1c2cb0b60f926bd2d8def (diff)
SubGhz: reading keys from encrypted files (#803)
* SubGhz: add file with manufactory codes, and the ability to add your own manufactory codes for KeeLog * SubGhz: add encrypt RAW data, add decrypt and get RAW data * SubGhz: add encrypt magic_xor_atomo * SubGhz: parsing atomo using file encrypt * SubGhz: fix calculating the size of the read buffer * SubGhz: parsing Nice FLOR S using file encrypt * SubGhz: add file encrypt nice_flor_s_tx, fix name load file * SubGhz: fix checking read buffer size * Update subghz_keystore.c * SubGhz: fix calculating the size of the read buffer Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/subghz')
-rw-r--r--applications/subghz/subghz.c3
-rw-r--r--applications/subghz/subghz_cli.c51
2 files changed, 50 insertions, 4 deletions
diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c
index 63156717..5b497e45 100644
--- a/applications/subghz/subghz.c
+++ b/applications/subghz/subghz.c
@@ -188,7 +188,8 @@ SubGhz* subghz_alloc() {
string_init(subghz->error_str);
subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes");
- subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/nice_floor_s_rx");
+ subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes_user");
+ subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/nice_flor_s_rx");
subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/came_atomo");
//subghz_parser_enable_dump_text(subghz->protocol, subghz_text_callback, subghz);
diff --git a/applications/subghz/subghz_cli.c b/applications/subghz/subghz_cli.c
index 4c1abcf8..62d070ef 100644
--- a/applications/subghz/subghz_cli.c
+++ b/applications/subghz/subghz_cli.c
@@ -212,7 +212,9 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
SubGhzParser* parser = subghz_parser_alloc();
subghz_parser_load_keeloq_file(parser, "/ext/subghz/keeloq_mfcodes");
- subghz_parser_load_nice_flor_s_file(parser, "/ext/subghz/nice_floor_s_rx");
+ subghz_parser_load_keeloq_file(parser, "/ext/subghz/keeloq_mfcodes_user");
+ subghz_parser_load_nice_flor_s_file(parser, "/ext/subghz/nice_flor_s_rx");
+ subghz_parser_load_came_atomo_file(parser, "/ext/subghz/came_atomo");
subghz_parser_enable_dump_text(parser, subghz_cli_command_rx_text_callback, instance);
// Configure radio
@@ -260,10 +262,12 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
void subghz_cli_command_print_usage() {
printf("Usage:\r\n");
- printf("subghz_crypto <cmd> <args>\r\n");
+ printf("subghz <cmd> <args>\r\n");
printf("Cmd list:\r\n");
printf(
- "\tkeeloq <plain_text_file> <encrypted_file> <IV:16 bytes in hex>\t - Encrypt keeloq manufacture keys\r\n");
+ "\tencrypt_keeloq <path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>\t - Encrypt keeloq manufacture keys\r\n");
+ printf(
+ "\tencrypt_raw <path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>\t - Encrypt RAW data\r\n");
}
void subghz_cli_command_encrypt_keeloq(Cli* cli, string_t args) {
@@ -308,6 +312,42 @@ void subghz_cli_command_encrypt_keeloq(Cli* cli, string_t args) {
string_clear(source);
}
+void subghz_cli_command_encrypt_raw(Cli* cli, string_t args) {
+ uint8_t iv[16];
+
+ string_t source;
+ string_t destination;
+ string_init(source);
+ string_init(destination);
+
+ do {
+ if(!args_read_string_and_trim(args, source)) {
+ subghz_cli_command_print_usage();
+ break;
+ }
+
+ if(!args_read_string_and_trim(args, destination)) {
+ subghz_cli_command_print_usage();
+ break;
+ }
+
+ if(!args_read_hex_bytes(args, iv, 16)) {
+ subghz_cli_command_print_usage();
+ break;
+ }
+
+ if(!subghz_keystore_raw_encrypted_save(
+ string_get_cstr(source), string_get_cstr(destination), iv)) {
+ printf("Failed to save Keystore");
+ break;
+ }
+
+ } while(false);
+
+ string_clear(destination);
+ string_clear(source);
+}
+
void subghz_cli_command(Cli* cli, string_t args, void* context) {
string_t cmd;
string_init(cmd);
@@ -323,6 +363,11 @@ void subghz_cli_command(Cli* cli, string_t args, void* context) {
break;
}
+ if(string_cmp_str(cmd, "encrypt_raw") == 0) {
+ subghz_cli_command_encrypt_raw(cli, args);
+ break;
+ }
+
subghz_cli_command_print_usage();
} while(false);