Created
July 23, 2016 05:23
-
-
Save shotarok/fed595781b55330e3137b5b5b072cf91 to your computer and use it in GitHub Desktop.
A test code to extract ID from SUICA/PASMO through nfcpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding:utf-8 | |
from __future__ import print_function | |
from binascii import hexlify | |
import sys | |
import nfc | |
def connected(tag): | |
if isinstance(tag, nfc.tag.tt3.Type3Tag): | |
try: | |
print("Your IDm is {}".format(hexlify(tag.idm).upper())) | |
except Exception as e: | |
print("error: {}".format(e)) | |
else: | |
print("error: tag isn't Type3Tag") | |
if __name__ == "__main__": | |
print("Please put your card on the nfc reader. Waiting...") | |
sys.stdout.flush() | |
clf = nfc.ContactlessFrontend('usb') | |
clf.connect(rdwr={'on-connect': connected}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment