Commit 5f2ec6ed authored by Jakob Moser's avatar Jakob Moser
Browse files

Merge branch 'docs/investigate-nfc' into 'master'

Investigate NFC some more

See merge request moser/poolpay!12
parents 5653fdc3 9c8d8aff
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ class Pirc522CardReader(CardReader):
        r = self._reader.select_tag(anticoll_uid)
        print(r)

        self._reader.card_auth(self._reader.auth_a, 10, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], uid)
        self._reader.card_auth(
            self._reader.auth_a, 10, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], uid
        )
        print("Reading block 10: " + str(self._reader.read(10)))

    def on_card_presented(self, handle_card: Callable[[CardReader], None]) -> None:
+27 −0
Original line number Diff line number Diff line
@@ -12,3 +12,30 @@ Execute the following lines in the base repository directory:
source venv/bin/activate
python3 -m poolpay.card id
```

## Investigations

We want to extract the following data:

* 7 byte UID of the card (see MF0ICU1 data sheet, section 1.2.1)
* Complete user Read/Write area

As a reference we use the NXP TagInfo smartphone app. We want to extract everything in the “Full Scan” → “Memory Content” section.

To do so, we test various Python libraries, as well as our own implementation. The following represents our current state of investigation, which might change in the future.

### `Mfrc522CardReader`

❌ Cannot extract complete UID.\
❌ Cannot extract any data from Read/Write area.

### `Pirc522CardReader`

✅ Can extract complete UID.\
❌ Cannot extract any data from Read/Write area.

## Further reading

1. Data sheet: [MFRC522 (Standard performance MIFARE and NTAG frontend)](https://www.nxp.com/docs/en/data-sheet/MFRC522.pdf)
2. Data sheet: [MF0ICU1 (MIFARE Ultralight contactless single-ticket IC)](https://www.nxp.com/docs/en/data-sheet/MF0ICU1.pdf)
3. App: [NFC TagInfo](https://www.nxp.com/design/design-center/software/rfid-developer-resources/the-nfc-taginfo-app-by-nxp:NFC-TAGINFO)
+4 −1
Original line number Diff line number Diff line
import argparse
import logging

from poolpay.card.CardReader import CardReader
from poolpay.card.Mfrc522CardReader import Mfrc522CardReader
@@ -45,7 +46,9 @@ def parse_args() -> argparse.Namespace:
args = parse_args()

# Retrieve the requested reader class from the dictionary and create an instance
reader = READERS[args.using]()
ReaderClass = READERS[args.using]
logging.info(f"Using reader '{args.using}' (class: '{ReaderClass.__name__}')")
reader = ReaderClass()

# Call the selected action
ACTIONS[args.action](reader)