Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nfc-st25b example #645

Merged
merged 5 commits into from
Jul 10, 2021
Merged

Add nfc-st25b example #645

merged 5 commits into from
Jul 10, 2021

Conversation

gentilkiwi
Copy link
Contributor

This new example allows to operate on some ISO-14443-B ST25TB* and legacy SR* cards (read, write, info)

It was tested with PN533 USB and:

  • ST25TB512-AC - (BE/Brussels/STIB ; AliExpress ones)
  • ST25TB512-AT - (FR/Lille/Ilevia ; FR/Reims/Citura)
  • SRT512 - legacy - (FR/Bordeaux/TBM)
  • SRI512 - legacy - (anonymous vending machine)

Sample outputs:

gentilkiwi@debian-01:~/Programmation/libnfc$ examples/nfc-st25tb
|mode   : info
Reader  : NXP / PN533 - via pn53x_usb:002:005
  ...wait for card...
Target  : ISO/IEC 14443-2B ST SRx (106 kbps)
UID     : b6 c0 61 a0 00 1b 02 d0
Manuf   : 0x02 - STMicroelectronics
ChipId  : 0x1b - ST25TB512-AC
Serial  : 0x00a061c0b6
|blk sz : 32 bits
|nb blks: 16
|sys idx: 255

[0x00] 7a 7f 8e 8d
[0x01] ad 40 e0 93
[0x02] bc 1e aa e0
[0x03] 09 9d 24 58
[0x04] 07 5c bd 9a
[0x05] ff 07 00 00
[0x06] 00 00 00 00
[0x07] 00 20 10 20
[0x08] 01 a4 40 01
[0x09] 00 00 77 80
[0x0a] 08 18 02 08
[0x0b] 90 b6 b0 82
[0x0c] 11 d5 f4 d8
[0x0d] 18 10 02 11
[0x0e] 90 b4 42 42
[0x0f] 12 cb 9e 6f
[0xff] ff 7f 61 fc
  | ST reserved  : 111111111111111
  | b15          : 0 - OTP (?)
  | OTP_Lock_Reg : 1000011000111111
     block 0x01 is write protected
     block 0x02 is write protected
     block 0x03 is write protected
     block 0x04 is write protected
     block 0x07 is write protected
     block 0x08 is write protected
     block 0x09 is write protected
gentilkiwi@debian-01:~/Programmation/libnfc$ examples/nfc-st25tb -b 0x0f -r -w cafebabe
|mode   : read then write
|blk num: 0x0f
|data   : ca fe ba be
Reader  : NXP / PN533 - via pn53x_usb:002:005
  ...wait for card...
Target  : ISO/IEC 14443-2B ST SRx (106 kbps)
UID     : f6 77 f0 8a 68 33 02 d0
Manuf   : 0x02 - STMicroelectronics
ChipId  : 0x33 - ST25TB512-AT
Serial  : 0x688af077f6
|blk sz : 32 bits
|nb blks: 16
|sys idx: 255

[0x0f] 92 2e 21 0c
>0x0f> ca fe ba be
[0x0f] ca fe ba be

Help:

Usage:
  nfc-st25tb [-i]
  nfc-st25tb -b N -r
  nfc-st25tb -b N [-r] -w ABCD[EF01]
  nfc-st25tb -h
Options:
  -i               (default) information mode - will try to dump the tag content and display informations
  -b N             specify block number to operate on (tag dependent), needed for read (-r) and write (-w) modes
  -r               read mode - will try to read block (specified with -b N parameter)
  -w ABCD[EF01]    write mode - will try to write specicied data (2 or 4 bytes depending on tag) to block (specified with -b N parameter)
  -h               this help
Examples:
  nfc-st25tb -i
        Display all tag informations
  nfc-st25tb -b 0x0e -r
        Read block 0x0e (14) of the tag
  nfc-st25tb -b 0x0d -w 0123abcd
        Write block 0x0d (13) of the tag with hexadecimal value '01 23 ab cd'
  nfc-st25tb -b 0x0c -r -w 0123abcd
        Read, then write block 0x0c (12) of the tag with hexadecimal value '01 23 ab cd'
Warnings:
  Be careful with: system area, counters & otp, bytes order.

@doegox doegox merged commit fb290be into nfc-tools:master Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants