Unconditionally print ICCID and IMSI

This can help a lot in identifying the cards and in giving context in
case a user copy+pastes the output.  Let's always read those values.
This commit is contained in:
Harald Welte 2017-08-16 16:23:12 +02:00
parent 6d5127c89a
commit 5666cd6818
1 changed files with 7 additions and 9 deletions

View File

@ -51,7 +51,6 @@ def helptext():
print " -C, --set-opc HEXSTRING ........ Set OPc value" print " -C, --set-opc HEXSTRING ........ Set OPc value"
print " -k, --ki ....................... Show KI value" print " -k, --ki ....................... Show KI value"
print " -K, --set-ki ................... Set KI value" print " -K, --set-ki ................... Set KI value"
print " -i, --iccid .................... Show ICCID value"
print "" print ""
@ -72,7 +71,6 @@ def main(argv):
getopt_show_ki = None getopt_show_ki = None
getopt_write_ki = None getopt_write_ki = None
getopt_force = False getopt_force = False
getopt_show_iccid = False
getopt_write_iccid = None getopt_write_iccid = None
# Analyze commandline options # Analyze commandline options
@ -121,8 +119,6 @@ def main(argv):
getopt_write_ki = asciihex_to_list(arg) getopt_write_ki = asciihex_to_list(arg)
elif opt in ("-f", "--force"): elif opt in ("-f", "--force"):
getopt_force = True getopt_force = True
elif opt in ("-i", "--iccid"):
getopt_show_iccid = True
elif opt in ("-I", "--set-iccid"): elif opt in ("-I", "--set-iccid"):
getopt_write_iccid = asciihex_to_list(pad_asciihex(arg)) getopt_write_iccid = asciihex_to_list(pad_asciihex(arg))
@ -139,6 +135,9 @@ def main(argv):
sim = Simcard(c) sim = Simcard(c)
print("") print("")
print "Detected Card ICCID: ", sim.card.get_ICCID()
print ""
# Authenticate # Authenticate
print "Authenticating..." print "Authenticating..."
if sysmo_usim_admin_auth(sim, getopt_adm1, getopt_force) == False: if sysmo_usim_admin_auth(sim, getopt_adm1, getopt_force) == False:
@ -149,6 +148,10 @@ def main(argv):
exit(1) exit(1)
print("") print("")
sim.card.SELECT_ADF_USIM()
print "Detected Card IMSI: ", sim.card.get_imsi()
print ""
# Execute tasks # Execute tasks
if getopt_write_sim_mode != None: if getopt_write_sim_mode != None:
print "Programming SIM-Mode..." print "Programming SIM-Mode..."
@ -208,11 +211,6 @@ def main(argv):
sysmo_usim_show_ki_params(sim) sysmo_usim_show_ki_params(sim)
print("") print("")
if getopt_show_iccid:
print "Reading ICCID value..."
sysmo_usim_show_iccid(sim)
print("")
if getopt_write_iccid: if getopt_write_iccid:
print "Writing ICCID value..." print "Writing ICCID value..."
sysmo_usim_write_iccid(sim, getopt_write_iccid) sysmo_usim_write_iccid(sim, getopt_write_iccid)