Created by
Zhiwei Li
|
from smartcard.System import readers
from smartcard.util import toHexString
r = readers()
print(r)
connection = r[0].createConnection()
connection.connect()
print(toHexString( connection.getATR() ))
SELECT = [0x00, 0xA4, 0x00, 0x00, 0x02]
DF_TELECOM = [0x7F, 0xF0]
data, sw1, sw2 = connection.transmit( SELECT + DF_TELECOM )
print ("%02x %02x" % (sw1, sw2))
print("===============")
SELECT = [0x00, 0xA4, 0x08, 0x00, 0x04, 0x7F, 0xF0]
for i in range(0x100):
for j in range(0x100):
x = [i, j]
data, sw1, sw2 = connection.transmit( SELECT + x )
if sw1 == 0x90:
print('%02X %02X' % (i, j))
elif sw1 == 0x6A and sw2 == 0x82:
pass
else:
print ("%02x %02x" % (sw1, sw2))
|