Skip to content

Commit

Permalink
Squashed 'applications/external/' changes from 68b1a9af7c..e242113f55
Browse files Browse the repository at this point in the history
e242113f55 Add seader/plugin from https://gitlab.com/bettse/flipper-wiegand-plugin
f83a18aab9 Merge seader from https://github.com/bettse/seader
1c9883d64f Merge picopass from https://github.com/flipperdevices/flipperzero-good-faps
57598dfd83 Merge flizzer_tracker from https://github.com/LTVA1/flizzer_tracker
47ee8e55e9 Picopass cleanup (#201)
b702c44 Update application.fam
e96cfa1 trigger envelope release on xx tick...
6369a1f Update screenshots
d34730f move pxd to media
f4821fd show parse for saved cards
32cae43 Move delete below info in list
dbb9efe Update plugin
30d5c440e6 Correct H10301 parity check
4688e5f v2.7
123141a Merge pull request #16 from bettse/plugin
877cf03 Change submodule to http
c2dc739575 Update readme
124549c Add submodule to git workflow checkout
aaf3e22 Move plugin to git submodule
4353973354 Add code
0dcc0d1cf9 add README
0cb6383 Move plugin to folder
4aeb5f4 add C1k35s
f907489 H10301 parsing
f736e8d fix plugin check
93cd7ea scene to show parsed formats
8b3fb58 Add textbox
0802b59 loads plugin
6bbd7d5 Builds
7ac58d7 re #15 create picopass folder
57aba91 log incoming apdu

git-subtree-dir: applications/external
git-subtree-split: e242113f5503569206db6a75b21ece2fa50e5919
  • Loading branch information
RogueMaster committed Apr 22, 2024
1 parent 2bcadee commit aee2212
Show file tree
Hide file tree
Showing 25 changed files with 406 additions and 88 deletions.
2 changes: 1 addition & 1 deletion flizzer_tracker/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ App(
cdefines=["APP_FLIZZER_TRACKER"],
stack_size=2 * 1024,
order=90,
fap_version=(0, 8),
fap_version=(0, 9),
fap_description="An advanced Flipper Zero chiptune tracker with 4 channels",
fap_author="LTVA",
fap_weburl="https://github.com/LTVA1/flizzer_tracker",
Expand Down
4 changes: 3 additions & 1 deletion flizzer_tracker/tracker_engine/do_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ void do_command(
}

case TE_EFFECT_TRIGGER_RELEASE: {
sound_engine_enable_gate(tracker_engine->sound_engine, se_channel, 0);
if(tick == (opcode & 0xff)) {
sound_engine_enable_gate(tracker_engine->sound_engine, se_channel, 0);
}

break;
}
Expand Down
15 changes: 8 additions & 7 deletions picopass/scenes/picopass_scene_card_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ void picopass_scene_card_menu_on_enter(void* context) {
Submenu* submenu = picopass->submenu;
PicopassPacs* pacs = &picopass->dev->dev_data.pacs;
PicopassBlock* card_data = picopass->dev->dev_data.card_data;
PicopassDeviceAuthMethod auth = picopass->dev->dev_data.auth;

bool sio = 0x30 == card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data[0];
bool SE = card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].valid &&
0x30 == card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data[0];
bool SR = card_data[10].valid && 0x30 == card_data[10].data[0];
bool has_sio = SE || SR;
bool secured = (card_data[PICOPASS_CONFIG_BLOCK_INDEX].data[7] & PICOPASS_FUSE_CRYPT10) !=
PICOPASS_FUSE_CRYPT0;
bool zero_config = picopass_is_memset(
card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data, 0x00, PICOPASS_BLOCK_LEN);
bool no_credential = picopass_is_memset(pacs->credential, 0x00, sizeof(pacs->credential));
bool no_key = !card_data[PICOPASS_SECURE_KD_BLOCK_INDEX].valid;

if(secured && zero_config) {
if(auth == PicopassDeviceAuthMethodFailed) {
submenu_add_item(
submenu,
"Save Partial",
Expand All @@ -42,7 +43,7 @@ void picopass_scene_card_menu_on_enter(void* context) {
submenu, "Save", SubmenuIndexSave, picopass_scene_card_menu_submenu_callback, picopass);
}

if(secured && (sio || pacs->sio)) {
if(secured && has_sio) {
submenu_add_item(
submenu,
"Save in Seader fmt",
Expand All @@ -60,7 +61,7 @@ void picopass_scene_card_menu_on_enter(void* context) {
picopass);
}

if(!zero_config && !no_key) {
if(auth == PicopassDeviceAuthMethodNone || auth == PicopassDeviceAuthMethodKey) {
submenu_add_item(
submenu,
"Write",
Expand Down
2 changes: 1 addition & 1 deletion picopass/scenes/picopass_scene_more_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ void picopass_scene_more_info_on_exit(void* context) {
Picopass* picopass = context;

// Clear views
widget_reset(picopass->widget);
text_box_reset(picopass->text_box);
}
121 changes: 52 additions & 69 deletions picopass/scenes/picopass_scene_read_card_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,18 @@ void picopass_scene_read_card_success_widget_callback(

void picopass_scene_read_card_success_on_enter(void* context) {
Picopass* picopass = context;
PicopassDeviceAuthMethod auth = picopass->dev->dev_data.auth;

FuriString* csn_str = furi_string_alloc_set("CSN:");
FuriString* credential_str = furi_string_alloc();
FuriString* wiegand_str = furi_string_alloc();
FuriString* info_str = furi_string_alloc();
FuriString* key_str = furi_string_alloc();

dolphin_deed(DolphinDeedNfcReadSuccess);

// Send notification
notification_message(picopass->notifications, &sequence_success);

// For initial testing, print auth method
switch(picopass->dev->dev_data.auth) {
case PicopassDeviceAuthMethodUnset:
FURI_LOG_D(TAG, "Auth: Unset");
break;
case PicopassDeviceAuthMethodNone:
FURI_LOG_D(TAG, "Auth: None");
break;
case PicopassDeviceAuthMethodKey:
FURI_LOG_D(TAG, "Auth: Key");
break;
case PicopassDeviceAuthMethodNrMac:
FURI_LOG_D(TAG, "Auth: NR-MAC");
break;
case PicopassDeviceAuthMethodFailed:
FURI_LOG_D(TAG, "Auth: Failed");
break;
default:
FURI_LOG_D(TAG, "Auth: Unknown");
break;
};

// Setup view
PicopassBlock* card_data = picopass->dev->dev_data.card_data;
PicopassPacs* pacs = &picopass->dev->dev_data.pacs;
Expand All @@ -62,19 +41,16 @@ void picopass_scene_read_card_success_on_enter(void* context) {
furi_string_cat_printf(csn_str, "%02X", csn[i]);
}

// We can't test the pacs->key in case it is intentionally all 0's and we can't test the key block since it is populated with the diversified key before each key test, so we approximate with the PACS config block being blank.
bool zero_config = picopass_is_memset(
card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data, 0x00, PICOPASS_BLOCK_LEN);
bool empty = picopass_is_memset(
card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data, 0xFF, PICOPASS_BLOCK_LEN);
bool SE = 0x30 == card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data[0];
bool SE = pacs->se_enabled;
bool configCard = (card_data[PICOPASS_ICLASS_PACS_CFG_BLOCK_INDEX].data[7] >> 2 & 3) == 2;
bool secured = (card_data[PICOPASS_CONFIG_BLOCK_INDEX].data[7] & PICOPASS_FUSE_CRYPT10) !=
PICOPASS_FUSE_CRYPT0;
bool hid_csn = picopass_device_hid_csn(picopass->dev);

if(!secured) {
furi_string_cat_printf(wiegand_str, "Non-Secured Chip");
furi_string_cat_printf(info_str, "Non-Secured Chip");

if(!hid_csn) {
furi_string_cat_printf(credential_str, "Non-HID CSN");
Expand All @@ -86,8 +62,8 @@ void picopass_scene_read_card_success_on_enter(void* context) {
"More",
picopass_scene_read_card_success_widget_callback,
picopass);
} else if(zero_config) {
furi_string_cat_printf(wiegand_str, "Read Failed");
} else if(auth == PicopassDeviceAuthMethodFailed) {
furi_string_cat_printf(info_str, "Read Failed");

if(pacs->se_enabled) {
furi_string_cat_printf(credential_str, "SE enabled");
Expand All @@ -109,17 +85,19 @@ void picopass_scene_read_card_success_on_enter(void* context) {
picopass);
} else if(pacs->se_enabled) {
furi_string_cat_printf(credential_str, "SE enabled");
furi_string_cat_printf(wiegand_str, "SIO");
furi_string_cat_printf(info_str, "SIO");

widget_add_button_element(
widget,
GuiButtonTypeRight,
"More",
picopass_scene_read_card_success_widget_callback,
picopass);
} else if(configCard) {
furi_string_cat_printf(wiegand_str, "Config Card");
furi_string_cat_printf(credential_str, "Config Card");
} else if(empty) {
furi_string_cat_printf(wiegand_str, "Empty");
furi_string_cat_printf(credential_str, "Empty");

widget_add_button_element(
widget,
GuiButtonTypeCenter,
Expand All @@ -129,10 +107,11 @@ void picopass_scene_read_card_success_on_enter(void* context) {
} else if(pacs->bitLength == 0 || pacs->bitLength == 255) {
// Neither of these are valid. Indicates the block was all 0x00 or all 0xff
if(SE) {
furi_string_cat_printf(wiegand_str, "SIO");
furi_string_cat_printf(info_str, "SIO");
} else {
furi_string_cat_printf(wiegand_str, "Invalid PACS");
furi_string_cat_printf(info_str, "Invalid PACS");
}

widget_add_button_element(
widget,
GuiButtonTypeCenter,
Expand All @@ -148,40 +127,13 @@ void picopass_scene_read_card_success_on_enter(void* context) {
} else {
size_t bytesLength = 1 + pacs->bitLength / 8;
furi_string_set(credential_str, "");
furi_string_cat_printf(credential_str, "(%d) ", pacs->bitLength);
for(uint8_t i = PICOPASS_BLOCK_LEN - bytesLength; i < PICOPASS_BLOCK_LEN; i++) {
furi_string_cat_printf(credential_str, "%02X", pacs->credential[i]);
}
furi_string_cat_printf(wiegand_str, "%d bits", pacs->bitLength);

if(pacs->sio) {
furi_string_cat_printf(credential_str, " +SIO");
}

bool no_key = !card_data[PICOPASS_SECURE_KD_BLOCK_INDEX].valid;

if(no_key) {
furi_string_cat_printf(key_str, "No Key: used NR-MAC");
} else {
furi_string_cat_printf(key_str, "Key: ");
uint8_t key[PICOPASS_BLOCK_LEN];
memcpy(key, &pacs->key, PICOPASS_BLOCK_LEN);

bool standard_key = true;
// Handle DES key being 56bits with parity in LSB
for(uint8_t i = 0; i < PICOPASS_BLOCK_LEN; i++) {
if((key[i] & 0xFE) != (picopass_iclass_key[i] & 0xFE)) {
standard_key = false;
break;
}
}

if(standard_key) {
furi_string_cat_printf(key_str, "Standard");
} else {
for(uint8_t i = 0; i < PICOPASS_BLOCK_LEN; i++) {
furi_string_cat_printf(key_str, "%02X", key[i]);
}
}
furi_string_cat_printf(info_str, " +SIO");
}

widget_add_button_element(
Expand All @@ -192,6 +144,37 @@ void picopass_scene_read_card_success_on_enter(void* context) {
picopass);
}

if(auth == PicopassDeviceAuthMethodUnset) {
furi_string_cat_printf(key_str, "Error: Auth Unset");
} else if(auth == PicopassDeviceAuthMethodNone) {
furi_string_cat_printf(key_str, "Unsecure card");
} else if(auth == PicopassDeviceAuthMethodNrMac) {
furi_string_cat_printf(key_str, "No Key: used NR-MAC");
} else if(auth == PicopassDeviceAuthMethodFailed) {
furi_string_cat_printf(key_str, "Auth Failed");
} else if(auth == PicopassDeviceAuthMethodKey) {
furi_string_cat_printf(key_str, "Key: ");
uint8_t key[PICOPASS_BLOCK_LEN];
memcpy(key, &pacs->key, PICOPASS_BLOCK_LEN);

bool standard_key = true;
// Handle DES key being 56bits with parity in LSB
for(uint8_t i = 0; i < PICOPASS_BLOCK_LEN; i++) {
if((key[i] & 0xFE) != (picopass_iclass_key[i] & 0xFE)) {
standard_key = false;
break;
}
}

if(standard_key) {
furi_string_cat_printf(key_str, "Standard");
} else {
for(uint8_t i = 0; i < PICOPASS_BLOCK_LEN; i++) {
furi_string_cat_printf(key_str, "%02X", key[i]);
}
}
}

widget_add_button_element(
widget,
GuiButtonTypeLeft,
Expand All @@ -201,22 +184,22 @@ void picopass_scene_read_card_success_on_enter(void* context) {

widget_add_string_element(
widget, 64, 5, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(csn_str));
widget_add_string_element(
widget, 64, 20, AlignCenter, AlignCenter, FontPrimary, furi_string_get_cstr(wiegand_str));
widget_add_string_element(
widget,
64,
36,
20,
AlignCenter,
AlignCenter,
FontSecondary,
FontPrimary,
furi_string_get_cstr(credential_str));
widget_add_string_element(
widget, 64, 36, AlignCenter, AlignCenter, FontSecondary, furi_string_get_cstr(info_str));
widget_add_string_element(
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(info_str);
furi_string_free(key_str);

view_dispatcher_switch_to_view(picopass->view_dispatcher, PicopassViewWidget);
Expand Down
4 changes: 4 additions & 0 deletions picopass/scenes/picopass_scene_read_factory_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ bool picopass_scene_read_factory_success_on_event(void* context, SceneManagerEve
scene_manager_next_scene(picopass->scene_manager, PicopassSceneWriteKey);
consumed = true;
}
} else if(event.type == SceneManagerEventTypeBack) {
scene_manager_search_and_switch_to_previous_scene(
picopass->scene_manager, PicopassSceneStart);
consumed = true;
}
return consumed;
}
Expand Down
Binary file modified seader/.flipcorg/gallery/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified seader/.flipcorg/gallery/pacs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified seader/.flipcorg/gallery/save_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions seader/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Build with ufbt
uses: flipperdevices/flipperzero-ufbt-action@v0.1.2
id: build-app
Expand Down
11 changes: 10 additions & 1 deletion seader/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ App(
sources=[
"*.c",
"aeabi_uldivmod.sx",
"!plugin/*.c",
],
fap_icon="icons/logo.png",
fap_category="NFC",
fap_version="2.6",
fap_version="2.7",
fap_author="bettse",
# fap_extbuild=(
# ExtFile(
Expand All @@ -41,3 +42,11 @@ App(
fap_weburl="https://seader.ericbetts.dev",
fap_icon_assets="icons",
)

App(
appid="plugin_wiegand",
apptype=FlipperAppType.PLUGIN,
entry_point="plugin_wiegand_ep",
requires=["seader"],
sources=["plugin/wiegand.c"],
)
File renamed without changes.
1 change: 1 addition & 0 deletions seader/plugin/.gitsubtree
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://gitlab.com/bettse/flipper-wiegand-plugin main /
14 changes: 14 additions & 0 deletions seader/plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Flipper zero wiegand plugin

Add as git submodule: `git submodule add https://gitlab.com/bettse/flipper-wiegand-plugin.git plugin`

Add to your `application.fam`
```
App(
appid="plugin_wiegand",
apptype=FlipperAppType.PLUGIN,
entry_point="plugin_wiegand_ep",
requires=["seader"],
sources=["plugin/wiegand.c"],
)
```
20 changes: 20 additions & 0 deletions seader/plugin/interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @file plugin_interface.h
* @brief Example plugin interface.
*
* Common interface between a plugin and host application
*/
#pragma once

#include <stdint.h>
#include <stddef.h>
#include <furi.h>

#define PLUGIN_APP_ID "plugin_wiegand"
#define PLUGIN_API_VERSION 1

typedef struct {
const char* name;
int (*count)(uint8_t, uint64_t);
void (*description)(uint8_t, uint64_t, size_t, FuriString*);
} PluginWiegand;
Loading

0 comments on commit aee2212

Please sign in to comment.