aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-read.py
diff options
context:
space:
mode:
authorRobert Falkenberg <robert.falkenberg@tu-dortmund.de>2021-04-12 11:43:22 +0200
committerlaforge <laforge@osmocom.org>2021-04-13 11:27:37 +0000
commit9d16fbca4a433f32dae6ec06f86de07553d9c4d2 (patch)
treeb302e07fb4addab13fb494013e841aa104e7bdc4 /pySim-read.py
parentc8ff026782f9f3a6b1dd2197083154916dfdea17 (diff)
Use construct for EF_AD in pySim-{shell, prog, read}.py, cards.py
Also serves as example for RFU (reserved for future use) fields which should not always be reset to zero in case they have been set on the uSIM for some reason. See pySim/ts_51_011.py, class EF_AD. * Add definitions for RFU {Flag, Bits, Byte, Bytes} * Use IntEnum for OP_MODE (convenient auto completion) * Remove obsolete definitions and imports * Update test results for all SIMs (opmode strings are shortened) Change-Id: I65e0a426f80a619fec38856a30e590f0e726b554
Diffstat (limited to 'pySim-read.py')
-rwxr-xr-xpySim-read.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/pySim-read.py b/pySim-read.py
index 59c5762..8e4a512 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -28,7 +28,7 @@ import os
import random
import re
import sys
-from pySim.ts_51_011 import EF, DF, EF_SST_map, EF_AD_mode_map
+from pySim.ts_51_011 import EF, DF, EF_SST_map, EF_AD
from pySim.ts_31_102 import EF_UST_map, EF_USIM_ADF_map
from pySim.ts_31_103 import EF_IST_map, EF_ISIM_ADF_map
@@ -230,11 +230,10 @@ if __name__ == '__main__':
(res, sw) = card.read_binary('AD')
if sw == '9000':
print("Administrative data: %s" % (res,))
- if res[:2] in EF_AD_mode_map:
- print("\tMS operation mode: %s" % (EF_AD_mode_map[res[:2]],))
- else:
- print("\tMS operation mode: (unknown 0x%s)" % (res[:2],))
- if int(res[4:6], 16) & 0x01:
+ ad = EF_AD()
+ decoded_data = ad.decode_hex(res)
+ print("\tMS operation mode: %s" % decoded_data['ms_operation_mode'])
+ if decoded_data['ofm']:
print("\tCiphering Indicator: enabled")
else:
print("\tCiphering Indicator: disabled")