mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-23 05:24:46 -07:00
Fuzzers app: main menu v0
This commit is contained in:
@@ -3,6 +3,15 @@
|
|||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <furi_hal.h>
|
#include <furi_hal.h>
|
||||||
|
|
||||||
|
// TODO replace it
|
||||||
|
typedef enum {
|
||||||
|
FuzzerMainMenuIndexDefaultValues = 0,
|
||||||
|
FuzzerMainMenuIndexLoadFile,
|
||||||
|
FuzzerMainMenuIndexLoadFileCustomUids,
|
||||||
|
|
||||||
|
FuzzerMainMenuIndexMax,
|
||||||
|
} FuzzerMainMenuIndex;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FuzzerViewIDMain,
|
FuzzerViewIDMain,
|
||||||
} FuzzerViewID;
|
} FuzzerViewID;
|
||||||
92
applications/external/pacs_fuzzer/helpers/protocol.c
vendored
Normal file
92
applications/external/pacs_fuzzer/helpers/protocol.c
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#include "protocol.h"
|
||||||
|
|
||||||
|
#define DS1990_DATA_SIZE (8)
|
||||||
|
#define Metakom_DATA_SIZE (4)
|
||||||
|
#define Cyfral_DATA_SIZE (2)
|
||||||
|
|
||||||
|
const uint8_t uid_list_ds1990[][DS1990_DATA_SIZE] = {
|
||||||
|
{0x01, 0xBE, 0x40, 0x11, 0x5A, 0x36, 0x00, 0xE1}, //– код универсального ключа, для Vizit
|
||||||
|
{0x01, 0xBE, 0x40, 0x11, 0x5A, 0x56, 0x00, 0xBB}, //- проверен работает
|
||||||
|
{0x01, 0xBE, 0x40, 0x11, 0x00, 0x00, 0x00, 0x77}, //- проверен работает
|
||||||
|
{0x01, 0xBE, 0x40, 0x11, 0x0A, 0x00, 0x00, 0x1D}, //- проверен работает Визит иногда КЕЙМАНЫ
|
||||||
|
{0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2F}, //- проверен(метаком, цифрал, ВИЗИТ).
|
||||||
|
{0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x9B}, //- проверен Визит, Метакомы, КОНДОР
|
||||||
|
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x14}, //???-Открываает 98% Метаком и некоторые Цифрал
|
||||||
|
{0x01, 0x00, 0x00, 0x00, 0x00, 0x90, 0x19, 0xFF}, //???-Отлично работает на старых домофонах
|
||||||
|
{0x01, 0x6F, 0x2E, 0x88, 0x8A, 0x00, 0x00, 0x4D}, //???-Открывать что-то должен
|
||||||
|
{0x01, 0x53, 0xD4, 0xFE, 0x00, 0x00, 0x7E, 0x88}, //???-Cyfral, Metakom
|
||||||
|
{0x01, 0x53, 0xD4, 0xFE, 0x00, 0x00, 0x00, 0x6F}, //???-домофоны Визит (Vizit) - до 99%
|
||||||
|
{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D}, //???-домофоны Cyfral CCD-20 - до 70%
|
||||||
|
{0x01, 0x00, 0xBE, 0x11, 0xAA, 0x00, 0x00, 0xFB}, //???-домофоны Кейман (KEYMAN)
|
||||||
|
{0x01, 0x76, 0xB8, 0x2E, 0x0F, 0x00, 0x00, 0x5C}, //???-домофоны Форвард
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // Null bytes
|
||||||
|
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x14}, // Only FF
|
||||||
|
{0x01, 0x78, 0x00, 0x48, 0xFD, 0xFF, 0xFF, 0xD1}, // StarNew Uni5
|
||||||
|
{0x01, 0xA9, 0xE4, 0x3C, 0x09, 0x00, 0x00, 0xE6}, // Eltis Uni
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t uid_list_metakom[][Metakom_DATA_SIZE] = {
|
||||||
|
{0x00, 0x00, 0x00, 0x00}, // Null bytes
|
||||||
|
{0xFF, 0xFF, 0xFF, 0xFF}, // Only FF
|
||||||
|
{0x11, 0x11, 0x11, 0x11}, // Only 11
|
||||||
|
{0x22, 0x22, 0x22, 0x22}, // Only 22
|
||||||
|
{0x33, 0x33, 0x33, 0x33}, // Only 33
|
||||||
|
{0x44, 0x44, 0x44, 0x44}, // Only 44
|
||||||
|
{0x55, 0x55, 0x55, 0x55}, // Only 55
|
||||||
|
{0x66, 0x66, 0x66, 0x66}, // Only 66
|
||||||
|
{0x77, 0x77, 0x77, 0x77}, // Only 77
|
||||||
|
{0x88, 0x88, 0x88, 0x88}, // Only 88
|
||||||
|
{0x99, 0x99, 0x99, 0x99}, // Only 99
|
||||||
|
{0x12, 0x34, 0x56, 0x78}, // Incremental UID
|
||||||
|
{0x9A, 0x78, 0x56, 0x34}, // Decremental UID
|
||||||
|
{0x04, 0xd0, 0x9b, 0x0d}, // ??
|
||||||
|
{0x34, 0x00, 0x29, 0x3d}, // ??
|
||||||
|
{0x04, 0xdf, 0x00, 0x00}, // ??
|
||||||
|
{0xCA, 0xCA, 0xCA, 0xCA}, // ??
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t uid_list_cyfral[][Cyfral_DATA_SIZE] = {
|
||||||
|
{0x00, 0x00}, // Null bytes
|
||||||
|
{0xFF, 0xFF}, // Only FF
|
||||||
|
{0x11, 0x11}, // Only 11
|
||||||
|
{0x22, 0x22}, // Only 22
|
||||||
|
{0x33, 0x33}, // Only 33
|
||||||
|
{0x44, 0x44}, // Only 44
|
||||||
|
{0x55, 0x55}, // Only 55
|
||||||
|
{0x66, 0x66}, // Only 66
|
||||||
|
{0x77, 0x77}, // Only 77
|
||||||
|
{0x88, 0x88}, // Only 88
|
||||||
|
{0x99, 0x99}, // Only 99
|
||||||
|
{0x12, 0x34}, // Incremental UID
|
||||||
|
{0x56, 0x34}, // Decremental UID
|
||||||
|
{0xCA, 0xCA}, // ??
|
||||||
|
{0x8E, 0xC9}, // Elevator code
|
||||||
|
{0x6A, 0x50}, // VERY fresh code from smartkey
|
||||||
|
};
|
||||||
|
|
||||||
|
const FuzzerProtocol fuzzer_proto_items[] = {
|
||||||
|
[DS1990] =
|
||||||
|
{
|
||||||
|
.name = "DS1990",
|
||||||
|
.data_size = DS1990_DATA_SIZE,
|
||||||
|
.dict =
|
||||||
|
{.val = (const uint8_t*)&uid_list_ds1990,
|
||||||
|
.len = sizeof(uid_list_ds1990) / DS1990_DATA_SIZE},
|
||||||
|
},
|
||||||
|
[Metakom] =
|
||||||
|
{
|
||||||
|
.name = "Metakom",
|
||||||
|
.data_size = Metakom_DATA_SIZE,
|
||||||
|
.dict =
|
||||||
|
{.val = (const uint8_t*)&uid_list_metakom,
|
||||||
|
.len = sizeof(uid_list_metakom) / Metakom_DATA_SIZE},
|
||||||
|
},
|
||||||
|
[Cyfral] =
|
||||||
|
{
|
||||||
|
.name = "Cyfral",
|
||||||
|
.data_size = Cyfral_DATA_SIZE,
|
||||||
|
.dict =
|
||||||
|
{.val = (const uint8_t*)&uid_list_cyfral,
|
||||||
|
.len = sizeof(uid_list_cyfral) / Cyfral_DATA_SIZE},
|
||||||
|
},
|
||||||
|
};
|
||||||
28
applications/external/pacs_fuzzer/helpers/protocol.h
vendored
Normal file
28
applications/external/pacs_fuzzer/helpers/protocol.h
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DS1990,
|
||||||
|
Metakom,
|
||||||
|
Cyfral,
|
||||||
|
// Reserved
|
||||||
|
FuzzerProtoMax,
|
||||||
|
} FuzzerProtos;
|
||||||
|
|
||||||
|
struct ProtoDict {
|
||||||
|
const uint8_t* val;
|
||||||
|
const uint8_t len;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct ProtoDict ProtoDict;
|
||||||
|
|
||||||
|
struct FuzzerProtocol {
|
||||||
|
const char* name;
|
||||||
|
const uint8_t data_size;
|
||||||
|
const ProtoDict dict;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct FuzzerProtocol FuzzerProtocol;
|
||||||
|
|
||||||
|
extern const FuzzerProtocol fuzzer_proto_items[];
|
||||||
@@ -4,12 +4,21 @@
|
|||||||
#include <input/input.h>
|
#include <input/input.h>
|
||||||
#include <gui/elements.h>
|
#include <gui/elements.h>
|
||||||
|
|
||||||
|
#include "../helpers/protocol.h"
|
||||||
|
|
||||||
|
const char* main_menu_items[FuzzerMainMenuIndexMax] = {
|
||||||
|
[FuzzerMainMenuIndexDefaultValues] = "Default Values",
|
||||||
|
[FuzzerMainMenuIndexLoadFile] = "Load File",
|
||||||
|
[FuzzerMainMenuIndexLoadFileCustomUids] = "Load UIDs from file",
|
||||||
|
};
|
||||||
|
|
||||||
struct FuzzerViewMain {
|
struct FuzzerViewMain {
|
||||||
View* view;
|
View* view;
|
||||||
FuzzerViewMainCallback callback;
|
FuzzerViewMainCallback callback;
|
||||||
void* context;
|
void* context;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO Furi string for procol name
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t proto_index;
|
uint8_t proto_index;
|
||||||
uint8_t menu_index;
|
uint8_t menu_index;
|
||||||
@@ -26,8 +35,30 @@ void fuzzer_view_main_set_callback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fuzzer_view_main_draw(Canvas* canvas, FuzzerViewMainModel* model) {
|
void fuzzer_view_main_draw(Canvas* canvas, FuzzerViewMainModel* model) {
|
||||||
UNUSED(canvas);
|
canvas_clear(canvas);
|
||||||
UNUSED(model);
|
canvas_set_color(canvas, ColorBlack);
|
||||||
|
|
||||||
|
if(model->menu_index > 0) {
|
||||||
|
canvas_set_font(canvas, FontSecondary);
|
||||||
|
canvas_draw_str_aligned(
|
||||||
|
canvas, 64, 24, AlignCenter, AlignTop, main_menu_items[model->menu_index - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas_set_font(canvas, FontPrimary);
|
||||||
|
canvas_draw_str_aligned(
|
||||||
|
canvas, 64, 36, AlignCenter, AlignTop, main_menu_items[model->menu_index]);
|
||||||
|
|
||||||
|
if(model->menu_index < FuzzerMainMenuIndexMax) {
|
||||||
|
canvas_set_font(canvas, FontSecondary);
|
||||||
|
canvas_draw_str_aligned(
|
||||||
|
canvas, 64, 48, AlignCenter, AlignTop, main_menu_items[model->menu_index + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas_set_font(canvas, FontPrimary);
|
||||||
|
canvas_draw_str_aligned(canvas, 27, 4, AlignCenter, AlignTop, "<");
|
||||||
|
canvas_draw_str_aligned(
|
||||||
|
canvas, 64, 4, AlignCenter, AlignTop, fuzzer_proto_items[model->proto_index].name);
|
||||||
|
canvas_draw_str_aligned(canvas, 101, 4, AlignCenter, AlignTop, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fuzzer_view_main_input(InputEvent* event, void* context) {
|
bool fuzzer_view_main_input(InputEvent* event, void* context) {
|
||||||
@@ -38,6 +69,54 @@ bool fuzzer_view_main_input(InputEvent* event, void* context) {
|
|||||||
(event->type == InputTypeLong || event->type == InputTypeShort)) {
|
(event->type == InputTypeLong || event->type == InputTypeShort)) {
|
||||||
fuzzer_view_main->callback(FuzzerCustomEventViewMainBack, fuzzer_view_main->context);
|
fuzzer_view_main->callback(FuzzerCustomEventViewMainBack, fuzzer_view_main->context);
|
||||||
return true;
|
return true;
|
||||||
|
} else if(event->key == InputKeyDown && event->type == InputTypeShort) {
|
||||||
|
with_view_model(
|
||||||
|
fuzzer_view_main->view,
|
||||||
|
FuzzerViewMainModel * model,
|
||||||
|
{
|
||||||
|
if(model->menu_index < (FuzzerMainMenuIndexMax - 1)) {
|
||||||
|
model->menu_index++;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true);
|
||||||
|
return true;
|
||||||
|
} else if(event->key == InputKeyUp && event->type == InputTypeShort) {
|
||||||
|
with_view_model(
|
||||||
|
fuzzer_view_main->view,
|
||||||
|
FuzzerViewMainModel * model,
|
||||||
|
{
|
||||||
|
if(model->menu_index != 0) {
|
||||||
|
model->menu_index--;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true);
|
||||||
|
return true;
|
||||||
|
} else if(event->key == InputKeyLeft && event->type == InputTypeShort) {
|
||||||
|
with_view_model(
|
||||||
|
fuzzer_view_main->view,
|
||||||
|
FuzzerViewMainModel * model,
|
||||||
|
{
|
||||||
|
if(model->proto_index != 0) {
|
||||||
|
model->proto_index--;
|
||||||
|
} else {
|
||||||
|
model->proto_index = (FuzzerProtoMax - 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true);
|
||||||
|
return true;
|
||||||
|
} else if(event->key == InputKeyRight && event->type == InputTypeShort) {
|
||||||
|
with_view_model(
|
||||||
|
fuzzer_view_main->view,
|
||||||
|
FuzzerViewMainModel * model,
|
||||||
|
{
|
||||||
|
if(model->proto_index == (FuzzerProtoMax - 1)) {
|
||||||
|
model->proto_index = 0;
|
||||||
|
} else {
|
||||||
|
model->proto_index++;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user