mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 10:58:36 -07:00
Update apps
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
App(
|
||||
appid="picopass",
|
||||
name="PicoPass",
|
||||
name="[iClass] PicoPass",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
targets=["f7"],
|
||||
entry_point="picopass_app",
|
||||
@@ -9,7 +9,8 @@ App(
|
||||
"gui",
|
||||
],
|
||||
stack_size=4 * 1024,
|
||||
order=30,
|
||||
fap_description="App to communicate with NFC tags using the PicoPass(iClass) format",
|
||||
fap_version="1.2",
|
||||
fap_icon="125_10px.png",
|
||||
fap_category="NFC",
|
||||
fap_libs=["mbedtls"],
|
||||
@@ -18,4 +19,6 @@ App(
|
||||
name="loclass",
|
||||
),
|
||||
],
|
||||
fap_icon_assets="icons",
|
||||
fap_file_assets="files",
|
||||
)
|
||||
|
||||
41
applications/external/picopass/files/iclass_elite_dict.txt
vendored
Normal file
41
applications/external/picopass/files/iclass_elite_dict.txt
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
## From https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/iclass_default_keys.dic
|
||||
|
||||
# key1/Kc from PicoPass 2k documentation
|
||||
7665544332211000
|
||||
# SAGEM
|
||||
0123456789ABCDEF
|
||||
# PicoPass Default Exchange Key
|
||||
5CBCF1DA45D5FB4F
|
||||
# From HID multiclassSE reader
|
||||
31ad7ebd2f282168
|
||||
# From pastebin: https://pastebin.com/uHqpjiuU
|
||||
6EFD46EFCBB3C875
|
||||
E033CA419AEE43F9
|
||||
|
||||
# default picopass KD / Page 0 / Book 1
|
||||
FDCB5A52EA8F3090
|
||||
237FF9079863DF44
|
||||
5ADC25FB27181D32
|
||||
83B881F2936B2E49
|
||||
43644E61EE866BA5
|
||||
897034143D016080
|
||||
82D17B44C0122963
|
||||
4895CA7DE65E2025
|
||||
DADAD4C57BE271B7
|
||||
E41E9EDEF5719ABF
|
||||
293D275EC3AF9C7F
|
||||
C3C169251B8A70FB
|
||||
F41DAF58B20C8B91
|
||||
28877A609EC0DD2B
|
||||
66584C91EE80D5E5
|
||||
C1B74D7478053AE2
|
||||
|
||||
# default iCLASS RFIDeas
|
||||
6B65797374726B72
|
||||
|
||||
# CTF key
|
||||
5C100DF7042EAE64
|
||||
|
||||
# iCopy-X DRM key (iCE product)
|
||||
2020666666668888
|
||||
47
applications/external/picopass/files/iclass_standard_dict.txt
vendored
Normal file
47
applications/external/picopass/files/iclass_standard_dict.txt
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
## From https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/iclass_default_keys.dic
|
||||
|
||||
# AA1
|
||||
AEA684A6DAB23278
|
||||
# key1/Kc from PicoPass 2k documentation
|
||||
7665544332211000
|
||||
# SAGEM
|
||||
0123456789ABCDEF
|
||||
# from loclass demo file.
|
||||
5b7c62c491c11b39
|
||||
# Kd from PicoPass 2k documentation
|
||||
F0E1D2C3B4A59687
|
||||
# PicoPass Default Exchange Key
|
||||
5CBCF1DA45D5FB4F
|
||||
# From HID multiclassSE reader
|
||||
31ad7ebd2f282168
|
||||
# From pastebin: https://pastebin.com/uHqpjiuU
|
||||
6EFD46EFCBB3C875
|
||||
E033CA419AEE43F9
|
||||
|
||||
# iCopy-x DRM keys
|
||||
# iCL tags
|
||||
2020666666668888
|
||||
# iCS tags reversed from the SOs
|
||||
6666202066668888
|
||||
|
||||
# default picopass KD / Page 0 / Book 1
|
||||
FDCB5A52EA8F3090
|
||||
237FF9079863DF44
|
||||
5ADC25FB27181D32
|
||||
83B881F2936B2E49
|
||||
43644E61EE866BA5
|
||||
897034143D016080
|
||||
82D17B44C0122963
|
||||
4895CA7DE65E2025
|
||||
DADAD4C57BE271B7
|
||||
E41E9EDEF5719ABF
|
||||
293D275EC3AF9C7F
|
||||
C3C169251B8A70FB
|
||||
F41DAF58B20C8B91
|
||||
28877A609EC0DD2B
|
||||
66584C91EE80D5E5
|
||||
C1B74D7478053AE2
|
||||
|
||||
# default iCLASS RFIDeas
|
||||
6B65797374726B72
|
||||
@@ -3,9 +3,9 @@
|
||||
#include <lib/toolbox/args.h>
|
||||
#include <lib/flipper_format/flipper_format.h>
|
||||
|
||||
#define ICLASS_ELITE_DICT_FLIPPER_NAME APP_DATA_PATH("assets/iclass_elite_dict.txt")
|
||||
#define ICLASS_ELITE_DICT_FLIPPER_NAME APP_ASSETS_PATH("iclass_elite_dict.txt")
|
||||
#define ICLASS_STANDARD_DICT_FLIPPER_NAME APP_ASSETS_PATH("iclass_standard_dict.txt")
|
||||
#define ICLASS_ELITE_DICT_USER_NAME APP_DATA_PATH("assets/iclass_elite_dict_user.txt")
|
||||
#define ICLASS_STANDARD_DICT_FLIPPER_NAME APP_DATA_PATH("assets/iclass_standard_dict.txt")
|
||||
|
||||
#define TAG "IclassEliteDict"
|
||||
|
||||
|
||||
11
applications/external/picopass/picopass.c
vendored
11
applications/external/picopass/picopass.c
vendored
@@ -68,6 +68,13 @@ Picopass* picopass_alloc() {
|
||||
PicopassViewTextInput,
|
||||
text_input_get_view(picopass->text_input));
|
||||
|
||||
// Byte Input
|
||||
picopass->byte_input = byte_input_alloc();
|
||||
view_dispatcher_add_view(
|
||||
picopass->view_dispatcher,
|
||||
PicopassViewByteInput,
|
||||
byte_input_get_view(picopass->byte_input));
|
||||
|
||||
// Custom Widget
|
||||
picopass->widget = widget_alloc();
|
||||
view_dispatcher_add_view(
|
||||
@@ -109,6 +116,10 @@ void picopass_free(Picopass* picopass) {
|
||||
view_dispatcher_remove_view(picopass->view_dispatcher, PicopassViewTextInput);
|
||||
text_input_free(picopass->text_input);
|
||||
|
||||
// ByteInput
|
||||
view_dispatcher_remove_view(picopass->view_dispatcher, PicopassViewByteInput);
|
||||
byte_input_free(picopass->byte_input);
|
||||
|
||||
// Custom Widget
|
||||
view_dispatcher_remove_view(picopass->view_dispatcher, PicopassViewWidget);
|
||||
widget_free(picopass->widget);
|
||||
|
||||
15
applications/external/picopass/picopass_device.c
vendored
15
applications/external/picopass/picopass_device.c
vendored
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <toolbox/path.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
#include "picopass_icons.h"
|
||||
#include <assets_icons.h>
|
||||
|
||||
#define TAG "PicopassDevice"
|
||||
@@ -356,8 +357,8 @@ ReturnCode picopass_device_parse_credential(PicopassBlock* AA1, PicopassPacs* pa
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
ReturnCode picopass_device_parse_wiegand(uint8_t* data, PicopassWiegandRecord* record) {
|
||||
uint32_t* halves = (uint32_t*)data;
|
||||
ReturnCode picopass_device_parse_wiegand(uint8_t* credential, PicopassWiegandRecord* record) {
|
||||
uint32_t* halves = (uint32_t*)credential;
|
||||
if(halves[0] == 0) {
|
||||
uint8_t leading0s = __builtin_clz(REVERSE_BYTES_U32(halves[1]));
|
||||
record->bitLength = 31 - leading0s;
|
||||
@@ -367,8 +368,16 @@ ReturnCode picopass_device_parse_wiegand(uint8_t* data, PicopassWiegandRecord* r
|
||||
}
|
||||
FURI_LOG_D(TAG, "bitLength: %d", record->bitLength);
|
||||
|
||||
// Remove sentinel bit from credential. Byteswapping to handle array of bytes vs 64bit value
|
||||
uint64_t sentinel = __builtin_bswap64(1ULL << record->bitLength);
|
||||
uint64_t swapped = 0;
|
||||
memcpy(&swapped, credential, sizeof(uint64_t));
|
||||
swapped = swapped ^ sentinel;
|
||||
memcpy(credential, &swapped, sizeof(uint64_t));
|
||||
FURI_LOG_D(TAG, "PACS: (%d) %016llx", record->bitLength, swapped);
|
||||
|
||||
if(record->bitLength == 26) {
|
||||
uint8_t* v4 = data + 4;
|
||||
uint8_t* v4 = credential + 4;
|
||||
uint32_t bot = v4[3] | (v4[2] << 8) | (v4[1] << 16) | (v4[0] << 24);
|
||||
|
||||
record->CardNumber = (bot >> 1) & 0xFFFF;
|
||||
|
||||
5
applications/external/picopass/picopass_i.h
vendored
5
applications/external/picopass/picopass_i.h
vendored
@@ -16,6 +16,7 @@
|
||||
#include <gui/modules/popup.h>
|
||||
#include <gui/modules/loading.h>
|
||||
#include <gui/modules/text_input.h>
|
||||
#include <gui/modules/byte_input.h>
|
||||
#include <gui/modules/widget.h>
|
||||
|
||||
#include <input/input.h>
|
||||
@@ -26,6 +27,7 @@
|
||||
|
||||
#include <storage/storage.h>
|
||||
#include <lib/toolbox/path.h>
|
||||
#include "picopass_icons.h"
|
||||
#include <assets_icons.h>
|
||||
|
||||
#define PICOPASS_TEXT_STORE_SIZE 128
|
||||
@@ -60,12 +62,14 @@ struct Picopass {
|
||||
|
||||
char text_store[PICOPASS_TEXT_STORE_SIZE + 1];
|
||||
FuriString* text_box_store;
|
||||
uint8_t byte_input_store[RFAL_PICOPASS_BLOCK_LEN];
|
||||
|
||||
// Common Views
|
||||
Submenu* submenu;
|
||||
Popup* popup;
|
||||
Loading* loading;
|
||||
TextInput* text_input;
|
||||
ByteInput* byte_input;
|
||||
Widget* widget;
|
||||
DictAttack* dict_attack;
|
||||
Loclass* loclass;
|
||||
@@ -76,6 +80,7 @@ typedef enum {
|
||||
PicopassViewPopup,
|
||||
PicopassViewLoading,
|
||||
PicopassViewTextInput,
|
||||
PicopassViewByteInput,
|
||||
PicopassViewWidget,
|
||||
PicopassViewDictAttack,
|
||||
PicopassViewLoclass,
|
||||
|
||||
@@ -21,8 +21,8 @@ static const uint8_t loclass_csns[LOCLASS_NUM_CSNS][RFAL_PICOPASS_BLOCK_LEN] = {
|
||||
};
|
||||
|
||||
static void picopass_worker_enable_field() {
|
||||
furi_hal_nfc_ll_txrx_on();
|
||||
furi_hal_nfc_exit_sleep();
|
||||
furi_hal_nfc_ll_txrx_on();
|
||||
furi_hal_nfc_ll_poll();
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ ReturnCode picopass_detect_card(int timeout) {
|
||||
|
||||
err = rfalPicoPassPollerCheckPresence();
|
||||
if(err != ERR_RF_COLLISION) {
|
||||
//FURI_LOG_E(TAG, "rfalPicoPassPollerCheckPresence error %d", err);
|
||||
FURI_LOG_E(TAG, "rfalPicoPassPollerCheckPresence error %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1057,7 +1057,9 @@ static void picopass_emu_handle_packet(
|
||||
if(memcmp(nfcv_data->frame + 5, rmac, 4)) {
|
||||
// Bad MAC from reader, do not send a response.
|
||||
FURI_LOG_I(TAG, "Got bad MAC from reader");
|
||||
#ifndef PICOPASS_DEBUG_IGNORE_BAD_RMAC
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
// CHIPRESPONSE(4)
|
||||
@@ -1196,6 +1198,8 @@ static void picopass_emu_handle_packet(
|
||||
}
|
||||
|
||||
void picopass_worker_emulate(PicopassWorker* picopass_worker, bool loclass_mode) {
|
||||
furi_hal_nfc_exit_sleep();
|
||||
|
||||
FuriHalNfcTxRxContext tx_rx = {};
|
||||
PicopassEmulatorCtx emu_ctx = {
|
||||
.state = PicopassEmulatorStateIdle,
|
||||
|
||||
@@ -47,7 +47,7 @@ FuriHalNfcReturn rfalPicoPassPollerInitialize(void) {
|
||||
FuriHalNfcModePollPicopass, FuriHalNfcBitrate26p48, FuriHalNfcBitrate26p48);
|
||||
if(ret != FuriHalNfcReturnOk) {
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
furi_hal_nfc_ll_set_error_handling(FuriHalNfcErrorHandlingNfc);
|
||||
furi_hal_nfc_ll_set_guard_time(FURI_HAL_NFC_LL_GT_PICOPASS);
|
||||
|
||||
@@ -4,6 +4,8 @@ enum SubmenuIndex {
|
||||
SubmenuIndexSave,
|
||||
SubmenuIndexSaveAsLF,
|
||||
SubmenuIndexChangeKey,
|
||||
SubmenuIndexWrite,
|
||||
SubmenuIndexEmulate,
|
||||
};
|
||||
|
||||
void picopass_scene_card_menu_submenu_callback(void* context, uint32_t index) {
|
||||
@@ -26,6 +28,14 @@ void picopass_scene_card_menu_on_enter(void* context) {
|
||||
picopass_scene_card_menu_submenu_callback,
|
||||
picopass);
|
||||
}
|
||||
submenu_add_item(
|
||||
submenu, "Write", SubmenuIndexWrite, picopass_scene_card_menu_submenu_callback, picopass);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Emulate",
|
||||
SubmenuIndexEmulate,
|
||||
picopass_scene_card_menu_submenu_callback,
|
||||
picopass);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Change Key",
|
||||
@@ -57,6 +67,12 @@ bool picopass_scene_card_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
picopass->dev->format = PicopassDeviceSaveFormatLF;
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneSaveName);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexWrite) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteCard);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexEmulate) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneEmulate);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexChangeKey) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneCardMenu, SubmenuIndexChangeKey);
|
||||
|
||||
@@ -11,9 +11,11 @@ ADD_SCENE(picopass, delete, Delete)
|
||||
ADD_SCENE(picopass, delete_success, DeleteSuccess)
|
||||
ADD_SCENE(picopass, write_card, WriteCard)
|
||||
ADD_SCENE(picopass, write_card_success, WriteCardSuccess)
|
||||
ADD_SCENE(picopass, write_card_failure, WriteCardFailure)
|
||||
ADD_SCENE(picopass, read_factory_success, ReadFactorySuccess)
|
||||
ADD_SCENE(picopass, write_key, WriteKey)
|
||||
ADD_SCENE(picopass, key_menu, KeyMenu)
|
||||
ADD_SCENE(picopass, elite_dict_attack, EliteDictAttack)
|
||||
ADD_SCENE(picopass, emulate, Emulate)
|
||||
ADD_SCENE(picopass, loclass, Loclass)
|
||||
ADD_SCENE(picopass, key_input, KeyInput)
|
||||
|
||||
@@ -17,7 +17,6 @@ void picopass_scene_device_info_on_enter(void* context) {
|
||||
FuriString* csn_str = furi_string_alloc_set("CSN:");
|
||||
FuriString* credential_str = furi_string_alloc();
|
||||
FuriString* wiegand_str = furi_string_alloc();
|
||||
FuriString* sio_str = furi_string_alloc();
|
||||
|
||||
dolphin_deed(DolphinDeedNfcReadSuccess);
|
||||
|
||||
@@ -43,7 +42,7 @@ void picopass_scene_device_info_on_enter(void* context) {
|
||||
}
|
||||
furi_string_set(credential_str, "");
|
||||
for(uint8_t i = RFAL_PICOPASS_BLOCK_LEN - bytesLength; i < RFAL_PICOPASS_BLOCK_LEN; i++) {
|
||||
furi_string_cat_printf(credential_str, " %02X", pacs->credential[i]);
|
||||
furi_string_cat_printf(credential_str, "%02X", pacs->credential[i]);
|
||||
}
|
||||
|
||||
if(pacs->record.valid) {
|
||||
@@ -54,7 +53,7 @@ void picopass_scene_device_info_on_enter(void* context) {
|
||||
}
|
||||
|
||||
if(pacs->sio) {
|
||||
furi_string_cat_printf(sio_str, "+SIO");
|
||||
furi_string_cat_printf(credential_str, " +SIO");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,13 +69,10 @@ void picopass_scene_device_info_on_enter(void* context) {
|
||||
AlignCenter,
|
||||
FontSecondary,
|
||||
furi_string_get_cstr(credential_str));
|
||||
widget_add_string_element(
|
||||
widget, 64, 46, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(sio_str));
|
||||
|
||||
furi_string_free(csn_str);
|
||||
furi_string_free(credential_str);
|
||||
furi_string_free(wiegand_str);
|
||||
furi_string_free(sio_str);
|
||||
|
||||
widget_add_button_element(
|
||||
picopass->widget,
|
||||
|
||||
48
applications/external/picopass/scenes/picopass_scene_key_input.c
vendored
Normal file
48
applications/external/picopass/scenes/picopass_scene_key_input.c
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "../picopass_i.h"
|
||||
#include <lib/toolbox/random_name.h>
|
||||
#include <gui/modules/validators.h>
|
||||
#include <toolbox/path.h>
|
||||
|
||||
void picopass_scene_key_input_text_input_callback(void* context) {
|
||||
Picopass* picopass = context;
|
||||
|
||||
picopass->dev->dev_data.pacs.elite_kdf = true;
|
||||
memcpy(picopass->dev->dev_data.pacs.key, picopass->byte_input_store, RFAL_PICOPASS_BLOCK_LEN);
|
||||
view_dispatcher_send_custom_event(picopass->view_dispatcher, PicopassCustomEventByteInputDone);
|
||||
}
|
||||
|
||||
void picopass_scene_key_input_on_enter(void* context) {
|
||||
Picopass* picopass = context;
|
||||
|
||||
ByteInput* byte_input = picopass->byte_input;
|
||||
byte_input_set_header_text(byte_input, "Enter The Key In Hex");
|
||||
byte_input_set_result_callback(
|
||||
byte_input,
|
||||
picopass_scene_key_input_text_input_callback,
|
||||
NULL,
|
||||
picopass,
|
||||
picopass->byte_input_store,
|
||||
RFAL_PICOPASS_BLOCK_LEN);
|
||||
view_dispatcher_switch_to_view(picopass->view_dispatcher, PicopassViewByteInput);
|
||||
}
|
||||
|
||||
bool picopass_scene_key_input_on_event(void* context, SceneManagerEvent event) {
|
||||
Picopass* picopass = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == PicopassCustomEventByteInputDone) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void picopass_scene_key_input_on_exit(void* context) {
|
||||
Picopass* picopass = context;
|
||||
|
||||
// Clear view
|
||||
byte_input_set_result_callback(picopass->byte_input, NULL, NULL, NULL, NULL, 0);
|
||||
byte_input_set_header_text(picopass->byte_input, "");
|
||||
}
|
||||
@@ -6,7 +6,7 @@ enum SubmenuIndex {
|
||||
SubmenuIndexWriteiCE,
|
||||
SubmenuIndexWriteiCL,
|
||||
SubmenuIndexWriteiCS,
|
||||
SubmenuIndexWriteCustom, //TODO: user input of key
|
||||
SubmenuIndexWriteCustom,
|
||||
};
|
||||
|
||||
void picopass_scene_key_menu_submenu_callback(void* context, uint32_t index) {
|
||||
@@ -43,6 +43,12 @@ void picopass_scene_key_menu_on_enter(void* context) {
|
||||
SubmenuIndexWriteiCS,
|
||||
picopass_scene_key_menu_submenu_callback,
|
||||
picopass);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Write Elite",
|
||||
SubmenuIndexWriteCustom,
|
||||
picopass_scene_key_menu_submenu_callback,
|
||||
picopass);
|
||||
|
||||
submenu_set_selected_item(
|
||||
picopass->submenu,
|
||||
@@ -84,6 +90,12 @@ bool picopass_scene_key_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
picopass->dev->dev_data.pacs.elite_kdf = false;
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexWriteCustom) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneKeyMenu, SubmenuIndexWriteCustom);
|
||||
// Key and elite_kdf = true are both set in key_input scene
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneKeyInput);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||
|
||||
@@ -19,7 +19,7 @@ void picopass_scene_read_card_success_on_enter(void* context) {
|
||||
FuriString* csn_str = furi_string_alloc_set("CSN:");
|
||||
FuriString* credential_str = furi_string_alloc();
|
||||
FuriString* wiegand_str = furi_string_alloc();
|
||||
FuriString* sio_str = furi_string_alloc();
|
||||
FuriString* key_str = furi_string_alloc();
|
||||
|
||||
dolphin_deed(DolphinDeedNfcReadSuccess);
|
||||
|
||||
@@ -79,7 +79,7 @@ void picopass_scene_read_card_success_on_enter(void* context) {
|
||||
size_t bytesLength = 1 + pacs->record.bitLength / 8;
|
||||
furi_string_set(credential_str, "");
|
||||
for(uint8_t i = RFAL_PICOPASS_BLOCK_LEN - bytesLength; i < RFAL_PICOPASS_BLOCK_LEN; i++) {
|
||||
furi_string_cat_printf(credential_str, " %02X", pacs->credential[i]);
|
||||
furi_string_cat_printf(credential_str, "%02X", pacs->credential[i]);
|
||||
}
|
||||
|
||||
if(pacs->record.valid) {
|
||||
@@ -90,19 +90,16 @@ void picopass_scene_read_card_success_on_enter(void* context) {
|
||||
}
|
||||
|
||||
if(pacs->sio) {
|
||||
furi_string_cat_printf(sio_str, "+SIO");
|
||||
furi_string_cat_printf(credential_str, " +SIO");
|
||||
}
|
||||
|
||||
if(pacs->key) {
|
||||
if(pacs->sio) {
|
||||
furi_string_cat_printf(sio_str, " ");
|
||||
}
|
||||
furi_string_cat_printf(sio_str, "Key: ");
|
||||
furi_string_cat_printf(key_str, "Key: ");
|
||||
|
||||
uint8_t key[RFAL_PICOPASS_BLOCK_LEN];
|
||||
memcpy(key, &pacs->key, RFAL_PICOPASS_BLOCK_LEN);
|
||||
for(uint8_t i = 0; i < RFAL_PICOPASS_BLOCK_LEN; i++) {
|
||||
furi_string_cat_printf(sio_str, "%02X", key[i]);
|
||||
furi_string_cat_printf(key_str, "%02X", key[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,12 +131,12 @@ void picopass_scene_read_card_success_on_enter(void* context) {
|
||||
FontSecondary,
|
||||
furi_string_get_cstr(credential_str));
|
||||
widget_add_string_element(
|
||||
widget, 64, 46, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(sio_str));
|
||||
widget, 64, 46, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(key_str));
|
||||
|
||||
furi_string_free(csn_str);
|
||||
furi_string_free(credential_str);
|
||||
furi_string_free(wiegand_str);
|
||||
furi_string_free(sio_str);
|
||||
furi_string_free(key_str);
|
||||
|
||||
view_dispatcher_switch_to_view(picopass->view_dispatcher, PicopassViewWidget);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,9 @@ bool picopass_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == PicopassCustomEventTextInputDone) {
|
||||
// Delete old file if renaming
|
||||
if(strcmp(picopass->dev->dev_name, "") != 0) {
|
||||
// picopass_device_delete(picopass->dev, true);
|
||||
picopass_device_delete(picopass->dev, true);
|
||||
}
|
||||
strlcpy(
|
||||
picopass->dev->dev_name, picopass->text_store, strlen(picopass->text_store) + 1);
|
||||
|
||||
@@ -5,6 +5,7 @@ enum SubmenuIndex {
|
||||
SubmenuIndexInfo,
|
||||
SubmenuIndexWrite,
|
||||
SubmenuIndexEmulate,
|
||||
SubmenuIndexRename,
|
||||
};
|
||||
|
||||
void picopass_scene_saved_menu_submenu_callback(void* context, uint32_t index) {
|
||||
@@ -17,12 +18,6 @@ void picopass_scene_saved_menu_on_enter(void* context) {
|
||||
Picopass* picopass = context;
|
||||
Submenu* submenu = picopass->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Delete",
|
||||
SubmenuIndexDelete,
|
||||
picopass_scene_saved_menu_submenu_callback,
|
||||
picopass);
|
||||
submenu_add_item(
|
||||
submenu, "Info", SubmenuIndexInfo, picopass_scene_saved_menu_submenu_callback, picopass);
|
||||
submenu_add_item(
|
||||
@@ -33,6 +28,18 @@ void picopass_scene_saved_menu_on_enter(void* context) {
|
||||
SubmenuIndexEmulate,
|
||||
picopass_scene_saved_menu_submenu_callback,
|
||||
picopass);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Rename",
|
||||
SubmenuIndexRename,
|
||||
picopass_scene_saved_menu_submenu_callback,
|
||||
picopass);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Delete",
|
||||
SubmenuIndexDelete,
|
||||
picopass_scene_saved_menu_submenu_callback,
|
||||
picopass);
|
||||
|
||||
submenu_set_selected_item(
|
||||
picopass->submenu,
|
||||
@@ -61,6 +68,9 @@ bool picopass_scene_saved_menu_on_event(void* context, SceneManagerEvent event)
|
||||
} else if(event.event == SubmenuIndexEmulate) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneEmulate);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexRename) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneSaveName);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ bool picopass_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexLoclass) {
|
||||
scene_manager_set_scene_state(
|
||||
picopass->scene_manager, PicopassSceneLoclass, PicopassSceneLoclass);
|
||||
picopass->scene_manager, PicopassSceneStart, PicopassSceneLoclass);
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneLoclass);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
void picopass_write_card_worker_callback(PicopassWorkerEvent event, void* context) {
|
||||
UNUSED(event);
|
||||
Picopass* picopass = context;
|
||||
view_dispatcher_send_custom_event(picopass->view_dispatcher, PicopassCustomEventWorkerExit);
|
||||
view_dispatcher_send_custom_event(picopass->view_dispatcher, event);
|
||||
}
|
||||
|
||||
void picopass_scene_write_card_on_enter(void* context) {
|
||||
@@ -33,7 +33,10 @@ bool picopass_scene_write_card_on_event(void* context, SceneManagerEvent event)
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == PicopassCustomEventWorkerExit) {
|
||||
if(event.event == PicopassWorkerEventFail) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteCardFailure);
|
||||
consumed = true;
|
||||
} else if(event.event == PicopassWorkerEventSuccess) {
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteCardSuccess);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
65
applications/external/picopass/scenes/picopass_scene_write_card_failure.c
vendored
Normal file
65
applications/external/picopass/scenes/picopass_scene_write_card_failure.c
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "../picopass_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void picopass_scene_write_card_failure_widget_callback(
|
||||
GuiButtonType result,
|
||||
InputType type,
|
||||
void* context) {
|
||||
furi_assert(context);
|
||||
Picopass* picopass = context;
|
||||
|
||||
if(type == InputTypeShort) {
|
||||
view_dispatcher_send_custom_event(picopass->view_dispatcher, result);
|
||||
}
|
||||
}
|
||||
|
||||
void picopass_scene_write_card_failure_on_enter(void* context) {
|
||||
Picopass* picopass = context;
|
||||
Widget* widget = picopass->widget;
|
||||
FuriString* str = furi_string_alloc_set("Write Failure!");
|
||||
|
||||
widget_add_button_element(
|
||||
widget,
|
||||
GuiButtonTypeLeft,
|
||||
"Retry",
|
||||
picopass_scene_write_card_failure_widget_callback,
|
||||
picopass);
|
||||
|
||||
widget_add_button_element(
|
||||
widget,
|
||||
GuiButtonTypeRight,
|
||||
"Menu",
|
||||
picopass_scene_write_card_failure_widget_callback,
|
||||
picopass);
|
||||
|
||||
widget_add_string_element(
|
||||
widget, 64, 5, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(str));
|
||||
|
||||
furi_string_free(str);
|
||||
|
||||
view_dispatcher_switch_to_view(picopass->view_dispatcher, PicopassViewWidget);
|
||||
}
|
||||
|
||||
bool picopass_scene_write_card_failure_on_event(void* context, SceneManagerEvent event) {
|
||||
Picopass* picopass = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == GuiButtonTypeLeft) {
|
||||
consumed = scene_manager_previous_scene(picopass->scene_manager);
|
||||
} else if(event.event == GuiButtonTypeRight) {
|
||||
// Clear device name
|
||||
picopass_device_set_name(picopass->dev, "");
|
||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||
picopass->scene_manager, PicopassSceneStart);
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void picopass_scene_write_card_failure_on_exit(void* context) {
|
||||
Picopass* picopass = context;
|
||||
|
||||
// Clear view
|
||||
widget_reset(picopass->widget);
|
||||
}
|
||||
@@ -55,8 +55,8 @@ bool picopass_scene_write_card_success_on_event(void* context, SceneManagerEvent
|
||||
} else if(event.event == GuiButtonTypeRight) {
|
||||
// Clear device name
|
||||
picopass_device_set_name(picopass->dev, "");
|
||||
scene_manager_next_scene(picopass->scene_manager, PicopassSceneCardMenu);
|
||||
consumed = true;
|
||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||
picopass->scene_manager, PicopassSceneStart);
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
|
||||
Reference in New Issue
Block a user