From 9fa8e47b4c4e9cc4dd7dcb1f71b2a5561522bc95 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 7 Nov 2019 14:44:57 +0100 Subject: [PATCH] sysmo-usimsjs1.py: refactor functions into class The module sysmo-usimsjs1.py contains a lot of functions that could also be methods of a class. Lets refactor those functions into class. This is also an intermediate step towords support for different card models in the future. Related: SYS#4466 Change-Id: I2230f50b9d3c85a0d23b29ba5ed0af2471d22e8c --- sysmo-usim-tool.sjs1.py | 86 ++--- sysmo_usimsjs1.py | 649 ++++++++++++++++++++------------------ tests/01_auth.out | 6 +- tests/02_mode_read.out | 6 +- tests/03_mode_write.out | 28 +- tests/04_algo.out | 306 +++++++----------- tests/05_milenage_par.out | 24 +- tests/06_op_opc.out | 34 +- tests/07_ki.out | 30 +- tests/08_seq.out | 16 +- tests/09_mnclen.out | 42 +-- 11 files changed, 550 insertions(+), 677 deletions(-) diff --git a/sysmo-usim-tool.sjs1.py b/sysmo-usim-tool.sjs1.py index 9c0a2fa..d0819e6 100755 --- a/sysmo-usim-tool.sjs1.py +++ b/sysmo-usim-tool.sjs1.py @@ -155,112 +155,64 @@ def main(argv): # Claim terminal - print "Initializing smartcard terminal..." - sim = Simcard(GSM_USIM, toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5")) - print("") - - print "Detected Card ICCID: ", sim.card.get_ICCID() - print "" + sim = Sysmo_usimsjs1() # Authenticate - print "Authenticating..." - if sysmo_usim_admin_auth(sim, getopt_adm1, getopt_force) == False: - print "" - print " === Authentication problem! The Card will permanently ===" - print " === lock down after 3 failed attemts! Double check ADM1! ===" - print "" + if sim.admin_auth(getopt_adm1, getopt_force) == False: exit(1) - print("") - - sim.card.SELECT_ADF_USIM() - print "Detected Card IMSI: ", sim.card.get_imsi() - print "" # Execute tasks if getopt_write_sim_mode != None: - print "Programming SIM-Mode..." - sysmo_usim_write_sim_mode(sim, getopt_write_sim_mode) - print("") + sim.write_sim_mode(getopt_write_sim_mode) if getopt_show_sim_mode: - print "Reading SIM-Mode..." - sysmo_usim_show_sim_mode(sim) - print("") + sim.show_sim_mode() if getopt_write_auth: - print "Programming Authentication parameters..." - sysmo_usim_write_auth_params(sim, getopt_write_auth[0], getopt_write_auth[1]) - print("") + sim.write_auth_params(getopt_write_auth[0], getopt_write_auth[1]) if getopt_show_auth: - print "Reading Authentication parameters..." - sysmo_usim_show_auth_params(sim) - print("") + sim.show_auth_params() if getopt_write_milenage: - print "Programming Milenage parameters..." ef_mlngc = SYSMO_USIMSJS1_FILE_EF_MLNGC(getopt_write_milenage) - sysmo_usim_write_milenage_params(sim, ef_mlngc) - print("") + sim.write_milenage_params(ef_mlngc) if getopt_show_milenage: - print "Reading Milenage parameters..." - sysmo_usim_show_milenage_params(sim) - print("") + sim.show_milenage_params() if getopt_seq_par: - print "Reading Milenage Sequence parameters..." - sysmo_usim_read_milenage_sqn_params(sim) + sim.show_milenage_sqn_params() if getopt_write_op: - print "Writing OP value..." - sysmo_usim_write_opc_params(sim, 0, getopt_write_op) - print("") + sim.write_opc_params(0, getopt_write_op) if getopt_write_opc: - print "Writing OPC value..." - sysmo_usim_write_opc_params(sim, 1, getopt_write_opc) - print("") + sim.write_opc_params(1, getopt_write_opc) if getopt_show_opc: - print "Reading OP/C value..." - sysmo_usim_show_opc_params(sim) - print("") + sim.show_opc_params() if getopt_write_ki: - print "Writing KI value..." - sysmo_usim_write_ki_params(sim, getopt_write_ki) - print("") + sim.write_ki_params(getopt_write_ki) if getopt_show_ki: - print "Reading KI value..." - sysmo_usim_show_ki_params(sim) - print("") + sim.show_ki_params() if getopt_write_iccid: - print "Writing ICCID value..." - sysmo_usim_write_iccid(sim, getopt_write_iccid) - print("") + sim.write_iccid(getopt_write_iccid) if getopt_reset_seq_par: - print "Resetting MILENAGE Sequence Parameters..." - sysmo_usim_reset_milenage_sqn_params(sim) - print("") + sim.reset_milenage_sqn_params() if getopt_write_imsi: - print "Writing IMSI value..." - sysmo_usim_write_imsi(sim, getopt_write_imsi) - print("") + sim.write_imsi(getopt_write_imsi) if getopt_show_mnclen: - print "Reading MNCLEN value..." - sysmo_usim_show_mnclen(sim) - print("") + sim.show_mnclen() if getopt_write_mnclen: - print "Writing MNCLEN value..." - sysmo_usim_write_mnclen(sim, getopt_write_mnclen) - print("") + sim.write_mnclen(getopt_write_mnclen) print "Done!" diff --git a/sysmo_usimsjs1.py b/sysmo_usimsjs1.py index 0c4410e..b821472 100644 --- a/sysmo_usimsjs1.py +++ b/sysmo_usimsjs1.py @@ -221,46 +221,6 @@ class SYSMO_USIMSJS1_FILE_EF_SQNA: out += int_to_list(i, 6) return out - -# Initalize card (select master file) -def sysmo_usim_init(sim): - print " * Initalizing..." - sim.select(GSM_SIM_MF) - - -# Authenticate as administrator -def sysmo_usim_admin_auth(sim, adm1, force = False): - rc = True - rem_attemts = sim.chv_retrys(SYSMO_USIMSJS1_ADM1) - - print " * Remaining attempts: " + str(rem_attemts) - - # Stop if a decreased ADM1 retry counter is detected - if(rem_attemts < 3) and force == False: - print " * Error: Only two authentication attempts remaining, we don't" - print " want to risk another failed authentication attempt!" - print " (double check ADM1 and use option -f to override)" - return False - - if(len(adm1) != 8): - print " * Error: Short ADM1, a valid ADM1 is 8 digits long!" - return False - - # Try to authenticate - try: - print " * Authenticating..." - sim.verify_chv(adm1, SYSMO_USIMSJS1_ADM1) - print " * Authentication successful" - except: - print " * Error: Authentication failed!" - rc = False - - # Read back and display remaining attemts - rem_attemts = sim.chv_retrys(SYSMO_USIMSJS1_ADM1) - print " * Remaining attempts: " + str(rem_attemts) - - return rc - sysmo_usim_algorithms = ( (1, 'MILENAGE'), (3, 'COMP128v1'), @@ -277,316 +237,399 @@ sysmo_usim_opcmodes = ( (1, 'OPc'), ) -# Show current athentication parameters -# (Which algorithim is used for which rat?) -def sysmo_usim_show_auth_params(sim): - sysmo_usim_init(sim) - - print " * Reading..." - sim.select(SYSMO_USIMSJS1_DF_AUTH) - sim.select(SYSMO_USIMSJS1_EF_AUTH) - res = sim.read_binary(0x02) - - algo_2g, algo_3g = res.apdu[:2] - - print " * Current algorithm setting:" - print " 2G: %d=%s" % (algo_2g, id_to_str(sysmo_usim_algorithms, algo_2g)) - print " 3G: %d=%s" % (algo_3g, id_to_str(sysmo_usim_algorithms, algo_3g)) - - -# Program new authentication parameters -def sysmo_usim_write_auth_params(sim, algo_2g_str, algo_3g_str): - - if algo_2g_str.isdigit(): - algo_2g = int(algo_2g_str) - else: - algo_2g = str_to_id(sysmo_usim_algorithms, algo_2g_str) - - if algo_3g_str.isdigit(): - algo_3g = int(algo_3g_str) - else: - algo_3g = str_to_id(sysmo_usim_algorithms, algo_3g_str) - - print " * New algorithm setting:" - print " 2G: %d=%s" % (algo_2g, id_to_str(sysmo_usim_algorithms, algo_2g)) - print " 3G: %d=%s" % (algo_3g, id_to_str(sysmo_usim_algorithms, algo_3g)) +class Sysmo_usimsjs1: + + sim = None + + def __init__(self): + print("Initializing smartcard terminal...") + self.sim = Simcard(GSM_USIM, toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5")) + print(" * Detected Card ICCID: %s" % self.sim.card.get_ICCID()) + self.sim.card.SELECT_ADF_USIM() + print(" * Detected Card IMSI: %s" % self.sim.card.get_imsi()) + print("") + + + def __warn_failed_auth(self, attempts = 3, keytype = "ADM1"): + print(" === Authentication problem! The Card will permanently ===") + print(" === lock down after %d failed attemts! Double check %s! ===" % (attempts, keytype)) + print("") + + + # Authenticate as administrator + def admin_auth(self, adm1, force = False): + print("Authenticating...") + rc = True + rem_attemts = self.sim.chv_retrys(SYSMO_USIMSJS1_ADM1) + + print(" * Remaining attempts: " + str(rem_attemts)) + + # Stop if a decreased ADM1 retry counter is detected + if(rem_attemts < 3) and force == False: + print(" * Error: Only two authentication attempts remaining, we don't") + print(" want to risk another failed authentication attempt!") + print(" (double check ADM1 and use option -f to override)") + print("") + self.__warn_failed_auth() + return False + + if(len(adm1) != 8): + print(" * Error: Short ADM1, a valid ADM1 is 8 digits long!") + print("") + self.__warn_failed_auth() + return False + + # Try to authenticate + try: + print(" * Authenticating...") + self.sim.verify_chv(adm1, SYSMO_USIMSJS1_ADM1) + print(" * Authentication successful") + except: + print(" * Error: Authentication failed!") + self.__warn_failed_auth() + rc = False + + # Read back and display remaining attemts + rem_attemts = self.sim.chv_retrys(SYSMO_USIMSJS1_ADM1) + print(" * Remaining attempts: " + str(rem_attemts)) + print("") + + if rc == False: + self.__warn_failed_auth() + return rc + + + # Initalize card (select master file) + def __init(self): + print " * Initalizing..." + self.sim.select(GSM_SIM_MF) + + + # Show the enable status of the USIM application (app is enabled or disabled?) + def show_sim_mode(self): + print("Reading SIM-Mode...") + self.__init() + + print(" * Reading...") + self.sim.select(GSM_USIM_EF_DIR) + res = self.sim.read_record(0x26, rec_no = 1) + + print(" * Current status of Record No. 1 in EF.DIR:") + print(" " + hexdump(res.apdu)) + + if hexdump(SYSMO_USIM_AID) in hexdump(res.apdu): + print(" ==> USIM application enabled") + else: + print(" ==> USIM application disabled") + print("") + + + # Show the enable status of the USIM application (app is enabled or disabled?) + def write_sim_mode(self, usim_enabled = True): + print("Programming SIM-Mode...") + self.__init() + + if usim_enabled: + new_record = SYSMO_USIM_EF_DIR_REC_1_CONTENT + else: + new_record = [0xFF] * len(SYSMO_USIM_EF_DIR_REC_1_CONTENT) + + print(" * New status of Record No.1 in EF.DIR:") + print(" " + hexdump(new_record)) + if hexdump(SYSMO_USIM_AID) in hexdump(new_record): + print(" ==> USIM application enabled") + else: + print(" ==> USIM application disabled") + + print(" * Programming...") + self.sim.select(GSM_USIM_EF_DIR) + self.sim.update_record(new_record, rec_no = 1) + print("") + + + # Show current athentication parameters + # (Which algorithim is used for which rat?) + def show_auth_params(self): + print("Programming Authentication parameters...") + self.__init() + + print(" * Reading...") + self.sim.select(SYSMO_USIMSJS1_DF_AUTH) + self.sim.select(SYSMO_USIMSJS1_EF_AUTH) + res = self.sim.read_binary(0x02) + + algo_2g, algo_3g = res.apdu[:2] + + print(" * Current algorithm setting:") + print(" 2G: %d=%s" % (algo_2g, id_to_str(sysmo_usim_algorithms, algo_2g))) + print(" 3G: %d=%s" % (algo_3g, id_to_str(sysmo_usim_algorithms, algo_3g))) + print("") + + + # Program new authentication parameters + def write_auth_params(self, algo_2g_str, algo_3g_str): + print("Reading Authentication parameters...") + self.__init() + + if algo_2g_str.isdigit(): + algo_2g = int(algo_2g_str) + else: + algo_2g = str_to_id(sysmo_usim_algorithms, algo_2g_str) + + if algo_3g_str.isdigit(): + algo_3g = int(algo_3g_str) + else: + algo_3g = str_to_id(sysmo_usim_algorithms, algo_3g_str) + + print(" * New algorithm setting:") + print(" 2G: %d=%s" % (algo_2g, id_to_str(sysmo_usim_algorithms, algo_2g))) + print(" 3G: %d=%s" % (algo_3g, id_to_str(sysmo_usim_algorithms, algo_3g))) + + print(" * Programming...") + self.sim.select(SYSMO_USIMSJS1_DF_AUTH) + self.sim.select(SYSMO_USIMSJS1_EF_AUTH) + self.sim.update_binary([algo_2g,algo_3g]) + print("") + + + # Show current milenage parameters + def show_milenage_params(self): + print("Reading Milenage parameters...") + self.__init() + + self.sim.select(SYSMO_USIMSJS1_DF_AUTH) + self.sim.select(SYSMO_USIMSJS1_EF_MLNGC) + + print(" * Reading...") + res = self.sim.read_binary(85) + ef_mlngc = SYSMO_USIMSJS1_FILE_EF_MLNGC(res.apdu) + + print(" * Current Milenage Parameters in (EF.MLNGC):") + print str(ef_mlngc) + print("") + + + # Write new milenage parameters + def write_milenage_params(self, ef_mlngc): + print("Programming Milenage parameters...") + self.__init() + + print(" * New Milenage Parameters for (EF.MLNGC):") + print str(ef_mlngc) + + self.sim.select(SYSMO_USIMSJS1_DF_AUTH) + self.sim.select(SYSMO_USIMSJS1_EF_MLNGC) + + print(" * Programming...") + self.sim.update_binary(ef_mlngc.encode()) + print("") + + + def __get_auth_counter(self): + self.sim.select(SYSMO_USIMSJS1_EF_AC) + res = self.sim.read_binary(4, offset=0) + ctr = list_to_int(res.apdu[0:4]) + if ctr == 0: + return "LOCKED" + elif ctr == 0xFFFFFFFF: + return "DISABLED" + else: + return ctr + + + def __set_auth_counter(self, ctr): + if ctr == "LOCKED": + ctr = 0 + elif ctr == "DISABLED": + ctr = 0xFFFFFFFF + data = int_to_list(ctr, 4) + self.sim.select(SYSMO_USIMSJS1_EF_AC) + res = self.sim.update_binary(data, offset=0) + if ctr == 0: + return "LOCKED" + elif ctr == 0xFFFFFFFF: + return "DISABLED" + else: + return ctr - sysmo_usim_init(sim) - - print " * Programming..." - sim.select(SYSMO_USIMSJS1_DF_AUTH) - sim.select(SYSMO_USIMSJS1_EF_AUTH) - sim.update_binary([algo_2g,algo_3g]) - -def sysmo_usim_get_auth_counter(sim): - sim.select(SYSMO_USIMSJS1_EF_AC) - res = sim.read_binary(4, offset=0) - ctr = list_to_int(res.apdu[0:4]) - if ctr == 0: - return "LOCKED" - elif ctr == 0xFFFFFFFF: - return "DISABLED" - else: - return ctr -def sysmo_usim_set_auth_counter(sim, ctr): - if ctr == "LOCKED": - ctr = 0 - elif ctr == "DISABLED": - ctr = 0xFFFFFFFF - data = int_to_list(ctr, 4) - sim.select(SYSMO_USIMSJS1_EF_AC) - res = sim.update_binary(data, offset=0) - if ctr == 0: - return "LOCKED" - elif ctr == 0xFFFFFFFF: - return "DISABLED" - else: - return ctr + # Show current milenage SQN parameters + def show_milenage_sqn_params(self): + print("Reading Milenage Sequence parameters...") + self.__init() -def sysmo_usim_read_milenage_sqn_params(sim): - sysmo_usim_init(sim) + self.sim.card.SELECT_ADF_USIM() + self.sim.select(SYSMO_USIMSJS1_EF_SQNC) + + res = self.sim.read_binary(15, offset = 0) + ef_sqnc = SYSMO_USIMSJS1_FILE_EF_SQNC(res.apdu) + print(" * Current SQN Configuration:") + print str(ef_sqnc) - sim.card.SELECT_ADF_USIM() - sim.select(SYSMO_USIMSJS1_EF_SQNC) + # SQN Array + ind_pow = 2**ef_sqnc.ind_size_bits + self.sim.select(SYSMO_USIMSJS1_EF_SQNA) + res = self.sim.read_binary(ind_pow*6, offset=0) + ef_sqna = SYSMO_USIMSJS1_FILE_EF_SQNA(res.apdu) + print(" * Current SQN Array:") + print str(ef_sqna) - res = sim.read_binary(15, offset = 0) - ef_sqnc = SYSMO_USIMSJS1_FILE_EF_SQNC(res.apdu) - print " * Current SQN Configuration:" - print str(ef_sqnc) + auth_ctr = self.__get_auth_counter() + print("* Authentication Counter: %s" % auth_ctr) + print("") - # SQN Array - ind_pow = 2**ef_sqnc.ind_size_bits - sim.select(SYSMO_USIMSJS1_EF_SQNA) - res = sim.read_binary(ind_pow*6, offset=0) - ef_sqna = SYSMO_USIMSJS1_FILE_EF_SQNA(res.apdu) - print " * Current SQN Array:" - print str(ef_sqna) - auth_ctr = sysmo_usim_get_auth_counter(sim) - print "* Authentication Counter: %s\n" % auth_ctr + # Reset milenage SQN configuration + def reset_milenage_sqn_params(self): + print(" * Resetting SQN Configuration to defaults...") + self.__init() -def sysmo_usim_reset_milenage_sqn_params(sim): - sysmo_usim_init(sim) + print(" * Resetting...") + self.sim.card.SELECT_ADF_USIM() + ef_sqnc = SYSMO_USIMSJS1_FILE_EF_SQNC(None) + self.sim.select(SYSMO_USIMSJS1_EF_SQNC) + res = self.sim.update_binary(ef_sqnc.encode()) - print " * Resetting SQN Configuration to defaults..." + ef_sqna = SYSMO_USIMSJS1_FILE_EF_SQNA(None, ef_sqnc.ind_size_bits) + self.sim.select(SYSMO_USIMSJS1_EF_SQNA) + res = self.sim.update_binary(ef_sqna.encode()) - sim.card.SELECT_ADF_USIM() - ef_sqnc = SYSMO_USIMSJS1_FILE_EF_SQNC(None) - sim.select(SYSMO_USIMSJS1_EF_SQNC) - res = sim.update_binary(ef_sqnc.encode()) + self.__set_auth_counter("DISABLED") + print("") - ef_sqna = SYSMO_USIMSJS1_FILE_EF_SQNA(None, ef_sqnc.ind_size_bits) - sim.select(SYSMO_USIMSJS1_EF_SQNA) - res = sim.update_binary(ef_sqna.encode()) - sysmo_usim_set_auth_counter(sim, "DISABLED") + # Show current OPc value + def show_opc_params(self): + print("Reading OP/c value...") + self.__init() -# Show current milenage parameters -def sysmo_usim_show_milenage_params(sim): - sysmo_usim_init(sim) + print(" * Reading...") + self.sim.card.SELECT_ADF_USIM() + self.sim.select(SYSMO_USIMSJS1_EF_OPC) + res = self.sim.read_binary(17) - sim.select(SYSMO_USIMSJS1_DF_AUTH) - sim.select(SYSMO_USIMSJS1_EF_MLNGC) + mode_str = id_to_str(sysmo_usim_opcmodes, res.apdu[0]) - print(" * Reading...") - res = sim.read_binary(85) - ef_mlngc = SYSMO_USIMSJS1_FILE_EF_MLNGC(res.apdu) + print(" * Current OP/OPc setting:") + print(" %s: %s" % (mode_str, hexdump(res.apdu[1:]))) + print("") - print " * Current Milenage Parameters in (EF.MLNGC):" - print str(ef_mlngc) + # Program new OPc value + def write_opc_params(self, select, op): + if op: + print("Writing OP value...") + else: + print("Writing OPc value...") + self.__init() -# Write new milenage parameters -def sysmo_usim_write_milenage_params(sim, ef_mlngc): - sysmo_usim_init(sim) + print(" * New OPc setting:") + print(" %s: %s" % (id_to_str(sysmo_usim_opcmodes, select), hexdump(op))) + print(" OP/OPc: " + hexdump(op)) - print " * New Milenage Parameters for (EF.MLNGC):" - print str(ef_mlngc) + self.sim.select(GSM_SIM_DF_GSM) + self.sim.select(SYSMO_USIMSJS1_EF_OPC) - sim.select(SYSMO_USIMSJS1_DF_AUTH) - sim.select(SYSMO_USIMSJS1_EF_MLNGC) + print(" * Programming...") + self.sim.update_binary([select] + op) + print("") - print " * Programming..." - sim.update_binary(ef_mlngc.encode()) + # Show current KI value + def show_ki_params(self): + print("Reading KI value...") + print(" * Reading...") + self.sim.select(GSM_SIM_DF_GSM) + self.sim.select(SYSMO_USIMSJS1_EF_KI) + res = self.sim.read_binary(16) -# Show current OPc value -def sysmo_usim_show_opc_params(sim): - sysmo_usim_init(sim) + print(" * Current KI setting:") + print(" KI: " + hexdump(res.apdu)) + print("") - print " * Reading..." - sim.card.SELECT_ADF_USIM() - sim.select(SYSMO_USIMSJS1_EF_OPC) - res = sim.read_binary(17) - mode_str = id_to_str(sysmo_usim_opcmodes, res.apdu[0]) + # Program new KI value + def write_ki_params(self, ki): + print("Writing KI value...") + self.__init() - print " * Current OP/OPc setting:" - print " %s: %s" % (mode_str, hexdump(res.apdu[1:])) + print(" * New KI setting:") + print(" KI: " + hexdump(ki)) + self.sim.select(GSM_SIM_DF_GSM) + self.sim.select(SYSMO_USIMSJS1_EF_KI) -# Program new OPc value -def sysmo_usim_write_opc_params(sim, select, op): - print " * New OPc setting:" - print " %s: %s" % (id_to_str(sysmo_usim_opcmodes, select), hexdump(op)) - print " OP/OPc: " + hexdump(op) + print(" * Programming...") + self.sim.update_binary(ki) + print("") - sysmo_usim_init(sim) - sim.select(GSM_SIM_DF_GSM) - sim.select(SYSMO_USIMSJS1_EF_OPC) + # Program new ICCID value + def write_iccid(self, iccid): + print("Writing ICCID value...") + self.__init() - print " * Programming..." - sim.update_binary([select] + op) + print(" * New ICCID setting:") + print(" ICCID: " + hexdump(iccid)) + self.sim.select(GSM_SIM_EF_ICCID) -# Show current KI value -def sysmo_usim_show_ki_params(sim): - sysmo_usim_init(sim) + print(" * Programming...") + self.sim.update_binary(swap_nibbles(iccid)) + print("") - print " * Reading..." - sim.select(GSM_SIM_DF_GSM) - sim.select(SYSMO_USIMSJS1_EF_KI) - res = sim.read_binary(16) - print " * Current KI setting:" - print " KI: " + hexdump(res.apdu) + # Program new IMSI value + def write_imsi(self, imsi): + print("Writing IMSI value...") + self.__init() + print(" * New ISMI setting:") + print(" IMSI: " + hexdump(imsi)) -# Program new KI value -def sysmo_usim_write_ki_params(sim, ki): - print " * New KI setting:" - print " KI: " + hexdump(ki) + self.sim.select(GSM_SIM_DF_GSM) + self.sim.select(GSM_SIM_EF_IMSI) - sysmo_usim_init(sim) + imsi = [len(imsi)] + swap_nibbles(imsi) - sim.select(GSM_SIM_DF_GSM) - sim.select(SYSMO_USIMSJS1_EF_KI) + print(" * Programming...") + self.sim.update_binary(imsi) + print("") - print " * Programming..." - sim.update_binary(ki) + # Show current KI value + def show_mnclen(self): + print("Reading MNCLEN value...") + self.__init() -# Show the enable status of the USIM application (app is enabled or disabled?) -def sysmo_usim_show_usim_status(sim): - sysmo_usim_init(sim) + print(" * Reading...") + self.sim.select(GSM_SIM_DF_GSM) + self.sim.select(GSM_SIM_EF_AD) + res = self.sim.read_binary(4) - print " * Reading..." - sim.select(GSM_USIM_EF_DIR) - res = sim.read_record(0x26, rec_no = 1) + print(" * Current MNCLEN setting:") + print(" MNCLEN: " + "0x%02x" % res.apdu[3]) + print("") - print " * Current status of Record No.1 in EF.DIR:" - print " " + hexdump(res.apdu) + # Program new MNCLEN value + def write_mnclen(self, mnclen): + print("Writing MNCLEN value...") + self.__init() -# Show the enable status of the USIM application (app is enabled or disabled?) -def sysmo_usim_show_sim_mode(sim): - sysmo_usim_init(sim) + print(" * New MNCLEN setting:") + print(" MNCLEN: " + "0x" + hexdump(mnclen)) - print " * Reading..." - sim.select(GSM_USIM_EF_DIR) - res = sim.read_record(0x26, rec_no = 1) + if len(mnclen) != 1: + print(" * Error: mnclen value must consist of a single byte!") + return - print " * Current status of Record No. 1 in EF.DIR:" - print " " + hexdump(res.apdu) + self.sim.select(GSM_SIM_DF_GSM) + self.sim.select(GSM_SIM_EF_AD) - if hexdump(SYSMO_USIM_AID) in hexdump(res.apdu): - print " ==> USIM application enabled" - else: - print " ==> USIM application disabled" + res = self.sim.read_binary(4) + new_ad = res.apdu[0:3] + mnclen - -# Show the enable status of the USIM application (app is enabled or disabled?) -def sysmo_usim_write_sim_mode(sim, usim_enabled = True): - if usim_enabled: - new_record = SYSMO_USIM_EF_DIR_REC_1_CONTENT - else: - new_record = [0xFF] * len(SYSMO_USIM_EF_DIR_REC_1_CONTENT) - - print " * New status of Record No.1 in EF.DIR:" - print " " + hexdump(new_record) - if hexdump(SYSMO_USIM_AID) in hexdump(new_record): - print " ==> USIM application enabled" - else: - print " ==> USIM application disabled" - - sysmo_usim_init(sim) - - print " * Programming..." - sim.select(GSM_USIM_EF_DIR) - sim.update_record(new_record, rec_no = 1) - - -# Show current ICCID value -def sysmo_usim_show_iccid(sim): - sysmo_usim_init(sim) - - print " * Reading..." - sim.select(GSM_SIM_EF_ICCID) - res = sim.read_binary(10) - - print " * Current ICCID setting:" - print " ICCID: " + hexdump(swap_nibbles(res.apdu)) - - -# Program new ICCID value -def sysmo_usim_write_iccid(sim, iccid): - print " * New ICCID setting:" - print " ICCID: " + hexdump(iccid) - - sysmo_usim_init(sim) - - sim.select(GSM_SIM_EF_ICCID) - - print " * Programming..." - sim.update_binary(swap_nibbles(iccid)) - - -# Program new IMSI value -def sysmo_usim_write_imsi(sim, imsi): - print " * New ISMI setting:" - print " IMSI: " + hexdump(imsi) - - sysmo_usim_init(sim) - - sim.select(GSM_SIM_DF_GSM) - sim.select(GSM_SIM_EF_IMSI) - - imsi = [len(imsi)] + swap_nibbles(imsi) - - print " * Programming..." - sim.update_binary(imsi) - - -# Show current KI value -def sysmo_usim_show_mnclen(sim): - sysmo_usim_init(sim) - - print " * Reading..." - sim.select(GSM_SIM_DF_GSM) - sim.select(GSM_SIM_EF_AD) - res = sim.read_binary(4) - - print " * Current MNCLEN setting:" - print " MNCLEN: " + "0x%02x" % res.apdu[3] - - -# Program new MNCLEN value -def sysmo_usim_write_mnclen(sim, mnclen): - print " * New MNCLEN setting:" - print " MNCLEN: " + "0x" + hexdump(mnclen) - - if len(mnclen) != 1: - print " * Error: mnclen value must consist of a single byte!" - return - - sysmo_usim_init(sim) - sim.select(GSM_SIM_DF_GSM) - sim.select(GSM_SIM_EF_AD) - - res = sim.read_binary(4) - new_ad = res.apdu[0:3] + mnclen - - print " * Programming..." - sim.update_binary(new_ad) + print(" * Programming...") + self.sim.update_binary(new_ad) + print("") diff --git a/tests/01_auth.out b/tests/01_auth.out index 05875b0..8727385 100644 --- a/tests/01_auth.out +++ b/tests/01_auth.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,6 +11,4 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Done! diff --git a/tests/02_mode_read.out b/tests/02_mode_read.out index af719e2..8b0b0fd 100644 --- a/tests/02_mode_read.out +++ b/tests/02_mode_read.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,8 +11,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading SIM-Mode... * Initalizing... * Reading... diff --git a/tests/03_mode_write.out b/tests/03_mode_write.out index 34bb1f8..2e3cefa 100644 --- a/tests/03_mode_write.out +++ b/tests/03_mode_write.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,13 +11,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Programming SIM-Mode... + * Initalizing... * New status of Record No.1 in EF.DIR: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ==> USIM application disabled - * Initalizing... * Programming... Done! @@ -25,8 +23,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: None Authenticating... * Remaining attempts: 3 @@ -34,8 +32,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: None - Reading SIM-Mode... * Initalizing... * Reading... @@ -48,8 +44,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: None Authenticating... * Remaining attempts: 3 @@ -57,13 +53,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: None - Programming SIM-Mode... + * Initalizing... * New status of Record No.1 in EF.DIR: 61194f10a0000000871002ffffffff890709000050055553696d31ffffffffffffffffffffff ==> USIM application enabled - * Initalizing... * Programming... Done! @@ -71,8 +65,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -80,8 +74,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading SIM-Mode... * Initalizing... * Reading... diff --git a/tests/04_algo.out b/tests/04_algo.out index cc39188..7f2aa87 100644 --- a/tests/04_algo.out +++ b/tests/04_algo.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,13 +11,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 1=MILENAGE 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -25,8 +23,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -34,9 +32,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -48,8 +44,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -57,13 +53,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 3=COMP128v1 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -71,8 +65,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -80,9 +74,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -94,8 +86,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -103,13 +95,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 4=XOR-2G 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -117,8 +107,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -126,9 +116,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -140,8 +128,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -149,13 +137,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 5=GBA 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -163,8 +149,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -172,9 +158,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -186,8 +170,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -195,13 +179,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 6=COMP128v2 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -209,8 +191,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -218,9 +200,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -232,8 +212,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -241,13 +221,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 7=COMP128v3 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -255,8 +233,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -264,9 +242,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -278,8 +254,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -287,13 +263,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 9=CIS-B 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -301,8 +275,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -310,9 +284,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -324,8 +296,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -333,13 +305,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 5=GBA 3G: 8=XOR-3G - * Initalizing... * Programming... Done! @@ -347,8 +317,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -356,9 +326,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -370,8 +338,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -379,13 +347,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 3=COMP128v1 3G: 8=XOR-3G - * Initalizing... * Programming... Done! @@ -393,8 +359,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -402,9 +368,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -416,8 +380,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -425,13 +389,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 1=MILENAGE 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -439,8 +401,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -448,9 +410,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -462,8 +422,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -471,13 +431,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 3=COMP128v1 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -485,8 +443,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -494,9 +452,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -508,8 +464,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -517,13 +473,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 4=XOR-2G 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -531,8 +485,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -540,9 +494,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -554,8 +506,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -563,13 +515,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 6=COMP128v2 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -577,8 +527,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -586,9 +536,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -600,8 +548,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -609,13 +557,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 7=COMP128v3 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -623,8 +569,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -632,9 +578,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -646,8 +590,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -655,13 +599,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 9=CIS-B 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -669,8 +611,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -678,9 +620,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -692,8 +632,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -701,13 +641,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 5=GBA 3G: 8=XOR-3G - * Initalizing... * Programming... Done! @@ -715,8 +653,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -724,9 +662,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: @@ -738,8 +674,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -747,13 +683,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Programming Authentication parameters... +Reading Authentication parameters... + * Initalizing... * New algorithm setting: 2G: 3=COMP128v1 3G: 1=MILENAGE - * Initalizing... * Programming... Done! @@ -761,8 +695,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -770,9 +704,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading Authentication parameters... +Programming Authentication parameters... * Initalizing... * Reading... * Current algorithm setting: diff --git a/tests/05_milenage_par.out b/tests/05_milenage_par.out index 092cb82..607ca76 100644 --- a/tests/05_milenage_par.out +++ b/tests/05_milenage_par.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,8 +11,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Programming Milenage parameters... * Initalizing... * New Milenage Parameters for (EF.MLNGC): @@ -33,8 +31,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -42,8 +40,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading Milenage parameters... * Initalizing... * Reading... @@ -64,8 +60,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -73,8 +69,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Programming Milenage parameters... * Initalizing... * New Milenage Parameters for (EF.MLNGC): @@ -95,8 +89,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -104,8 +98,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading Milenage parameters... * Initalizing... * Reading... diff --git a/tests/06_op_opc.out b/tests/06_op_opc.out index 7b8db32..e780174 100644 --- a/tests/06_op_opc.out +++ b/tests/06_op_opc.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,13 +11,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Writing OPC value... +Writing OP value... + * Initalizing... * New OPc setting: OPc: 000102030405060708090a0b0c0d0e0f OP/OPc: 000102030405060708090a0b0c0d0e0f - * Initalizing... * Programming... Done! @@ -25,8 +23,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -34,9 +32,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading OP/C value... +Reading OP/c value... * Initalizing... * Reading... * Current OP/OPc setting: @@ -47,8 +43,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -56,13 +52,11 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Writing OP value... + * Initalizing... * New OPc setting: OP: 840337c3d45397ce8ea8609ffdc47224 OP/OPc: 840337c3d45397ce8ea8609ffdc47224 - * Initalizing... * Programming... Done! @@ -70,8 +64,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -79,9 +73,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Reading OP/C value... +Reading OP/c value... * Initalizing... * Reading... * Current OP/OPc setting: diff --git a/tests/07_ki.out b/tests/07_ki.out index d84bbc7..03de707 100644 --- a/tests/07_ki.out +++ b/tests/07_ki.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,12 +11,10 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Writing KI value... + * Initalizing... * New KI setting: KI: a0b1c2d3e4f5061728394a5b6c7d8e9f - * Initalizing... * Programming... Done! @@ -24,8 +22,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -33,10 +31,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading KI value... - * Initalizing... * Reading... * Current KI setting: KI: a0b1c2d3e4f5061728394a5b6c7d8e9f @@ -46,8 +41,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -55,12 +50,10 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Writing KI value... + * Initalizing... * New KI setting: KI: 94c7f52c8c7337fad1af3a73b17b56ac - * Initalizing... * Programming... Done! @@ -68,8 +61,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -77,10 +70,7 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading KI value... - * Initalizing... * Reading... * Current KI setting: KI: 94c7f52c8c7337fad1af3a73b17b56ac diff --git a/tests/08_seq.out b/tests/08_seq.out index c0a78b6..d6ced3f 100644 --- a/tests/08_seq.out +++ b/tests/08_seq.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,8 +11,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading Milenage Sequence parameters... * Initalizing... * Current SQN Configuration: @@ -65,8 +63,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -74,10 +72,8 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - -Resetting MILENAGE Sequence Parameters... - * Initalizing... * Resetting SQN Configuration to defaults... + * Initalizing... + * Resetting... Done! diff --git a/tests/09_mnclen.out b/tests/09_mnclen.out index 2bf371e..cdd951b 100644 --- a/tests/09_mnclen.out +++ b/tests/09_mnclen.out @@ -2,8 +2,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -11,12 +11,10 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Writing MNCLEN value... + * Initalizing... * New MNCLEN setting: MNCLEN: 0x02 - * Initalizing... * Programming... Done! @@ -24,8 +22,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -33,8 +31,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading MNCLEN value... * Initalizing... * Reading... @@ -46,8 +42,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -55,12 +51,10 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Writing MNCLEN value... + * Initalizing... * New MNCLEN setting: MNCLEN: 0x03 - * Initalizing... * Programming... Done! @@ -68,8 +62,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -77,8 +71,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading MNCLEN value... * Initalizing... * Reading... @@ -90,8 +82,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -99,12 +91,10 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Writing MNCLEN value... + * Initalizing... * New MNCLEN setting: MNCLEN: 0x02 - * Initalizing... * Programming... Done! @@ -112,8 +102,8 @@ sysmoUSIM-SJS1 parameterization tool Copyright (c)2017 Sysmocom s.f.m.c. GmbH Initializing smartcard terminal... - -Detected Card ICCID: 8988211320300000028 + * Detected Card ICCID: 8988211320300000028 + * Detected Card IMSI: 262423203000002 Authenticating... * Remaining attempts: 3 @@ -121,8 +111,6 @@ Authenticating... * Authentication successful * Remaining attempts: 3 -Detected Card IMSI: 262423203000002 - Reading MNCLEN value... * Initalizing... * Reading...