写给Mifare部门NFC RFIDIOT Python

时间:2015-03-20 23:53:47

标签: python nfc mifare

我正在尝试在Mifare 4k经典卡上的第10区/第40区写一个数字

关于如何让这个工作的任何想法?

这是我的代码:

BLOCK = 40
KEY = 'FFFFFFFFFFFF'
TYPE = 'AA'

import rfidiot
import re

card = rfidiot.card
if card.select():
    'card selected UID: ' + str(card.uid)
    if card.login(BLOCK, TYPE, KEY):
        if card.readMIFAREblock(BLOCK):
            print card.MIFAREdata
            data = card.ReadablePrint(card.ToBinary(card.MIFAREdata))
            id = re.findall('\d+', data)[0]
            print id

            if card.writeblock(BLOCK, '1234567'):
                print 'write success'
            else:
                 print 'error %s %s' % (card.errorcode , card.ISO7816ErrorCodes[card.errorcode])
        else:
            print 'read failed'
    else:
        print 'Login failed'

输出+错误消息:

card selected UID: DBF93873
33333735353334000000000000000000
3375534
error 6300 No information given

0 个答案:

没有答案