From 4d5c0293a2c38fce34a18ac32aaaab00938dc9e4 Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Fri, 26 Jan 2018 15:55:58 +0900 Subject: [PATCH] pySim-fairwaves-prog: Write Ki/OPC/IMSI as read from the input file. Commenting out generation of random ones. Change-Id: I36a87f37671cd64d801006d7e2def8f41e95700a --- pySim-fairwaves-prog.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pySim-fairwaves-prog.py b/pySim-fairwaves-prog.py index 1f44d35c..d9922cfc 100755 --- a/pySim-fairwaves-prog.py +++ b/pySim-fairwaves-prog.py @@ -113,16 +113,18 @@ def program_sim_card(card, sim_db, opts): sys.exit(1) # Update Ki - ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]).upper() - sim_keys[8] = ki + ki = sim_keys[8] +# ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]).upper() +# sim_keys[8] = ki sw = card.update_ki(sim_keys[8]) if sw != '9000': print("Ki: Fail to update with result = %s" % (sw,)) sys.exit(1) # Update OPC - op_opc = derive_milenage_opc(ki, opts.op).upper() - sim_keys[9] = '01' + op_opc + op_opc = sim_keys[9][2:] +# op_opc = derive_milenage_opc(ki, opts.op).upper() +# sim_keys[9] = '01' + op_opc sw = card.update_opc(sim_keys[9][2:]) if sw != '9000': print("OPC: Fail to update with result = %s" % (sw,)) @@ -135,7 +137,9 @@ def program_sim_card(card, sim_db, opts): sys.exit(1) # 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) if sw != '9000': print("IMSI: Fail to update with result = %s" % (sw,))