Skip to content

Commit

Permalink
Merge pull request #2527 from douniwan5788/82xx_page
Browse files Browse the repository at this point in the history
fix: bypass some limits for 82xx
  • Loading branch information
iceman1001 authored Sep 22, 2024
2 parents 0476596 + a9cf1cc commit 5f44f23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions armsrc/hitagS.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ static struct hitagS_tag tag = {
.data.pages = {
// Plain mode: | Authentication mode:
[0] = {0x5F, 0xC2, 0x11, 0x84}, // UID | UID
// HITAG S 256
[1] = {0xC9, 0x00, 0x00, 0xAA}, // CON0 CON1 CON2 Reserved | CON0 CON1 CON2 PWDH0
// HITAG S 2048
[1] = {0xCA, 0x00, 0x00, 0xAA}, // CON0 CON1 CON2 Reserved | CON0 CON1 CON2 PWDH0
[2] = {0x48, 0x54, 0x4F, 0x4E}, // Data | PWDL0 PWDL1 KEYH0 KEYH1
[3] = {0x4D, 0x49, 0x4B, 0x52}, // Data | KEYL0 KEYL1 KEYL2 KEYL3
[4] = {0xFF, 0x80, 0x00, 0x00}, // Data
Expand Down Expand Up @@ -1338,9 +1338,7 @@ void hts_write_page(const lf_hitag_data_t *payload, bool ledcontrol) {

//check for valid input
if (payload->page == 0) {
DBG Dbprintf("Error, invalid page");
reply_ng(CMD_LF_HITAGS_WRITE, PM3_EINVARG, NULL, 0);
return;
DBG Dbprintf("Warning, write page 0");
}

uint8_t rx[HITAG_FRAME_LEN];
Expand All @@ -1358,9 +1356,8 @@ void hts_write_page(const lf_hitag_data_t *payload, bool ledcontrol) {

//check if the given page exists
if (payload->page > tag.max_page) {
DBG Dbprintf("Error, page number too large");
res = PM3_EINVARG;
goto write_end;
DBG Dbprintf("Warning, page number too large");
// 82xx CON0 is fully modifiable
}

//send write page request
Expand Down
2 changes: 1 addition & 1 deletion client/src/cmdlfhitaghts.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static int CmdLFHitagSRead(const char *Cmd) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Data") " ----------------------------------");

const int hts_mem_sizes[] = {4, 32, 256, 0};
const int hts_mem_sizes[] = {4, 32, 256, 256};
uint32_t size = hts_mem_sizes[config.memory_type];

print_hex_break(data, size, HITAGS_PAGE_SIZE);
Expand Down

0 comments on commit 5f44f23

Please sign in to comment.