4ZM / mfterm

Terminal for working with Mifare Classic 1-4k Tags
GNU General Public License v3.0
149 stars 36 forks source link

'mac validate' - Validate the MAC of a whole tag block by block #26

Closed grodanboll closed 11 years ago

grodanboll commented 11 years ago

I've added a 'mac validate' command which is used to validate a MAC of a whole tag block by block. I often had to check the MAC of a whole tag and running 'mac compute' and manually comparing was just to time consuming for me.

Example output with a Mifare Classic 1k dump:

$ load dumps/testtag.mfd 
Successfully loaded tag from: dumps/testtag.mfd
$ mac key 12 34 56 78 90 AB CD EF
$ mac validate
Block:  1 Tag: b9 6e  Computed: b9 6e  Result: VALID
Block:  2 Tag: e5 5b  Computed: e5 5b  Result: VALID
Block:  4 Tag: 57 86  Computed: 57 86  Result: VALID
Block:  5 Tag: 14 c3  Computed: 14 c3  Result: VALID
Block:  6 Tag: e5 5b  Computed: e5 5b  Result: VALID
Block:  8 Tag: 13 6a  Computed: 13 6a  Result: VALID
Block:  9 Tag: 13 6a  Computed: 13 6a  Result: VALID
Block:  a Tag: 00 00  Computed: e5 5b  Result: IN-VALID
Block:  c Tag: 01 5a  Computed: 19 e3  Result: IN-VALID
Block:  d Tag: 00 df  Computed: 50 9c  Result: IN-VALID
Block:  e Tag: 00 01  Computed: 02 bf  Result: IN-VALID
Block: 10 Tag: 3d 47  Computed: 3d 47  Result: VALID
Block: 11 Tag: 00 19  Computed: 11 ef  Result: IN-VALID
Block: 12 Tag: 01 6a  Computed: dc 6c  Result: IN-VALID
Block: 14 Tag: 25 46  Computed: ec 2d  Result: IN-VALID
Block: 15 Tag: 00 00  Computed: cc e3  Result: IN-VALID
Block: 16 Tag: 01 00  Computed: 75 60  Result: IN-VALID
Block: 18 Tag: 0f 93  Computed: e9 1b  Result: IN-VALID
Block: 19 Tag: 01 00  Computed: a0 ce  Result: IN-VALID
Block: 1a Tag: 6a 4e  Computed: 3a 05  Result: IN-VALID
Block: 1c Tag: 25 46  Computed: 15 4c  Result: IN-VALID
Block: 1d Tag: 00 00  Computed: cc e3  Result: IN-VALID
Block: 1e Tag: 01 00  Computed: f9 56  Result: IN-VALID
Block: 20 Tag: 6a 5c  Computed: 2b 0b  Result: IN-VALID
Block: 21 Tag: 00 00  Computed: e5 5b  Result: IN-VALID
*snip*
Block: 3e Tag: 00 00  Computed: e5 5b  Result: IN-VALID
$ 
4ZM commented 11 years ago

Merged with some minor style changes to match surrounding code.

Thanks!