forked from flipperdevices/flipperzero-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nfc: NTAG password auto capture (and other password-related changes) (f…
…lipperdevices#1843) * nfc: MFUL minor cleanup * nfc: Add mechanism to pass event data * nfc: Add NTAG authentication event to emulation * nfc: Rename enum member to align with existing convention * nfc: Add function to determine whether MFUL is fully captured * nfc: Fix emulation of incompletely-read password-protected MFUL * nfc: Add reader password capture scene * nfc: Set default MFUL password input to 0xFFFFFFFF * nfc: Fix MFUL auth counter loading * nfc: Be explicit about using manual auth method when using auto unlock * nfc: Fill in MFUL has_auth when loading file * nfc: Fix MFUL auth success usage, remove unused variable * nfc: Display PWD and PACK in MFUL info if available * nfc: Remove unnecessary include * nfc: Add unlock options to loaded MFUL menu * nfc: Move set default MFUL password. This way it can be edited if needed instead of reentered * nfc: Fix unlock menu not maintaining selection index * nfc: Move captured MFUL auth data from worker to device data * nfc: Attempt to authenticate with default PWD when possible when reading NTAG * nfc: Don't try to auth NTAG on read if we already authed * nfc: Add title for all pages read but failed auth for NTAG auth * nfc: Add faster auth callback patch * lib: Remove scons submodule from index * nfc: Revise MFUL unlock UI flow * nfc: Disallow MFUL unlock with reader if card not read yet. Trying to read first results in either needing to make a new scene or badly jury rigging other scenes, so let's just not do that * f7: Bump API symbols * Format code Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
- Loading branch information
Showing
17 changed files
with
325 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_auto.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "../nfc_i.h" | ||
|
||
bool nfc_scene_mf_ultralight_unlock_auto_worker_callback(NfcWorkerEvent event, void* context) { | ||
Nfc* nfc = context; | ||
|
||
view_dispatcher_send_custom_event(nfc->view_dispatcher, event); | ||
return true; | ||
} | ||
|
||
void nfc_scene_mf_ultralight_unlock_auto_on_enter(void* context) { | ||
Nfc* nfc = context; | ||
|
||
// Setup view | ||
widget_add_string_multiline_element( | ||
nfc->widget, | ||
54, | ||
30, | ||
AlignLeft, | ||
AlignCenter, | ||
FontPrimary, | ||
"Touch the\nreader to get\npassword..."); | ||
widget_add_icon_element(nfc->widget, 0, 15, &I_Modern_reader_18x34); | ||
widget_add_icon_element(nfc->widget, 20, 12, &I_Move_flipper_26x39); | ||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget); | ||
|
||
// Start worker | ||
nfc_worker_start( | ||
nfc->worker, | ||
NfcWorkerStateMfUltralightEmulate, | ||
&nfc->dev->dev_data, | ||
nfc_scene_mf_ultralight_unlock_auto_worker_callback, | ||
nfc); | ||
|
||
nfc_blink_read_start(nfc); | ||
} | ||
|
||
bool nfc_scene_mf_ultralight_unlock_auto_on_event(void* context, SceneManagerEvent event) { | ||
Nfc* nfc = context; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
if((event.event == NfcWorkerEventMfUltralightPwdAuth)) { | ||
MfUltralightAuth* auth = &nfc->dev->dev_data.mf_ul_auth; | ||
memcpy(nfc->byte_input_store, auth->pwd.raw, sizeof(auth->pwd.raw)); | ||
nfc->dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodAuto; | ||
nfc_worker_stop(nfc->worker); | ||
notification_message(nfc->notifications, &sequence_success); | ||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightUnlockWarn); | ||
consumed = true; | ||
} | ||
} | ||
return consumed; | ||
} | ||
|
||
void nfc_scene_mf_ultralight_unlock_auto_on_exit(void* context) { | ||
Nfc* nfc = context; | ||
|
||
// Stop worker | ||
nfc_worker_stop(nfc->worker); | ||
// Clear view | ||
widget_reset(nfc->widget); | ||
|
||
nfc_blink_stop(nfc); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.