mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-31 02:23:04 -07:00
oh no
This commit is contained in:
@@ -55,8 +55,8 @@ static void flipfrid_timer_callback(FuriMessageQueue* event_queue) {
|
||||
|
||||
FlipFridState* flipfrid_alloc() {
|
||||
FlipFridState* flipfrid = malloc(sizeof(FlipFridState));
|
||||
string_init(flipfrid->notification_msg);
|
||||
string_init(flipfrid->attack_name);
|
||||
flipfrid->notification_msg = furi_string_alloc();
|
||||
flipfrid->attack_name = furi_string_alloc();
|
||||
|
||||
flipfrid->previous_scene = NoneScene;
|
||||
flipfrid->current_scene = SceneEntryPoint;
|
||||
@@ -95,8 +95,8 @@ void flipfrid_free(FlipFridState* flipfrid) {
|
||||
notification_message(flipfrid->notify, &sequence_blink_stop);
|
||||
|
||||
// Strings
|
||||
string_clear(flipfrid->notification_msg);
|
||||
string_clear(flipfrid->attack_name);
|
||||
furi_string_free(flipfrid->notification_msg);
|
||||
furi_string_free(flipfrid->attack_name);
|
||||
|
||||
free(flipfrid->data);
|
||||
free(flipfrid->payload);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <input/input.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <m-string.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
@@ -65,17 +64,17 @@ typedef struct {
|
||||
u_int8_t menu_index;
|
||||
u_int8_t menu_proto_index;
|
||||
|
||||
string_t data_str;
|
||||
FuriString* data_str;
|
||||
uint8_t data[6];
|
||||
uint8_t payload[6];
|
||||
uint8_t attack_step;
|
||||
FlipFridAttacks attack;
|
||||
FlipFridProtos proto;
|
||||
string_t attack_name;
|
||||
string_t proto_name;
|
||||
FuriString* attack_name;
|
||||
FuriString* proto_name;
|
||||
|
||||
DialogsApp* dialogs;
|
||||
string_t notification_msg;
|
||||
FuriString* notification_msg;
|
||||
uint8_t key_index;
|
||||
LFRFIDWorker* worker;
|
||||
ProtocolDict* dict;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "flipfrid_scene_entrypoint.h"
|
||||
|
||||
string_t menu_items[4];
|
||||
string_t menu_proto_items[4];
|
||||
FuriString* menu_items[4];
|
||||
FuriString* menu_proto_items[4];
|
||||
|
||||
void flipfrid_scene_entrypoint_menu_callback(
|
||||
FlipFridState* context,
|
||||
@@ -11,22 +11,22 @@ void flipfrid_scene_entrypoint_menu_callback(
|
||||
case FlipFridAttackDefaultValues:
|
||||
context->attack = FlipFridAttackDefaultValues;
|
||||
context->current_scene = SceneAttack;
|
||||
string_set_str(context->attack_name, "Default Values");
|
||||
furi_string_set(context->attack_name, "Default Values");
|
||||
break;
|
||||
case FlipFridAttackBfCustomerId:
|
||||
context->attack = FlipFridAttackBfCustomerId;
|
||||
context->current_scene = SceneAttack;
|
||||
string_set_str(context->attack_name, "Bad Customer ID");
|
||||
furi_string_set(context->attack_name, "Bad Customer ID");
|
||||
break;
|
||||
case FlipFridAttackLoadFile:
|
||||
context->attack = FlipFridAttackLoadFile;
|
||||
context->current_scene = SceneSelectFile;
|
||||
string_set_str(context->attack_name, "Load File");
|
||||
furi_string_set(context->attack_name, "Load File");
|
||||
break;
|
||||
case FlipFridAttackLoadFileCustomUids:
|
||||
context->attack = FlipFridAttackLoadFileCustomUids;
|
||||
context->current_scene = SceneLoadCustomUids;
|
||||
string_set_str(context->attack_name, "Load Custom UIDs");
|
||||
furi_string_set(context->attack_name, "Load Custom UIDs");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -35,19 +35,19 @@ void flipfrid_scene_entrypoint_menu_callback(
|
||||
switch(proto_index) {
|
||||
case EM4100:
|
||||
context->proto = EM4100;
|
||||
string_set_str(context->proto_name, "EM4100");
|
||||
furi_string_set(context->proto_name, "EM4100");
|
||||
break;
|
||||
case HIDProx:
|
||||
context->proto = HIDProx;
|
||||
string_set_str(context->proto_name, "HIDProx");
|
||||
furi_string_set(context->proto_name, "HIDProx");
|
||||
break;
|
||||
case PAC:
|
||||
context->proto = PAC;
|
||||
string_set_str(context->proto_name, "PAC/Stanley");
|
||||
furi_string_set(context->proto_name, "PAC/Stanley");
|
||||
break;
|
||||
case H10301:
|
||||
context->proto = H10301;
|
||||
string_set_str(context->proto_name, "H10301");
|
||||
furi_string_set(context->proto_name, "H10301");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -65,33 +65,33 @@ void flipfrid_scene_entrypoint_on_enter(FlipFridState* context) {
|
||||
|
||||
context->menu_index = 0;
|
||||
for(uint32_t i = 0; i < 4; i++) {
|
||||
string_init(menu_items[i]);
|
||||
menu_items[i] = furi_string_alloc();
|
||||
}
|
||||
|
||||
string_set(menu_items[0], "Default Values");
|
||||
string_set(menu_items[1], "BF Customer ID");
|
||||
string_set(menu_items[2], "Load File");
|
||||
string_set(menu_items[3], "Load uids from file");
|
||||
furi_string_set(menu_items[0], "Default Values");
|
||||
furi_string_set(menu_items[1], "BF Customer ID");
|
||||
furi_string_set(menu_items[2], "Load File");
|
||||
furi_string_set(menu_items[3], "Load uids from file");
|
||||
|
||||
context->menu_proto_index = 0;
|
||||
for(uint32_t i = 0; i < 4; i++) {
|
||||
string_init(menu_proto_items[i]);
|
||||
menu_proto_items[i] = furi_string_alloc();
|
||||
}
|
||||
|
||||
string_set(menu_proto_items[0], "EM4100");
|
||||
string_set(menu_proto_items[1], "HIDProx");
|
||||
string_set(menu_proto_items[2], "PAC/Stanley");
|
||||
string_set(menu_proto_items[3], "H10301");
|
||||
furi_string_set(menu_proto_items[0], "EM4100");
|
||||
furi_string_set(menu_proto_items[1], "HIDProx");
|
||||
furi_string_set(menu_proto_items[2], "PAC/Stanley");
|
||||
furi_string_set(menu_proto_items[3], "H10301");
|
||||
}
|
||||
|
||||
void flipfrid_scene_entrypoint_on_exit(FlipFridState* context) {
|
||||
UNUSED(context);
|
||||
for(uint32_t i = 0; i < 4; i++) {
|
||||
string_clear(menu_items[i]);
|
||||
furi_string_free(menu_items[i]);
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < 4; i++) {
|
||||
string_clear(menu_proto_items[i]);
|
||||
furi_string_free(menu_proto_items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,12 +151,17 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
24,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
string_get_cstr(menu_items[context->menu_index - 1]));
|
||||
furi_string_get_cstr(menu_items[context->menu_index - 1]));
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 36, AlignCenter, AlignTop, string_get_cstr(menu_items[context->menu_index]));
|
||||
canvas,
|
||||
64,
|
||||
36,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
furi_string_get_cstr(menu_items[context->menu_index]));
|
||||
|
||||
if(context->menu_index < FlipFridAttackLoadFileCustomUids) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
@@ -166,7 +171,7 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
48,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
string_get_cstr(menu_items[context->menu_index + 1]));
|
||||
furi_string_get_cstr(menu_items[context->menu_index + 1]));
|
||||
}
|
||||
|
||||
if(context->menu_proto_index > EM4100) {
|
||||
@@ -177,7 +182,7 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
-12,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
string_get_cstr(menu_proto_items[context->menu_proto_index - 1]));
|
||||
furi_string_get_cstr(menu_proto_items[context->menu_proto_index - 1]));
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
@@ -190,7 +195,7 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
4,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
string_get_cstr(menu_proto_items[context->menu_proto_index]));
|
||||
furi_string_get_cstr(menu_proto_items[context->menu_proto_index]));
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str_aligned(canvas, 101, 4, AlignCenter, AlignTop, ">");
|
||||
@@ -203,6 +208,6 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
-12,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
string_get_cstr(menu_proto_items[context->menu_proto_index + 1]));
|
||||
furi_string_get_cstr(menu_proto_items[context->menu_proto_index + 1]));
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,9 @@ bool flipfrid_load_uids(FlipFridState* context, const char* file_path) {
|
||||
|
||||
bool flipfrid_load_custom_uids_from_file(FlipFridState* context) {
|
||||
// Input events and views are managed by file_select
|
||||
string_t uid_path;
|
||||
string_init(uid_path);
|
||||
string_set_str(uid_path, RFIDFUZZER_APP_PATH_FOLDER);
|
||||
FuriString* uid_path;
|
||||
uid_path = furi_string_alloc();
|
||||
furi_string_set(uid_path, RFIDFUZZER_APP_PATH_FOLDER);
|
||||
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
dialog_file_browser_set_basic_options(&browser_options, LFRFID_UIDS_EXTENSION, &I_125_10px);
|
||||
@@ -32,10 +32,10 @@ bool flipfrid_load_custom_uids_from_file(FlipFridState* context) {
|
||||
bool res = dialog_file_browser_show(context->dialogs, uid_path, uid_path, &browser_options);
|
||||
|
||||
if(res) {
|
||||
res = flipfrid_load_uids(context, string_get_cstr(uid_path));
|
||||
res = flipfrid_load_uids(context, furi_string_get_cstr(uid_path));
|
||||
}
|
||||
|
||||
string_clear(uid_path);
|
||||
furi_string_free(uid_path);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -8,61 +8,61 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) {
|
||||
bool result = false;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
|
||||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
FuriString* temp_str;
|
||||
temp_str = furi_string_alloc();
|
||||
do {
|
||||
if(!flipper_format_file_open_existing(fff_data_file, file_path)) {
|
||||
FURI_LOG_E(TAG, "Error open file %s", file_path);
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Error open file");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Error open file");
|
||||
break;
|
||||
}
|
||||
|
||||
// FileType
|
||||
if(!flipper_format_read_string(fff_data_file, "Filetype", temp_str)) {
|
||||
FURI_LOG_E(TAG, "Missing or incorrect Filetype");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Missing or incorrect Filetypes");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Missing or incorrect Filetypes");
|
||||
break;
|
||||
} else {
|
||||
FURI_LOG_I(TAG, "Filetype: %s", string_get_cstr(temp_str));
|
||||
FURI_LOG_I(TAG, "Filetype: %s", furi_string_get_cstr(temp_str));
|
||||
}
|
||||
|
||||
// Key type
|
||||
if(!flipper_format_read_string(fff_data_file, "Key type", temp_str)) {
|
||||
FURI_LOG_E(TAG, "Missing or incorrect Key type");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Missing or incorrect Key type");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Missing or incorrect Key type");
|
||||
break;
|
||||
} else {
|
||||
FURI_LOG_I(TAG, "Key type: %s", string_get_cstr(temp_str));
|
||||
FURI_LOG_I(TAG, "Key type: %s", furi_string_get_cstr(temp_str));
|
||||
|
||||
if(context->proto == EM4100) {
|
||||
if(strcmp(string_get_cstr(temp_str), "EM4100") != 0) {
|
||||
if(strcmp(furi_string_get_cstr(temp_str), "EM4100") != 0) {
|
||||
FURI_LOG_E(TAG, "Unsupported Key type");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Unsupported Key type");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Unsupported Key type");
|
||||
break;
|
||||
}
|
||||
} else if(context->proto == PAC) {
|
||||
if(strcmp(string_get_cstr(temp_str), "PAC/Stanley") != 0) {
|
||||
if(strcmp(furi_string_get_cstr(temp_str), "PAC/Stanley") != 0) {
|
||||
FURI_LOG_E(TAG, "Unsupported Key type");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Unsupported Key type");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Unsupported Key type");
|
||||
break;
|
||||
}
|
||||
} else if(context->proto == H10301) {
|
||||
if(strcmp(string_get_cstr(temp_str), "H10301") != 0) {
|
||||
if(strcmp(furi_string_get_cstr(temp_str), "H10301") != 0) {
|
||||
FURI_LOG_E(TAG, "Unsupported Key type");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Unsupported Key type");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Unsupported Key type");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(strcmp(string_get_cstr(temp_str), "HIDProx") != 0) {
|
||||
if(strcmp(furi_string_get_cstr(temp_str), "HIDProx") != 0) {
|
||||
FURI_LOG_E(TAG, "Unsupported Key type");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Unsupported Key type");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Unsupported Key type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -71,38 +71,38 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) {
|
||||
// Data
|
||||
if(!flipper_format_read_string(fff_data_file, "Data", context->data_str)) {
|
||||
FURI_LOG_E(TAG, "Missing or incorrect Data");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Missing or incorrect Key");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Missing or incorrect Key");
|
||||
break;
|
||||
} else {
|
||||
FURI_LOG_I(TAG, "Key: %s", string_get_cstr(context->data_str));
|
||||
FURI_LOG_I(TAG, "Key: %s", furi_string_get_cstr(context->data_str));
|
||||
|
||||
if(context->proto == EM4100) {
|
||||
if(string_size(context->data_str) != 14) {
|
||||
if(furi_string_size(context->data_str) != 14) {
|
||||
FURI_LOG_E(TAG, "Incorrect Key length");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Incorrect Key length");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Incorrect Key length");
|
||||
break;
|
||||
}
|
||||
} else if(context->proto == PAC) {
|
||||
if(string_size(context->data_str) != 11) {
|
||||
if(furi_string_size(context->data_str) != 11) {
|
||||
FURI_LOG_E(TAG, "Incorrect Key length");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Incorrect Key length");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Incorrect Key length");
|
||||
break;
|
||||
}
|
||||
} else if(context->proto == H10301) {
|
||||
if(string_size(context->data_str) != 8) {
|
||||
if(furi_string_size(context->data_str) != 8) {
|
||||
FURI_LOG_E(TAG, "Incorrect Key length");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Incorrect Key length");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Incorrect Key length");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(string_size(context->data_str) != 17) {
|
||||
if(furi_string_size(context->data_str) != 17) {
|
||||
FURI_LOG_E(TAG, "Incorrect Key length");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Incorrect Key length");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Incorrect Key length");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -110,8 +110,8 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) {
|
||||
// String to uint8_t
|
||||
for(uint8_t i = 0; i < 6; i++) {
|
||||
char temp_str2[3];
|
||||
temp_str2[0] = string_get_cstr(context->data_str)[i * 3];
|
||||
temp_str2[1] = string_get_cstr(context->data_str)[i * 3 + 1];
|
||||
temp_str2[0] = furi_string_get_cstr(context->data_str)[i * 3];
|
||||
temp_str2[1] = furi_string_get_cstr(context->data_str)[i * 3 + 1];
|
||||
temp_str2[2] = '\0';
|
||||
context->data[i] = (uint8_t)strtol(temp_str2, NULL, 16);
|
||||
}
|
||||
@@ -119,12 +119,12 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) {
|
||||
|
||||
result = true;
|
||||
} while(0);
|
||||
string_clear(temp_str);
|
||||
furi_string_free(temp_str);
|
||||
flipper_format_free(fff_data_file);
|
||||
if(result) {
|
||||
FURI_LOG_I(TAG, "Loaded successfully");
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, "Source loaded.");
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, "Source loaded.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -169,9 +169,9 @@ void flipfrid_scene_load_file_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
}
|
||||
|
||||
bool flipfrid_load_protocol_from_file(FlipFridState* context) {
|
||||
string_t user_file_path;
|
||||
string_init(user_file_path);
|
||||
string_set_str(user_file_path, LFRFID_APP_PATH_FOLDER);
|
||||
FuriString* user_file_path;
|
||||
user_file_path = furi_string_alloc();
|
||||
furi_string_set(user_file_path, LFRFID_APP_PATH_FOLDER);
|
||||
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
dialog_file_browser_set_basic_options(&browser_options, LFRFID_APP_EXTENSION, &I_125_10px);
|
||||
@@ -181,10 +181,10 @@ bool flipfrid_load_protocol_from_file(FlipFridState* context) {
|
||||
context->dialogs, user_file_path, user_file_path, &browser_options);
|
||||
|
||||
if(res) {
|
||||
res = flipfrid_load(context, string_get_cstr(user_file_path));
|
||||
res = flipfrid_load(context, furi_string_get_cstr(user_file_path));
|
||||
}
|
||||
|
||||
string_clear(user_file_path);
|
||||
furi_string_free(user_file_path);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
if(context->proto == EM4100) {
|
||||
bool end_of_list = false;
|
||||
while(true) {
|
||||
string_reset(context->data_str);
|
||||
furi_string_reset(context->data_str);
|
||||
if(!stream_read_line(context->uids_stream, context->data_str)) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
@@ -348,13 +348,13 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
end_of_list = true;
|
||||
break;
|
||||
};
|
||||
if(string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(string_size(context->data_str) != 11) break;
|
||||
if(furi_string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(furi_string_size(context->data_str) != 11) break;
|
||||
break;
|
||||
}
|
||||
if(end_of_list) break;
|
||||
FURI_LOG_D(TAG, string_get_cstr(context->data_str));
|
||||
if(string_size(context->data_str) != 11) {
|
||||
FURI_LOG_D(TAG, furi_string_get_cstr(context->data_str));
|
||||
if(furi_string_size(context->data_str) != 11) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
context->is_attacking = false;
|
||||
@@ -366,8 +366,8 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
// string is valid, parse it in context->payload
|
||||
for(uint8_t i = 0; i < 5; i++) {
|
||||
char temp_str[3];
|
||||
temp_str[0] = string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[0] = furi_string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = furi_string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[2] = '\0';
|
||||
context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16);
|
||||
}
|
||||
@@ -375,7 +375,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
} else if(context->proto == PAC) {
|
||||
bool end_of_list = false;
|
||||
while(true) {
|
||||
string_reset(context->data_str);
|
||||
furi_string_reset(context->data_str);
|
||||
if(!stream_read_line(context->uids_stream, context->data_str)) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
@@ -386,13 +386,13 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
end_of_list = true;
|
||||
break;
|
||||
};
|
||||
if(string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(string_size(context->data_str) != 9) break;
|
||||
if(furi_string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(furi_string_size(context->data_str) != 9) break;
|
||||
break;
|
||||
}
|
||||
if(end_of_list) break;
|
||||
FURI_LOG_D(TAG, string_get_cstr(context->data_str));
|
||||
if(string_size(context->data_str) != 9) {
|
||||
FURI_LOG_D(TAG, furi_string_get_cstr(context->data_str));
|
||||
if(furi_string_size(context->data_str) != 9) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
context->is_attacking = false;
|
||||
@@ -404,8 +404,8 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
// string is valid, parse it in context->payload
|
||||
for(uint8_t i = 0; i < 4; i++) {
|
||||
char temp_str[3];
|
||||
temp_str[0] = string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[0] = furi_string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = furi_string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[2] = '\0';
|
||||
context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16);
|
||||
}
|
||||
@@ -413,7 +413,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
} else if(context->proto == H10301) {
|
||||
bool end_of_list = false;
|
||||
while(true) {
|
||||
string_reset(context->data_str);
|
||||
furi_string_reset(context->data_str);
|
||||
if(!stream_read_line(context->uids_stream, context->data_str)) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
@@ -424,13 +424,13 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
end_of_list = true;
|
||||
break;
|
||||
};
|
||||
if(string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(string_size(context->data_str) != 7) break;
|
||||
if(furi_string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(furi_string_size(context->data_str) != 7) break;
|
||||
break;
|
||||
}
|
||||
if(end_of_list) break;
|
||||
FURI_LOG_D(TAG, string_get_cstr(context->data_str));
|
||||
if(string_size(context->data_str) != 7) {
|
||||
FURI_LOG_D(TAG, furi_string_get_cstr(context->data_str));
|
||||
if(furi_string_size(context->data_str) != 7) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
context->is_attacking = false;
|
||||
@@ -442,8 +442,8 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
// string is valid, parse it in context->payload
|
||||
for(uint8_t i = 0; i < 3; i++) {
|
||||
char temp_str[3];
|
||||
temp_str[0] = string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[0] = furi_string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = furi_string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[2] = '\0';
|
||||
context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16);
|
||||
}
|
||||
@@ -451,7 +451,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
} else {
|
||||
bool end_of_list = false;
|
||||
while(true) {
|
||||
string_reset(context->data_str);
|
||||
furi_string_reset(context->data_str);
|
||||
if(!stream_read_line(context->uids_stream, context->data_str)) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
@@ -462,13 +462,13 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
end_of_list = true;
|
||||
break;
|
||||
};
|
||||
if(string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(string_size(context->data_str) != 13) break;
|
||||
if(furi_string_get_char(context->data_str, 0) == '#') continue;
|
||||
if(furi_string_size(context->data_str) != 13) break;
|
||||
break;
|
||||
}
|
||||
FURI_LOG_D(TAG, string_get_cstr(context->data_str));
|
||||
FURI_LOG_D(TAG, furi_string_get_cstr(context->data_str));
|
||||
if(end_of_list) break;
|
||||
if(string_size(context->data_str) != 13) {
|
||||
if(furi_string_size(context->data_str) != 13) {
|
||||
context->attack_step = 0;
|
||||
counter = 0;
|
||||
context->is_attacking = false;
|
||||
@@ -480,8 +480,8 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
|
||||
// string is valid, parse it in context->payload
|
||||
for(uint8_t i = 0; i < 6; i++) {
|
||||
char temp_str[3];
|
||||
temp_str[0] = string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[0] = furi_string_get_cstr(context->data_str)[i * 2];
|
||||
temp_str[1] = furi_string_get_cstr(context->data_str)[i * 2 + 1];
|
||||
temp_str[2] = '\0';
|
||||
context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16);
|
||||
}
|
||||
@@ -538,7 +538,7 @@ void flipfrid_scene_run_attack_on_event(FlipFridEvent event, FlipFridState* cont
|
||||
|
||||
context->attack_step = 0;
|
||||
context->is_attacking = false;
|
||||
string_reset(context->notification_msg);
|
||||
furi_string_reset(context->notification_msg);
|
||||
context->current_scene = SceneEntryPoint;
|
||||
notification_message(context->notify, &sequence_blink_stop);
|
||||
break;
|
||||
@@ -557,7 +557,7 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
// Title
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 2, AlignCenter, AlignTop, string_get_cstr(context->attack_name));
|
||||
canvas, 64, 2, AlignCenter, AlignTop, furi_string_get_cstr(context->attack_name));
|
||||
|
||||
char uid[18];
|
||||
char speed[16];
|
||||
@@ -606,7 +606,7 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 26, AlignCenter, AlignTop, string_get_cstr(context->proto_name));
|
||||
canvas, 64, 26, AlignCenter, AlignTop, furi_string_get_cstr(context->proto_name));
|
||||
|
||||
snprintf(speed, sizeof(speed), "Time delay: %d", context->time_between_cards);
|
||||
|
||||
|
||||
@@ -65,12 +65,12 @@ void flipfrid_center_displayed_key(FlipFridState* context, uint8_t index) {
|
||||
display_menu[15] = ' ';
|
||||
}
|
||||
|
||||
string_reset(context->notification_msg);
|
||||
string_set_str(context->notification_msg, display_menu);
|
||||
furi_string_reset(context->notification_msg);
|
||||
furi_string_set(context->notification_msg, display_menu);
|
||||
}
|
||||
|
||||
void flipfrid_scene_select_field_on_enter(FlipFridState* context) {
|
||||
string_clear(context->notification_msg);
|
||||
furi_string_free(context->notification_msg);
|
||||
}
|
||||
|
||||
void flipfrid_scene_select_field_on_exit(FlipFridState* context) {
|
||||
@@ -84,7 +84,7 @@ void flipfrid_scene_select_field_on_tick(FlipFridState* context) {
|
||||
void flipfrid_scene_select_field_on_event(FlipFridEvent event, FlipFridState* context) {
|
||||
if(event.evt_type == EventTypeKey) {
|
||||
if(event.input_type == InputTypeShort) {
|
||||
const char* key_cstr = string_get_cstr(context->data_str);
|
||||
const char* key_cstr = furi_string_get_cstr(context->data_str);
|
||||
int data_len = sizeof(context->data) / sizeof(context->data[0]);
|
||||
|
||||
// don't look, it's ugly but I'm a python dev so...
|
||||
@@ -121,12 +121,12 @@ void flipfrid_scene_select_field_on_event(FlipFridEvent event, FlipFridState* co
|
||||
}
|
||||
break;
|
||||
case InputKeyOk:
|
||||
string_reset(context->notification_msg);
|
||||
furi_string_reset(context->notification_msg);
|
||||
context->current_scene = SceneAttack;
|
||||
break;
|
||||
case InputKeyBack:
|
||||
context->key_index = 0;
|
||||
string_reset(context->notification_msg);
|
||||
furi_string_reset(context->notification_msg);
|
||||
context->current_scene = SceneSelectFile;
|
||||
break;
|
||||
}
|
||||
@@ -154,5 +154,5 @@ void flipfrid_scene_select_field_on_draw(Canvas* canvas, FlipFridState* context)
|
||||
flipfrid_center_displayed_key(context, context->key_index);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 45, AlignCenter, AlignTop, string_get_cstr(context->notification_msg));
|
||||
canvas, 64, 45, AlignCenter, AlignTop, furi_string_get_cstr(context->notification_msg));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user