mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
Fuzzer App: BFCustomerID attack, some fix
This commit is contained in:
@@ -228,10 +228,18 @@ const FuzzerProtocol fuzzer_proto_items[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* fuzzer_attack_names[] = {
|
typedef struct {
|
||||||
[FuzzerMainMenuIndexDefaultValues] = "Default Values",
|
const char* menu_label;
|
||||||
[FuzzerMainMenuIndexLoadFile] = "Load File",
|
FuzzerAttackId attack_id;
|
||||||
[FuzzerMainMenuIndexLoadFileCustomUids] = "Load UIDs from file",
|
} FuzzerMenuItems;
|
||||||
|
|
||||||
|
const FuzzerMenuItems fuzzer_menu_items[] = {
|
||||||
|
{"Default Values", FuzzerAttackIdDefaultValues},
|
||||||
|
#ifdef RFID_125_PROTOCOL
|
||||||
|
{"BF Customer ID", FuzzerAttackIdBFCustomerID},
|
||||||
|
#endif
|
||||||
|
{"Load File", FuzzerAttackIdLoadFile},
|
||||||
|
{"Load UIDs from file", FuzzerAttackIdLoadFileCustomUids},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* fuzzer_proto_get_name(FuzzerProtocolsID index) {
|
const char* fuzzer_proto_get_name(FuzzerProtocolsID index) {
|
||||||
@@ -246,10 +254,14 @@ uint8_t fuzzer_proto_get_max_data_size() {
|
|||||||
return MAX_PAYLOAD_SIZE;
|
return MAX_PAYLOAD_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* fuzzer_proto_get_menu_label(FuzzerMainMenuIndex index) {
|
const char* fuzzer_proto_get_menu_label(uint8_t index) {
|
||||||
return fuzzer_attack_names[index];
|
return fuzzer_menu_items[index].menu_label;
|
||||||
|
}
|
||||||
|
|
||||||
|
FuzzerAttackId fuzzer_proto_get_attack_id_by_index(uint8_t index) {
|
||||||
|
return fuzzer_menu_items[index].attack_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t fuzzer_proto_get_count_of_menu_items() {
|
uint8_t fuzzer_proto_get_count_of_menu_items() {
|
||||||
return COUNT_OF(fuzzer_attack_names);
|
return COUNT_OF(fuzzer_menu_items);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ typedef enum {
|
|||||||
} FuzzerProtocolsID;
|
} FuzzerProtocolsID;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FuzzerMainMenuIndexDefaultValues = 0,
|
FuzzerAttackIdDefaultValues = 0,
|
||||||
FuzzerMainMenuIndexLoadFile,
|
FuzzerAttackIdLoadFile,
|
||||||
FuzzerMainMenuIndexLoadFileCustomUids,
|
FuzzerAttackIdLoadFileCustomUids,
|
||||||
} FuzzerMainMenuIndex;
|
FuzzerAttackIdBFCustomerID,
|
||||||
|
} FuzzerAttackId;
|
||||||
|
|
||||||
struct FuzzerPayload {
|
struct FuzzerPayload {
|
||||||
uint8_t* data;
|
uint8_t* data;
|
||||||
@@ -54,7 +55,14 @@ uint8_t fuzzer_proto_get_count_of_protocols();
|
|||||||
* @param index menu index
|
* @param index menu index
|
||||||
* @return pointer to a string containing the menu label
|
* @return pointer to a string containing the menu label
|
||||||
*/
|
*/
|
||||||
const char* fuzzer_proto_get_menu_label(FuzzerMainMenuIndex index);
|
const char* fuzzer_proto_get_menu_label(uint8_t index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get FuzzerAttackId based on its index
|
||||||
|
* @param index menu index
|
||||||
|
* @return FuzzerAttackId
|
||||||
|
*/
|
||||||
|
FuzzerAttackId fuzzer_proto_get_attack_id_by_index(uint8_t index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of menu items
|
* Get number of menu items
|
||||||
|
|||||||
@@ -77,9 +77,11 @@ bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||||||
|
|
||||||
// TODO error logic
|
// TODO error logic
|
||||||
bool loading_ok = false;
|
bool loading_ok = false;
|
||||||
|
uint8_t d_size = fuzzer_proto_get_max_data_size();
|
||||||
|
uint8_t* uid;
|
||||||
|
|
||||||
switch(app->fuzzer_state.menu_index) {
|
switch(fuzzer_proto_get_attack_id_by_index(app->fuzzer_state.menu_index)) {
|
||||||
case FuzzerMainMenuIndexDefaultValues:
|
case FuzzerAttackIdDefaultValues:
|
||||||
|
|
||||||
loading_ok =
|
loading_ok =
|
||||||
fuzzer_worker_init_attack_dict(app->worker, app->fuzzer_state.proto_index);
|
fuzzer_worker_init_attack_dict(app->worker, app->fuzzer_state.proto_index);
|
||||||
@@ -88,8 +90,20 @@ bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case FuzzerAttackIdBFCustomerID:
|
||||||
|
uid = malloc(d_size);
|
||||||
|
memset(uid, 0x00, d_size);
|
||||||
|
|
||||||
case FuzzerMainMenuIndexLoadFile:
|
loading_ok = fuzzer_worker_init_attack_bf_byte(
|
||||||
|
app->worker, app->fuzzer_state.proto_index, uid, 0);
|
||||||
|
|
||||||
|
free(uid);
|
||||||
|
if(!loading_ok) {
|
||||||
|
// error
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FuzzerAttackIdLoadFile:
|
||||||
if(!fuzzer_scene_main_load_key(app)) {
|
if(!fuzzer_scene_main_load_key(app)) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -105,7 +119,7 @@ bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FuzzerMainMenuIndexLoadFileCustomUids:
|
case FuzzerAttackIdLoadFileCustomUids:
|
||||||
if(!fuzzer_scene_main_load_custom_dict(app)) {
|
if(!fuzzer_scene_main_load_custom_dict(app)) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
2
applications/external/pacs_fuzzer/todo.md
vendored
2
applications/external/pacs_fuzzer/todo.md
vendored
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#### App functionality
|
#### App functionality
|
||||||
|
|
||||||
- [ ] Add `BFCustomerID` attack
|
- [x] Add `BFCustomerID` attack
|
||||||
- [ ] Save key logic
|
- [ ] Save key logic
|
||||||
|
|
||||||
## Code Improvement
|
## Code Improvement
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void fuzzer_view_main_draw(Canvas* canvas, FuzzerViewMainModel* model) {
|
|||||||
canvas_draw_str_aligned(
|
canvas_draw_str_aligned(
|
||||||
canvas, 64, 36, AlignCenter, AlignTop, fuzzer_proto_get_menu_label(model->menu_index));
|
canvas, 64, 36, AlignCenter, AlignTop, fuzzer_proto_get_menu_label(model->menu_index));
|
||||||
|
|
||||||
if(model->menu_index < model->menu_max) {
|
if(model->menu_index < (model->menu_max - 1)) {
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
canvas_draw_str_aligned(
|
canvas_draw_str_aligned(
|
||||||
canvas,
|
canvas,
|
||||||
|
|||||||
Reference in New Issue
Block a user