connect smartcard and defines class CLA code for communication uses "pyscard" library services ''' print "Checking ATR Value" iso = ISO7816() iso.ATR_scan() print "List Card Information" u = USIM() imsi = u.get_imsi() acc = u.get_acc() spdi = u.get_spdi() spdi2 = u.get_spdi_readBinary() iccid = u.get_ICCID() plmnsel = u.get_plmnsel() fplmn = u.get_fplmn() print " " print "------------------------------------" print "------------- Results --------------" print "------------------------------------" print "IMSI: " + imsi print "ACCs: ", acc print "SPDI: ", spdi print "SPDI Read Binary response: ", spdi2 print "ICCID: " + iccid print "PLMNSel", plmnsel print "FPLMNs", fplmn
uicc.SELECT_FILE(0, 4, [0x3F, 0x00]) uicc.SELECT_FILE(0, 4, [0x7F, 0x20]) uicc.SELECT_FILE(0, 4, [0x6F, 0x30]) print ('PLMNsel EF File selected.') # go to PLMNsel address and update binary string for HPLMN ret = uicc.UPDATE_BINARY(0, 0, PLMNsel) print('Writing PLMN selector: %s' % ret) if __name__ == '__main__': print 'INET USIM card update PLMNsel with value: ' u = USIM() imsi = u.get_imsi() print '====>> IMSI: ' + imsi plmnsel_before = u.get_plmnsel() print '====>> Current PLMNsel: ' , plmnsel_before program_files(u) plmnsel_after = u.get_plmnsel() print '====>> Modified PLMNsel: ' , plmnsel_after u.disconnect() print 'INET USIM card PLMNsel update completed'