diff options
-rw-r--r-- | easycard.2/notes.txt | 12 | ||||
-rw-r--r-- | easytool/easytool.c | 20 |
2 files changed, 25 insertions, 7 deletions
diff --git a/easycard.2/notes.txt b/easycard.2/notes.txt index c2e15c1..fefc5f1 100644 --- a/easycard.2/notes.txt +++ b/easycard.2/notes.txt @@ -52,16 +52,20 @@ Address 0x3e0 DATA BLOCK somehow related to shop purchasing 00003e0 0000 0000 0000 0000 0000 0b00 233d 0000 first purchase with easycard.1 (7eleven) - 0x23 == 35 -> amount of purchase + 0x0b == day of month of purchase (11th) + 0x0023 == 35 -> amount of purchase 00003e0 0000 0000 0000 0000 0000 0c00 4b3d 0000 second purchase with easycard.1 (7eleven) - 0x4b == 75 -> amount of purchase + 0x0c == day of month of purchase (12th) + 0x004b == 75 -> amount of purchase 00003e0 0000 0000 0000 0000 0000 0c00 5f3d 0000 first purchase with easycard.2 (starbucks) - 0x5f == 95 -> amount of purchase + 0x0c == day of month of purchase (12th) + 0x005f == 95 -> amount of purchase 00003e0 0000 0000 0000 0000 0000 0c00 233d 0001 second purchase with easycard.2 (cosmed) - 0x23 == 35 -> NOT amount of purchase (0xc4) + 0x0c == day of month of purchase (12th) + 0x0123 == 291 -> total of all purchases today == timestamp == diff --git a/easytool/easytool.c b/easytool/easytool.c index 62c5a0f..d6b799e 100644 --- a/easytool/easytool.c +++ b/easytool/easytool.c @@ -61,6 +61,16 @@ struct easy_block2sec0 { uint8_t unknown2[7]; } __attribute__ ((packed)); +/* Sector 2 of Block 15 */ +struct easy_block15sec2 { + uint8_t unknown[11]; + uint8_t day_of_month; + uint8_t unknown2; /* always 0x3d? */ + uint16_t sum_of_day; /* sum of all shop purchases on a day */ + uint8_t unknown3; +} __attribute__ ((packed)); + + /* storage of a transaction log record on the transponder itself */ struct easy_log_rec { uint8_t trans_id; @@ -155,10 +165,12 @@ static void dump_easycard(mifare_tag *mft) { unsigned int sect; mifare_block_manufacturer *manuf = &mft->amb[0].mbm; - struct mfcl_value_block *val = + struct mfcl_value_block *val = (struct mfcl_value_block *) mft->amb[8].mbd.abtData; - struct easy_block2sec0 *b2s0 = - (struct easy_block2sec0 *) mft->amb[4].mbd.abtData; + struct easy_block2sec0 *b2s0 = + (struct easy_block2sec0 *) mft->amb[2*4+0].mbd.abtData; + struct easy_block15sec2 *b15s2 = + (struct easy_block15sec2 *) mft->amb[15*4+2].mbd.abtData; uint32_t uid = *((uint32_t *) manuf->abtUID); /* dump the header */ @@ -166,6 +178,8 @@ static void dump_easycard(mifare_tag *mft) printf("Date of manufacture: %s\n", easy_asc_timestamp(b2s0->timestamp)); printf("Current Balance: %5u NTD\n", val->value); + printf("Sum of all purchases on day %u (of month): %u NTD\n", + b15s2->day_of_month, b15s2->sum_of_day); printf("\nTransaction Log:\n"); /* dump the transaction log */ |