aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2018-01-26 15:55:58 +0900
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2018-01-26 15:55:58 +0900
commit4d5c0293a2c38fce34a18ac32aaaab00938dc9e4 (patch)
tree872a354d99496f98d967c27c14587e1921568c98
parent3a27424ff8956e1e1675a5bfa8128a17d365d134 (diff)
pySim-fairwaves-prog: Write Ki/OPC/IMSI as read from the input file.
Commenting out generation of random ones. Change-Id: I36a87f37671cd64d801006d7e2def8f41e95700a
-rwxr-xr-xpySim-fairwaves-prog.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/pySim-fairwaves-prog.py b/pySim-fairwaves-prog.py
index 1f44d35..d9922cf 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,))