This project is direct python-wrapper of the lib "libpcsclite.so". It allows to use card-reader which connected throught USB and send/receive APDU data to communicate with smart-cards based on ISO7816.
The capabilities:
- get and analyze ATR
- transmit APDU
- get attributs of smart-card
- smart-card
- ISO7816
- PC/SC
- $sudo apt install pcsc-tools
- $sudo apt install pcscd
- $pcscd
Example:
// connect card-reader to PC
// insert smart-card to card-reader
import iso7816
my_card = iso7816.Iso7816()
reader = my_card.get_readers() # get avaible readres
my_card.connect(reader[0]) # connect to the first reader
print my_card.get_atr() # get ATR (Answer To Reset)
rx, sw1, sw2 = my_card.transmit('80 90 1B 13') # send data '80 90 1B 13' to smart-card and get answer
or
rx, sw1, sw2 = my_card.transmit([0x80, 0x90, 0x1B, 0x13]) # send data [0x80, 0x90, 0x1B, 0x13] to smart-card and get answer
run scgui.py