Skip to content

Comments

Implement T-Money balance parsing#77

Merged
luu176 merged 6 commits intoluu176:devfrom
justuswilhelm:t-money
Nov 16, 2025
Merged

Implement T-Money balance parsing#77
luu176 merged 6 commits intoluu176:devfrom
justuswilhelm:t-money

Conversation

@justuswilhelm
Copy link
Contributor

I've written a small plugin for Metroflip that lets you read the balance off a T-Money card. I've tested it with my T-Money card bought in 2018 in Seoul, Korea.

I wasn't sure whether adding my code to metroflip_scene_detect_scan_callback is a good pattern. Metroflip might recognize other cards as T-Money that support the same Iso14443_4a protocol. Let me know if there's a better way.

The ISO7816 and KSX6924 reading mechanism is inspired by metrodroid.

luu176 and others added 2 commits September 14, 2025 16:47
This copies the structure from calypso.c, mostly
The ISO7816 and KSX6924 reading mechanism is inspired by metrodroid
@luu176
Copy link
Owner

luu176 commented Sep 28, 2025

Hi @justuswilhelm,

Thanks for your contribution! Wondering how we're going to implement this as mifare classic runs on that same protocol, it would probablt be best to check iso 14a at the very bottom of the else if loop. to make sure no other cards detect as T-Money. It would also be good for you to find something unique about T-Money cards, so if someone scans a regular 14a card that isn;t supported it also doesnt get detected as T-Money.

@luu176 luu176 changed the base branch from main to dev September 28, 2025 13:07
@justuswilhelm
Copy link
Contributor Author

Thank you for your feedback. I'll take a look at this and find out if there's a way I can use the Mifare part for this somehow. I'll get back some time this month, so please wait.

@justuswilhelm
Copy link
Contributor Author

Hi @justuswilhelm,

Thanks for your contribution! Wondering how we're going to implement this as mifare classic runs on that same protocol, it would probablt be best to check iso 14a at the very bottom of the else if loop. to make sure no other cards detect as T-Money. It would also be good for you to find something unique about T-Money cards, so if someone scans a regular 14a card that isn;t supported it also doesnt get detected as T-Money.

Hi, I haven't had time to look into this further this month, unfortunately. For the first solution, putting the check at the bottom, I can implement this. On the other hand, to check "unique" properties of the T-Money card would possibly require creating a Poller instance during the general card detection loop.

Do you have any suggestions for how to implement this?

@luu176
Copy link
Owner

luu176 commented Nov 2, 2025

Hi, I am currently working on a detection scheme for knowing what type of card it is based on the ATR (Answer To Reset). This value is unique to each public transport, so if you can find the ATR for T-Money or maybe I can ask around, and then I will implement.

@luu176
Copy link
Owner

luu176 commented Nov 2, 2025

I found this ATR:

3B 88 80 01 04 02 00 20 00 71 C1 40 DF

can you verify the bytes in that payload that DO match the ATR in your card please?

@luu176
Copy link
Owner

luu176 commented Nov 2, 2025

Can you read the card in the main nfc application in flipper and go to more>Info then scroll all the way down to historical bytes and it write that in here

@justuswilhelm
Copy link
Contributor Author

Here's everything from the Flipper Zero dump in the .nfc file:

Filetype: Flipper NFC device
Version: 4
# Device type can be ISO14443-3A, ISO14443-3B, ISO14443-4A, ISO14443-4B, ISO15693-3, FeliCa, NTAG/Ultralight, Mifare Classic, Mifare Plus, Mifare DESFire, SLIX, ST25TB, NTAG4xx, Type 4 Tag, EMV
Device type: ISO14443-4A
# UID is common for all formats
UID: XX XX XX XX
# ISO14443-3A specific data
ATQA: 00 04
SAK: 20
# ISO14443-4A specific data
T0: 78
TA(1): 80
TB(1): B0
TC(1): 02
T1...Tk: 04 09 22 02

@luu176
Copy link
Owner

luu176 commented Nov 7, 2025

thanks, i've added your ATR, then I will fix your PR and merge

Removed two_cities_verify and renfe_regular_verify functions, updated key values for troika_4k_key and renfe_suma10_1k_keys.
@luu176 luu176 merged commit c01ff3a into luu176:dev Nov 16, 2025
1 check passed
@justuswilhelm
Copy link
Contributor Author

Thank you!

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