Skip to content

Commit

Permalink
Picopass: check if HID CSN if read fails (#61)
Browse files Browse the repository at this point in the history
Co-authored-by: あく <alleteam@gmail.com>
  • Loading branch information
bettse and skotopes committed Oct 16, 2023
1 parent 242578c commit 692dc97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions picopass_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,13 @@ ReturnCode picopass_device_parse_wiegand(uint8_t* credential, PicopassPacs* pacs

return ERR_NONE;
}

bool picopass_device_hid_csn(PicopassDevice* dev) {
furi_assert(dev);
PicopassBlock* AA1 = dev->dev_data.AA1;
uint8_t* csn = AA1[PICOPASS_CSN_BLOCK_INDEX].data;
// From Proxmark3 RRG sourcecode
bool isHidRange = (memcmp(csn + 5, "\xFF\x12\xE0", 3) == 0) && ((csn[4] & 0xF0) == 0xF0);

return isHidRange;
}
1 change: 1 addition & 0 deletions picopass_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,4 @@ void picopass_device_set_loading_callback(

ReturnCode picopass_device_parse_credential(PicopassBlock* AA1, PicopassPacs* pacs);
ReturnCode picopass_device_parse_wiegand(uint8_t* credential, PicopassPacs* pacs);
bool picopass_device_hid_csn(PicopassDevice* dev);
3 changes: 3 additions & 0 deletions scenes/picopass_scene_read_card_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ void picopass_scene_read_card_success_on_enter(void* context) {

if(no_key) {
furi_string_cat_printf(wiegand_str, "Read Failed");
bool hid_csn = picopass_device_hid_csn(picopass->dev);

if(pacs->se_enabled) {
furi_string_cat_printf(credential_str, "SE enabled");
} else if(!hid_csn) {
furi_string_cat_printf(credential_str, "Non-HID CSN");
}

widget_add_button_element(
Expand Down

0 comments on commit 692dc97

Please sign in to comment.