fixeria has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/19409 
)

Change subject: pySim-read.py: decode contents of EF.AD (Administrative data)
......................................................................

pySim-read.py: decode contents of EF.AD (Administrative data)

Change-Id: I938667bdf99d238eefac205d6dd70db1d714d842
---
M pySim-read.py
M pySim/ts_51_011.py
M pysim-testdata/Fairwaves-SIM.ok
M pysim-testdata/Wavemobile-SIM.ok
M pysim-testdata/fakemagicsim.ok
M pysim-testdata/sysmoISIM-SJA2.ok
M pysim-testdata/sysmoUSIM-SJS1.ok
M pysim-testdata/sysmosim-gr1.ok
8 files changed, 39 insertions(+), 9 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  herlesupreeth: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/pySim-read.py b/pySim-read.py
index d6674a5..2ca0557 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -28,7 +28,7 @@
 import random
 import re
 import sys
-from pySim.ts_51_011 import EF, DF, EF_SST_map
+from pySim.ts_51_011 import EF, DF, EF_SST_map, EF_AD_mode_map
 from pySim.ts_31_102 import EF_UST_map, EF_USIM_ADF_map
 from pySim.ts_31_103 import EF_IST_map

@@ -225,7 +225,15 @@
        # EF.AD
        (res, sw) = card.read_binary('AD')
        if sw == '9000':
-               print("AD: %s" % (res,))
+               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:
+                       print("\tCiphering Indicator: enabled")
+               else:
+                       print("\tCiphering Indicator: disabled")
        else:
                print("AD: Can't read, response code = %s" % (sw,))

diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 37d2bc8..8b73f02 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -313,4 +313,14 @@
        57: 'Multimedia Messaging Service (MMS)',
        58: 'Extension 8',
        59: 'MMS User Connectivity Parameters',
-}
\ No newline at end of file
+}
+
+# 10.3.18 "EF.AD (Administrative data) "
+EF_AD_mode_map = {
+       '00' : 'normal operation',
+       '80' : 'type approval operations',
+       '01' : 'normal operation + specific facilities',
+       '81' : 'type approval operations + specific facilities',
+       '02' : 'maintenance (off line)',
+       '04' : 'cell test operation',
+}
diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok
index dcdd43c..6dd839c 100644
--- a/pysim-testdata/Fairwaves-SIM.ok
+++ b/pysim-testdata/Fairwaves-SIM.ok
@@ -42,7 +42,9 @@

 ACC: 0008
 MSISDN: Not available
-AD: 00000002
+Administrative data: 00000002
+       MS operation mode: normal operation
+       Ciphering Indicator: disabled
 SIM Service Table: ff3cc3ff030fff0f000fff03f0c0
        Service 1 - CHV1 disable function
        Service 2 - Abbreviated Dialling Numbers (ADN)
diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok
index 0e41ec0..010a228 100644
--- a/pysim-testdata/Wavemobile-SIM.ok
+++ b/pysim-testdata/Wavemobile-SIM.ok
@@ -49,7 +49,9 @@
 HPLMNAcT: Can't read file -- SW match failed! Expected 9000 and got 6a82.
 ACC: abce
 MSISDN: Not available
-AD: 00ffff02
+Administrative data: 00ffff02
+       MS operation mode: normal operation
+       Ciphering Indicator: enabled
 SIM Service Table: ff33ff0f3c00ff0f000cf0c0f0030000
        Service 1 - CHV1 disable function
        Service 2 - Abbreviated Dialling Numbers (ADN)
diff --git a/pysim-testdata/fakemagicsim.ok b/pysim-testdata/fakemagicsim.ok
index 7ac9e2a..1d1714f 100644
--- a/pysim-testdata/fakemagicsim.ok
+++ b/pysim-testdata/fakemagicsim.ok
@@ -16,7 +16,9 @@
 HPLMNAcT: Can't read file -- SW match failed! Expected 9000 and got 9404.
 ACC: ffff
 MSISDN: Not available
-AD: 000000
+Administrative data: 000000
+       MS operation mode: normal operation
+       Ciphering Indicator: disabled
 SIM Service Table: ff3fff0f0300f003000c
        Service 1 - CHV1 disable function
        Service 2 - Abbreviated Dialling Numbers (ADN)
diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok
index 82176c6..947cff6 100644
--- a/pysim-testdata/sysmoISIM-SJA2.ok
+++ b/pysim-testdata/sysmoISIM-SJA2.ok
@@ -54,7 +54,9 @@

 ACC: 0200
 MSISDN: Not available
-AD: 00000002
+Administrative data: 00000002
+       MS operation mode: normal operation
+       Ciphering Indicator: disabled
 SIM Service Table: ff33ffff3f003f0f300cf0c3f00000
        Service 1 - CHV1 disable function
        Service 2 - Abbreviated Dialling Numbers (ADN)
diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok
index 55c43ad..da1a1f6 100644
--- a/pysim-testdata/sysmoUSIM-SJS1.ok
+++ b/pysim-testdata/sysmoUSIM-SJS1.ok
@@ -54,7 +54,9 @@

 ACC: 0008
 MSISDN (NPI=1 ToN=1): +77776336143
-AD: 00000002
+Administrative data: 00000002
+       MS operation mode: normal operation
+       Ciphering Indicator: disabled
 SIM Service Table: ff3fffff3f003f1ff00c00c0f00000
        Service 1 - CHV1 disable function
        Service 2 - Abbreviated Dialling Numbers (ADN)
diff --git a/pysim-testdata/sysmosim-gr1.ok b/pysim-testdata/sysmosim-gr1.ok
index 684fda7..f4b09c8 100644
--- a/pysim-testdata/sysmosim-gr1.ok
+++ b/pysim-testdata/sysmosim-gr1.ok
@@ -16,7 +16,9 @@
 HPLMNAcT: Can't read file -- SW match failed! Expected 9000 and got 9404.
 ACC: 0008
 MSISDN: Not available
-AD: 000000
+Administrative data: 000000
+       MS operation mode: normal operation
+       Ciphering Indicator: disabled
 SIM Service Table: ff3fff0f0f0000030000
        Service 1 - CHV1 disable function
        Service 2 - Abbreviated Dialling Numbers (ADN)

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/19409
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I938667bdf99d238eefac205d6dd70db1d714d842
Gerrit-Change-Number: 19409
Gerrit-PatchSet: 7
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: herlesupreeth <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to