Created
May 7, 2016 11:35
-
-
Save MtShadow/b539e2ba2da2c7929ca8e35b4f7645dd to your computer and use it in GitHub Desktop.
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
import nfc | |
servc = 0x100B | |
def connected(tag): | |
service_code = [nfc.tag.tt3.ServiceCode(servc >> 6, servc & 0x3f)] | |
bc_id = [nfc.tag.tt3.BlockCode(i) for i in range(3)] | |
bc_name = [nfc.tag.tt3.BlockCode(3)] | |
print tag.read_without_encryption(service_code, bc_id) # 学籍番号を含むID | |
print tag.read_without_encryption(service_code, bc_name).decode('shift-jis') # 半角カナの名前 | |
return False | |
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