mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 17:28:36 -07:00
nfc upd
This commit is contained in:
@@ -15,12 +15,10 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary><B>TO DO</b></summary><br/>
|
<summary><B>TO DO</b></summary><br/>
|
||||||
|
|
||||||
- GPIO: Feature to read EEPROM of SFP Modules using I2C [(By marcusju)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/198)
|
|
||||||
- Settings: Rename from SD `dolphin/name.txt` [(Thanks to E_Surge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/259)
|
- Settings: Rename from SD `dolphin/name.txt` [(Thanks to E_Surge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/259)
|
||||||
- Settings: Scan names will have timestamp instead of random name assigned for [NFC](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/lib/toolbox/random_name.c) and [SubGHz](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/applications/subghz/scenes/subghz_scene_read_raw.c) (By RogueMaster)
|
- Settings: Scan names will have timestamp instead of random name assigned for [NFC](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/lib/toolbox/random_name.c) and [SubGHz](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/applications/subghz/scenes/subghz_scene_read_raw.c) (By RogueMaster)
|
||||||
- SubGHz: [Add settings to subghz read functionality to allow setting RSSI threshold (raw only) (By PolymerPrints)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/184)
|
- SubGHz: [Add settings to subghz read functionality to allow setting RSSI threshold (raw only) (By PolymerPrints)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/184)
|
||||||
- [NFC: Display UL PWD_AUTH payload / ntag-pwd-capture (Thanks to GMMan)](https://github.com/flipperdevices/flipperzero-firmware/pull/1471)
|
- [NFC: Display UL PWD_AUTH payload / ntag-pwd-capture (Thanks to GMMan)](https://github.com/flipperdevices/flipperzero-firmware/pull/1471)
|
||||||
- [I²C-Scanner #1431 (By GitChris3004)](https://github.com/flipperdevices/flipperzero-firmware/pull/1431)
|
|
||||||
- [Decode RAW recordings #1667 (By qistoph)](https://github.com/flipperdevices/flipperzero-firmware/pull/1667)
|
- [Decode RAW recordings #1667 (By qistoph)](https://github.com/flipperdevices/flipperzero-firmware/pull/1667)
|
||||||
- [Add new card parsers #1503 (By Astrrra)](https://github.com/flipperdevices/flipperzero-firmware/pull/1503)
|
- [Add new card parsers #1503 (By Astrrra)](https://github.com/flipperdevices/flipperzero-firmware/pull/1503)
|
||||||
- [Keynote BT plugin: long press on OK to switch between Space and Retur… #1729 (By coded-with-claws)](https://github.com/flipperdevices/flipperzero-firmware/pull/1729)
|
- [Keynote BT plugin: long press on OK to switch between Space and Retur… #1729 (By coded-with-claws)](https://github.com/flipperdevices/flipperzero-firmware/pull/1729)
|
||||||
@@ -180,8 +178,8 @@ $ ./fbt plugin_dist FIRMWARE_APP_SET=ext_apps
|
|||||||
|
|
||||||
- [2048 (By OlegSchwann)](https://github.com/OlegSchwann/flipperzero-firmware/tree/hackaton/game_2048/applications/game-2048) [(Score By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/186)
|
- [2048 (By OlegSchwann)](https://github.com/OlegSchwann/flipperzero-firmware/tree/hackaton/game_2048/applications/game-2048) [(Score By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/186)
|
||||||
- [Arkanoid (By gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins) [(Score By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/188)
|
- [Arkanoid (By gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins) [(Score By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/188)
|
||||||
- [Chess (By Okalachev)](https://github.com/okalachev/flipperzero-firmware/tree/chess) Crashes 1st load if FW <~750KB or every load on larger FW
|
- [Chess (By Okalachev)](https://github.com/okalachev/flipperzero-firmware/tree/chess) Crashes 1st load if FW <~750KB or every load on larger FW `Broken?`
|
||||||
- [Chip8 Emulator (By mega8bit)](https://github.com/mega8bit/flipperzero-firmware) Updated by ESurge. Add SD folder `chip8`, [Get GAMES HERE](https://johnearnest.github.io/chip8Archive/) (Needs Controls Programmed)
|
- [Chip8 Emulator (By mega8bit)](https://github.com/mega8bit/flipperzero-firmware) Updated by ESurge. Add SD folder `chip8`, [Get GAMES HERE](https://johnearnest.github.io/chip8Archive/) (Needs Controls Programmed) `HIDDEN because its broken`
|
||||||
- [Doom (By p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
|
- [Doom (By p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
|
||||||
- [Dice Roller Including SEX/WAR/8BALL/WEED DICE (By RogueMaster)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/applications/dice/dice.c)
|
- [Dice Roller Including SEX/WAR/8BALL/WEED DICE (By RogueMaster)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/applications/dice/dice.c)
|
||||||
- [Flappy Bird (By DroomOne)](https://github.com/DroomOne/flipperzero-firmware/tree/dev/applications/flappy_bird)
|
- [Flappy Bird (By DroomOne)](https://github.com/DroomOne/flipperzero-firmware/tree/dev/applications/flappy_bird)
|
||||||
|
|||||||
@@ -231,7 +231,30 @@ void nfc_show_loading_popup(void* context, bool show) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool nfc_is_hal_ready() {
|
||||||
|
if(!furi_hal_nfc_is_init()) {
|
||||||
|
// No connection to the chip, show an error screen
|
||||||
|
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||||
|
DialogMessage* message = dialog_message_alloc();
|
||||||
|
dialog_message_set_text(
|
||||||
|
message,
|
||||||
|
"Error!\nNFC chip failed to start\n\n\nSend a photo of this to:\nsupport@flipperzero.one",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
AlignLeft,
|
||||||
|
AlignTop);
|
||||||
|
dialog_message_show(dialogs, message);
|
||||||
|
dialog_message_free(message);
|
||||||
|
furi_record_close(RECORD_DIALOGS);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t nfc_app(void* p) {
|
int32_t nfc_app(void* p) {
|
||||||
|
if(!nfc_is_hal_ready()) return 0;
|
||||||
|
|
||||||
Nfc* nfc = nfc_alloc();
|
Nfc* nfc = nfc_alloc();
|
||||||
char* args = p;
|
char* args = p;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <nfc/scenes/nfc_scene.h>
|
#include <nfc/scenes/nfc_scene.h>
|
||||||
#include <nfc/helpers/nfc_custom_event.h>
|
#include <nfc/helpers/nfc_custom_event.h>
|
||||||
|
|
||||||
|
#include <dialogs/dialogs.h>
|
||||||
|
|
||||||
#include "rpc/rpc_app.h"
|
#include "rpc/rpc_app.h"
|
||||||
|
|
||||||
#define NFC_TEXT_STORE_SIZE 128
|
#define NFC_TEXT_STORE_SIZE 128
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ void nfc_scene_device_info_on_enter(void* context) {
|
|||||||
}
|
}
|
||||||
string_clear(country_name);
|
string_clear(country_name);
|
||||||
}
|
}
|
||||||
} else if(dev_data->protocol == NfcDeviceProtocolMifareClassic) {
|
} else if(
|
||||||
|
dev_data->protocol == NfcDeviceProtocolMifareClassic ||
|
||||||
|
dev_data->protocol == NfcDeviceProtocolMifareUl) {
|
||||||
string_set(temp_str, nfc->dev->dev_data.parsed_data);
|
string_set(temp_str, nfc->dev->dev_data.parsed_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
|
|||||||
|
|
||||||
// If failed to load user dictionary - try flipper dictionary
|
// If failed to load user dictionary - try flipper dictionary
|
||||||
if(!dict) {
|
if(!dict) {
|
||||||
FURI_LOG_E(TAG, "User dictionary not found");
|
FURI_LOG_E(TAG, "User Dictionary Not Found");
|
||||||
state = DictAttackStateFlipperDictInProgress;
|
state = DictAttackStateFlipperDictInProgress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
|
|||||||
dict_attack_set_header(nfc->dict_attack, "Mf Classic Flipper Dict.");
|
dict_attack_set_header(nfc->dict_attack, "Mf Classic Flipper Dict.");
|
||||||
dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper);
|
dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper);
|
||||||
if(!dict) {
|
if(!dict) {
|
||||||
FURI_LOG_E(TAG, "Flipper dictionary not found");
|
FURI_LOG_E(TAG, "Flipper Dictionary Not Found");
|
||||||
// Pass through to let worker handle the failure
|
// Pass through to let worker handle the failure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
|
|||||||
widget_add_string_element(
|
widget_add_string_element(
|
||||||
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "MF Classic Keys");
|
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "MF Classic Keys");
|
||||||
char temp_str[32];
|
char temp_str[32];
|
||||||
snprintf(temp_str, sizeof(temp_str), "Flipper dict: %ld", flipper_dict_keys_total);
|
snprintf(temp_str, sizeof(temp_str), "Flipper Dict: %ld", flipper_dict_keys_total);
|
||||||
widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str);
|
widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str);
|
||||||
snprintf(temp_str, sizeof(temp_str), "User dict: %ld", user_dict_keys_total);
|
snprintf(temp_str, sizeof(temp_str), "User Dict: %ld", user_dict_keys_total);
|
||||||
widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str);
|
widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str);
|
||||||
widget_add_button_element(
|
widget_add_button_element(
|
||||||
nfc->widget, GuiButtonTypeCenter, "Add", nfc_scene_mf_classic_keys_widget_callback, nfc);
|
nfc->widget, GuiButtonTypeCenter, "Add", nfc_scene_mf_classic_keys_widget_callback, nfc);
|
||||||
|
|||||||
@@ -1,34 +1,109 @@
|
|||||||
#include "../nfc_i.h"
|
#include "../nfc_i.h"
|
||||||
|
#include <lib/nfc/protocols/mifare_ultralight.h>
|
||||||
#include <dolphin/dolphin.h>
|
#include <dolphin/dolphin.h>
|
||||||
|
|
||||||
#define NFC_MF_UL_DATA_NOT_CHANGED (0UL)
|
#define NFC_SCENE_MF_ULTRALIGHT_EMULATE_LOG_SIZE_MAX (200)
|
||||||
#define NFC_MF_UL_DATA_CHANGED (1UL)
|
|
||||||
|
enum {
|
||||||
|
// View states
|
||||||
|
NfcSceneMfUltralightEmulateStateWidget,
|
||||||
|
NfcSceneMfUltralightEmulateStateTextBox,
|
||||||
|
NfcSceneMfUltralightEmulateStateMax = 0xFF,
|
||||||
|
// State flags
|
||||||
|
NfcSceneMfUltralightEmulateStateDataChanged = 1 << 8,
|
||||||
|
NfcSceneMfUltralightEmulateStateAuthAttempted = 1 << 9,
|
||||||
|
NfcSceneMfUltralightEmulateStateLogButtonShown = 1 << 10,
|
||||||
|
};
|
||||||
|
|
||||||
bool nfc_mf_ultralight_emulate_worker_callback(NfcWorkerEvent event, void* context) {
|
bool nfc_mf_ultralight_emulate_worker_callback(NfcWorkerEvent event, void* context) {
|
||||||
UNUSED(event);
|
|
||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
|
uint32_t state =
|
||||||
|
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate);
|
||||||
|
|
||||||
|
if(event == NfcWorkerEventSuccess)
|
||||||
|
state |= NfcSceneMfUltralightEmulateStateDataChanged;
|
||||||
|
else if(event == NfcWorkerEventMfUltralightPwdAuth) {
|
||||||
|
// Don't update if we're exiting
|
||||||
|
if(nfc_worker_get_state(nfc->worker) != NfcWorkerStateStop) {
|
||||||
|
// Event data is only available for the duration of this callback, so we're updating the
|
||||||
|
// text box right here
|
||||||
|
MfUltralightAuth* auth = nfc_worker_get_event_data(nfc->worker);
|
||||||
|
if(auth != NULL &&
|
||||||
|
string_size(nfc->text_box_store) < NFC_SCENE_MF_ULTRALIGHT_EMULATE_LOG_SIZE_MAX) {
|
||||||
|
string_cat(nfc->text_box_store, "PWD:");
|
||||||
|
for(size_t i = 0; i < sizeof(auth->pwd.raw); ++i) {
|
||||||
|
string_cat_printf(nfc->text_box_store, " %02X", auth->pwd.raw[i]);
|
||||||
|
}
|
||||||
|
string_push_back(nfc->text_box_store, '\n');
|
||||||
|
text_box_set_text(nfc->text_box, string_get_cstr(nfc->text_box_store));
|
||||||
|
}
|
||||||
|
state |= NfcSceneMfUltralightEmulateStateAuthAttempted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate, state);
|
||||||
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventWorkerExit);
|
||||||
|
|
||||||
scene_manager_set_scene_state(
|
|
||||||
nfc->scene_manager, NfcSceneMfUltralightEmulate, NFC_MF_UL_DATA_CHANGED);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nfc_scene_mf_ultralight_emulate_widget_callback(
|
||||||
|
GuiButtonType result,
|
||||||
|
InputType type,
|
||||||
|
void* context) {
|
||||||
|
furi_assert(context);
|
||||||
|
Nfc* nfc = context;
|
||||||
|
if(type == InputTypeShort) {
|
||||||
|
view_dispatcher_send_custom_event(nfc->view_dispatcher, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nfc_scene_mf_ultralight_emulate_widget_config(Nfc* nfc, bool auth_attempted) {
|
||||||
|
Widget* widget = nfc->widget;
|
||||||
|
widget_reset(widget);
|
||||||
|
string_t info_str;
|
||||||
|
string_init(info_str);
|
||||||
|
|
||||||
|
widget_add_icon_element(widget, 0, 3, &I_RFIDDolphinSend_97x61);
|
||||||
|
if(strcmp(nfc->dev->dev_name, "")) {
|
||||||
|
string_printf(info_str, "Emulating\n%s", nfc->dev->dev_name);
|
||||||
|
} else {
|
||||||
|
string_printf(info_str, "Emulating\nMf Ultralight");
|
||||||
|
}
|
||||||
|
|
||||||
|
widget_add_string_multiline_element(
|
||||||
|
widget, 56, 31, AlignLeft, AlignTop, FontPrimary, string_get_cstr(info_str));
|
||||||
|
string_clear(info_str);
|
||||||
|
if(auth_attempted) {
|
||||||
|
widget_add_button_element(
|
||||||
|
widget,
|
||||||
|
GuiButtonTypeCenter,
|
||||||
|
"Log",
|
||||||
|
nfc_scene_mf_ultralight_emulate_widget_callback,
|
||||||
|
nfc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
|
uint32_t state =
|
||||||
|
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate);
|
||||||
DOLPHIN_DEED(DolphinDeedNfcEmulate);
|
DOLPHIN_DEED(DolphinDeedNfcEmulate);
|
||||||
|
|
||||||
// Setup view
|
// Setup Widget
|
||||||
Popup* popup = nfc->popup;
|
nfc_scene_mf_ultralight_emulate_widget_config(nfc, false);
|
||||||
if(strcmp(nfc->dev->dev_name, "")) {
|
state &= ~NfcSceneMfUltralightEmulateStateLogButtonShown;
|
||||||
nfc_text_store_set(nfc, "Emulating\n%s", nfc->dev->dev_name);
|
// Setup TextBox
|
||||||
} else {
|
TextBox* text_box = nfc->text_box;
|
||||||
nfc_text_store_set(nfc, "Emulating\nMf Ultralight", nfc->dev->dev_name);
|
text_box_set_font(text_box, TextBoxFontHex);
|
||||||
}
|
text_box_set_focus(text_box, TextBoxFocusEnd);
|
||||||
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
|
string_reset(nfc->text_box_store);
|
||||||
popup_set_header(popup, nfc->text_store, 56, 31, AlignLeft, AlignTop);
|
|
||||||
|
|
||||||
// Setup and start worker
|
// Set Widget state and view
|
||||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
state = (state & ~NfcSceneMfUltralightEmulateStateMax) |
|
||||||
|
NfcSceneMfUltralightEmulateStateWidget;
|
||||||
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate, state);
|
||||||
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
||||||
|
// Start worker
|
||||||
nfc_worker_start(
|
nfc_worker_start(
|
||||||
nfc->worker,
|
nfc->worker,
|
||||||
NfcWorkerStateMfUltralightEmulate,
|
NfcWorkerStateMfUltralightEmulate,
|
||||||
@@ -40,28 +115,64 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
|||||||
|
|
||||||
bool nfc_scene_mf_ultralight_emulate_on_event(void* context, SceneManagerEvent event) {
|
bool nfc_scene_mf_ultralight_emulate_on_event(void* context, SceneManagerEvent event) {
|
||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
|
uint32_t state =
|
||||||
|
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate);
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeBack) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
// Stop worker
|
if(event.event == NfcCustomEventWorkerExit) {
|
||||||
nfc_worker_stop(nfc->worker);
|
if(state & NfcSceneMfUltralightEmulateStateAuthAttempted) {
|
||||||
// Check if data changed and save in shadow file
|
if(!(state & NfcSceneMfUltralightEmulateStateLogButtonShown)) {
|
||||||
if(scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate) ==
|
// Add log button to widget not already showing
|
||||||
NFC_MF_UL_DATA_CHANGED) {
|
nfc_scene_mf_ultralight_emulate_widget_config(nfc, true);
|
||||||
scene_manager_set_scene_state(
|
state |= NfcSceneMfUltralightEmulateStateLogButtonShown;
|
||||||
nfc->scene_manager, NfcSceneMfUltralightEmulate, NFC_MF_UL_DATA_NOT_CHANGED);
|
}
|
||||||
nfc_device_save_shadow(nfc->dev, nfc->dev->dev_name);
|
// The text box update logic is handled in the worker callback
|
||||||
|
state &= ~NfcSceneMfUltralightEmulateStateAuthAttempted;
|
||||||
|
scene_manager_set_scene_state(
|
||||||
|
nfc->scene_manager, NfcSceneMfUltralightEmulate, state);
|
||||||
|
consumed = true;
|
||||||
|
}
|
||||||
|
} else if(
|
||||||
|
event.event == GuiButtonTypeCenter && (state & NfcSceneMfUltralightEmulateStateMax) ==
|
||||||
|
NfcSceneMfUltralightEmulateStateWidget) {
|
||||||
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewTextBox);
|
||||||
|
state = (state & ~NfcSceneMfUltralightEmulateStateMax) |
|
||||||
|
NfcSceneMfUltralightEmulateStateTextBox;
|
||||||
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate, state);
|
||||||
|
consumed = true;
|
||||||
|
}
|
||||||
|
} else if(event.type == SceneManagerEventTypeBack) {
|
||||||
|
if((state & NfcSceneMfUltralightEmulateStateMax) ==
|
||||||
|
NfcSceneMfUltralightEmulateStateTextBox) {
|
||||||
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
||||||
|
state = (state & ~NfcSceneMfUltralightEmulateStateMax) |
|
||||||
|
NfcSceneMfUltralightEmulateStateWidget;
|
||||||
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate, state);
|
||||||
|
consumed = true;
|
||||||
}
|
}
|
||||||
consumed = false;
|
|
||||||
}
|
}
|
||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfc_scene_mf_ultralight_emulate_on_exit(void* context) {
|
void nfc_scene_mf_ultralight_emulate_on_exit(void* context) {
|
||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
|
uint32_t state =
|
||||||
|
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate);
|
||||||
|
|
||||||
|
// Stop worker
|
||||||
|
nfc_worker_stop(nfc->worker);
|
||||||
|
// Check if data changed and save in shadow file
|
||||||
|
if(state & NfcSceneMfUltralightEmulateStateDataChanged) {
|
||||||
|
state &= ~NfcSceneMfUltralightEmulateStateDataChanged;
|
||||||
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate, state);
|
||||||
|
nfc_device_save_shadow(nfc->dev, nfc->dev->dev_name);
|
||||||
|
}
|
||||||
|
|
||||||
// Clear view
|
// Clear view
|
||||||
popup_reset(nfc->popup);
|
widget_reset(nfc->widget);
|
||||||
|
text_box_reset(nfc->text_box);
|
||||||
|
string_reset(nfc->text_box_store);
|
||||||
|
|
||||||
nfc_blink_stop(nfc);
|
nfc_blink_stop(nfc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ void nfc_scene_mf_ultralight_key_input_on_enter(void* context) {
|
|||||||
|
|
||||||
// Setup view
|
// Setup view
|
||||||
ByteInput* byte_input = nfc->byte_input;
|
ByteInput* byte_input = nfc->byte_input;
|
||||||
byte_input_set_header_text(byte_input, "Enter the password in hex");
|
byte_input_set_header_text(byte_input, "Enter The Password In Hex");
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input,
|
||||||
nfc_scene_mf_ultralight_key_input_byte_input_callback,
|
nfc_scene_mf_ultralight_key_input_byte_input_callback,
|
||||||
|
|||||||
@@ -26,19 +26,19 @@ void nfc_scene_mf_ultralight_read_auth_set_state(Nfc* nfc, NfcSceneMfUlReadState
|
|||||||
if(state == NfcSceneMfUlReadStateDetecting) {
|
if(state == NfcSceneMfUlReadStateDetecting) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_text(
|
popup_set_text(
|
||||||
nfc->popup, "Apply card to\nFlipper's back", 97, 24, AlignCenter, AlignTop);
|
nfc->popup, "Apply Card To\nFlipper's Back", 97, 24, AlignCenter, AlignTop);
|
||||||
popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual);
|
popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual);
|
||||||
} else if(state == NfcSceneMfUlReadStateReading) {
|
} else if(state == NfcSceneMfUlReadStateReading) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_header(
|
popup_set_header(
|
||||||
nfc->popup, "Reading card\nDon't move...", 85, 24, AlignCenter, AlignTop);
|
nfc->popup, "Reading Card\nDon't Move...", 85, 24, AlignCenter, AlignTop);
|
||||||
popup_set_icon(nfc->popup, 12, 23, &A_Loading_24);
|
popup_set_icon(nfc->popup, 12, 23, &A_Loading_24);
|
||||||
} else if(state == NfcSceneMfUlReadStateNotSupportedCard) {
|
} else if(state == NfcSceneMfUlReadStateNotSupportedCard) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_header(nfc->popup, "Wrong type of card!", 64, 3, AlignCenter, AlignTop);
|
popup_set_header(nfc->popup, "Wrong Type Of Card!", 64, 3, AlignCenter, AlignTop);
|
||||||
popup_set_text(
|
popup_set_text(
|
||||||
nfc->popup,
|
nfc->popup,
|
||||||
"Only MIFARE\nUltralight & NTAG\n are supported",
|
"Only MIFARE\nUltralight & NTAG\n Are Supported",
|
||||||
4,
|
4,
|
||||||
22,
|
22,
|
||||||
AlignLeft,
|
AlignLeft,
|
||||||
|
|||||||
@@ -34,15 +34,19 @@ void nfc_scene_mf_ultralight_read_success_on_enter(void* context) {
|
|||||||
nfc);
|
nfc);
|
||||||
|
|
||||||
string_t temp_str;
|
string_t temp_str;
|
||||||
string_init_printf(temp_str, "\e#%s\n", nfc_mf_ul_type(mf_ul_data->type, true));
|
if(string_size(nfc->dev->dev_data.parsed_data)) {
|
||||||
string_cat_printf(temp_str, "UID:");
|
string_init_set(temp_str, nfc->dev->dev_data.parsed_data);
|
||||||
for(size_t i = 0; i < data->uid_len; i++) {
|
} else {
|
||||||
string_cat_printf(temp_str, " %02X", data->uid[i]);
|
string_init_printf(temp_str, "\e#%s\n", nfc_mf_ul_type(mf_ul_data->type, true));
|
||||||
}
|
string_cat_printf(temp_str, "UID:");
|
||||||
string_cat_printf(
|
for(size_t i = 0; i < data->uid_len; i++) {
|
||||||
temp_str, "\nPages Read: %d/%d", mf_ul_data->data_read / 4, mf_ul_data->data_size / 4);
|
string_cat_printf(temp_str, " %02X", data->uid[i]);
|
||||||
if(mf_ul_data->data_read != mf_ul_data->data_size) {
|
}
|
||||||
string_cat_printf(temp_str, "\nPassword-protected pages!");
|
string_cat_printf(
|
||||||
|
temp_str, "\nPages Read: %d/%d", mf_ul_data->data_read / 4, mf_ul_data->data_size / 4);
|
||||||
|
if(mf_ul_data->data_read != mf_ul_data->data_size) {
|
||||||
|
string_cat_printf(temp_str, "\nPassword-protected pages!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
widget_add_text_scroll_element(widget, 0, 0, 128, 52, string_get_cstr(temp_str));
|
widget_add_text_scroll_element(widget, 0, 0, 128, 52, string_get_cstr(temp_str));
|
||||||
string_clear(temp_str);
|
string_clear(temp_str);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void nfc_scene_mf_ultralight_unlock_menu_on_enter(void* context) {
|
|||||||
nfc);
|
nfc);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Auth As Am11bo",
|
"Auth As Ameebo",
|
||||||
SubmenuIndexMfUlUnlockMenuAmeebo,
|
SubmenuIndexMfUlUnlockMenuAmeebo,
|
||||||
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
||||||
nfc);
|
nfc);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void nfc_scene_mf_ultralight_unlock_warn_on_enter(void* context) {
|
|||||||
dialog_ex_set_context(dialog_ex, nfc);
|
dialog_ex_set_context(dialog_ex, nfc);
|
||||||
dialog_ex_set_result_callback(dialog_ex, nfc_scene_mf_ultralight_unlock_warn_dialog_callback);
|
dialog_ex_set_result_callback(dialog_ex, nfc_scene_mf_ultralight_unlock_warn_dialog_callback);
|
||||||
|
|
||||||
dialog_ex_set_header(dialog_ex, "Risky function!", 64, 4, AlignCenter, AlignTop);
|
dialog_ex_set_header(dialog_ex, "Risky Function!", 64, 4, AlignCenter, AlignTop);
|
||||||
dialog_ex_set_text(
|
dialog_ex_set_text(
|
||||||
dialog_ex, "Wrong password\ncan block your\ncard.", 4, 18, AlignLeft, AlignTop);
|
dialog_ex, "Wrong password\ncan block your\ncard.", 4, 18, AlignLeft, AlignTop);
|
||||||
dialog_ex_set_icon(dialog_ex, 73, 20, &I_DolphinCommon_56x48);
|
dialog_ex_set_icon(dialog_ex, 73, 20, &I_DolphinCommon_56x48);
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ void nfc_scene_read_set_state(Nfc* nfc, NfcSceneReadState state) {
|
|||||||
if(state == NfcSceneReadStateDetecting) {
|
if(state == NfcSceneReadStateDetecting) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_text(
|
popup_set_text(
|
||||||
nfc->popup, "Apply card to\nFlipper's back", 97, 24, AlignCenter, AlignTop);
|
nfc->popup, "Apply Card To\nFlipper's Back", 97, 24, AlignCenter, AlignTop);
|
||||||
popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual);
|
popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual);
|
||||||
} else if(state == NfcSceneReadStateReading) {
|
} else if(state == NfcSceneReadStateReading) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_header(
|
popup_set_header(
|
||||||
nfc->popup, "Reading card\nDon't move...", 85, 24, AlignCenter, AlignTop);
|
nfc->popup, "Reading Card\nDon't Move...", 85, 24, AlignCenter, AlignTop);
|
||||||
popup_set_icon(nfc->popup, 12, 23, &A_Loading_24);
|
popup_set_icon(nfc->popup, 12, 23, &A_Loading_24);
|
||||||
}
|
}
|
||||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneRead, state);
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneRead, state);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void nfc_scene_save_name_on_enter(void* context) {
|
|||||||
} else {
|
} else {
|
||||||
nfc_text_store_set(nfc, nfc->dev->dev_name);
|
nfc_text_store_set(nfc, nfc->dev->dev_name);
|
||||||
}
|
}
|
||||||
text_input_set_header_text(text_input, "Name the card");
|
text_input_set_header_text(text_input, "Name The Card");
|
||||||
text_input_set_result_callback(
|
text_input_set_result_callback(
|
||||||
text_input,
|
text_input,
|
||||||
nfc_scene_save_name_text_input_callback,
|
nfc_scene_save_name_text_input_callback,
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ bool nfc_scene_saved_menu_on_event(void* context, SceneManagerEvent event) {
|
|||||||
bool application_info_present = false;
|
bool application_info_present = false;
|
||||||
if(dev_data->protocol == NfcDeviceProtocolEMV) {
|
if(dev_data->protocol == NfcDeviceProtocolEMV) {
|
||||||
application_info_present = true;
|
application_info_present = true;
|
||||||
} else if(dev_data->protocol == NfcDeviceProtocolMifareClassic) {
|
} else if(
|
||||||
|
dev_data->protocol == NfcDeviceProtocolMifareClassic ||
|
||||||
|
dev_data->protocol == NfcDeviceProtocolMifareUl) {
|
||||||
application_info_present = nfc_supported_card_verify_and_parse(dev_data);
|
application_info_present = nfc_supported_card_verify_and_parse(dev_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ static void dict_attack_draw_callback(Canvas* canvas, void* model) {
|
|||||||
DictAttackViewModel* m = model;
|
DictAttackViewModel* m = model;
|
||||||
if(m->state == DictAttackStateCardRemoved) {
|
if(m->state == DictAttackStateCardRemoved) {
|
||||||
canvas_set_font(canvas, FontPrimary);
|
canvas_set_font(canvas, FontPrimary);
|
||||||
canvas_draw_str_aligned(canvas, 64, 4, AlignCenter, AlignTop, "Lost the tag!");
|
canvas_draw_str_aligned(canvas, 64, 4, AlignCenter, AlignTop, "Lost The Tag!");
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
elements_multiline_text_aligned(
|
elements_multiline_text_aligned(
|
||||||
canvas, 64, 23, AlignCenter, AlignTop, "Make sure the tag is\npositioned correctly.");
|
canvas, 64, 23, AlignCenter, AlignTop, "Make sure the tag is\npositioned correctly.");
|
||||||
@@ -51,7 +51,7 @@ static void dict_attack_draw_callback(Canvas* canvas, void* model) {
|
|||||||
}
|
}
|
||||||
elements_progress_bar(canvas, 5, 15, 120, progress);
|
elements_progress_bar(canvas, 5, 15, 120, progress);
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
snprintf(draw_str, sizeof(draw_str), "Keys found: %d/%d", m->keys_found, m->keys_total);
|
snprintf(draw_str, sizeof(draw_str), "Keys Found: %d/%d", m->keys_found, m->keys_total);
|
||||||
canvas_draw_str_aligned(canvas, 1, 28, AlignLeft, AlignTop, draw_str);
|
canvas_draw_str_aligned(canvas, 1, 28, AlignLeft, AlignTop, draw_str);
|
||||||
snprintf(
|
snprintf(
|
||||||
draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total);
|
draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total);
|
||||||
|
|||||||
Reference in New Issue
Block a user