pySim-fairwaves-prog: Write Ki/OPC/IMSI as read from the input file.

Commenting out generation of random ones.

Change-Id: I36a87f37671cd64d801006d7e2def8f41e95700a
This commit is contained in:
Alexander Chemeris
2018-01-26 15:55:58 +09:00
parent 3a27424ff8
commit 4d5c0293a2

View File

@@ -113,16 +113,18 @@ def program_sim_card(card, sim_db, opts):
sys.exit(1) sys.exit(1)
# Update Ki # Update Ki
ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]).upper() ki = sim_keys[8]
sim_keys[8] = ki # ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]).upper()
# sim_keys[8] = ki
sw = card.update_ki(sim_keys[8]) sw = card.update_ki(sim_keys[8])
if sw != '9000': if sw != '9000':
print("Ki: Fail to update with result = %s" % (sw,)) print("Ki: Fail to update with result = %s" % (sw,))
sys.exit(1) sys.exit(1)
# Update OPC # Update OPC
op_opc = derive_milenage_opc(ki, opts.op).upper() op_opc = sim_keys[9][2:]
sim_keys[9] = '01' + op_opc # op_opc = derive_milenage_opc(ki, opts.op).upper()
# sim_keys[9] = '01' + op_opc
sw = card.update_opc(sim_keys[9][2:]) sw = card.update_opc(sim_keys[9][2:])
if sw != '9000': if sw != '9000':
print("OPC: Fail to update with result = %s" % (sw,)) print("OPC: Fail to update with result = %s" % (sw,))
@@ -135,7 +137,9 @@ def program_sim_card(card, sim_db, opts):
sys.exit(1) sys.exit(1)
# Update IMSI # Update IMSI
imsi = "%03d%02d%s" % (opts.mcc, opts.mnc, imsi[5:]) imsi = sim_keys[1]
# imsi = "%03d%02d%s" % (opts.mcc, opts.mnc, imsi[5:])
# sim_keys[1] = imsi
sw = card.update_imsi(imsi) sw = card.update_imsi(imsi)
if sw != '9000': if sw != '9000':
print("IMSI: Fail to update with result = %s" % (sw,)) print("IMSI: Fail to update with result = %s" % (sw,))