path: root/pySim-read.py
diff options
authorSupreeth Herle <herlesupreeth@gmail.com>2019-12-22 09:00:59 +0100
committerVadim Yanitskiy <axilirator@gmail.com>2020-02-15 04:22:53 +0700
commit4b1c7633954697eda687fb122a73166446fa1f83 (patch)
treed24712f16bbfb75d163dec85924abde1b9e247e8 /pySim-read.py
parentd24f1635135f72743345c0296dd469ec037eff5b (diff)
pySim-read.py: fix reading and parsing of EF.MSISDN
This change implements parsing of EF.MSISDN (and thus EF.ADN) as per 3GPP TS 31.102, sections 4.2.26 and Example (commercial SIM card from 401/02): EF.MSISDN: ffffffffffffffffffffffffffff07917787028982f7ffffffffffff Decoded (NPI=1 ToN=1): +77782098287 Note that sysmoUSIM-SJS1 in the test setup has malformed EF.MSISDN, so that's why the test output is changed. Change-Id: Ie914ae83d787e3f1a90f9f305bffd45053b8c863
Diffstat (limited to 'pySim-read.py')
1 files changed, 5 insertions, 3 deletions
diff --git a/pySim-read.py b/pySim-read.py
index d753c8b..ce5f8a5 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -37,7 +37,7 @@ except ImportError:
import simplejson as json
from pySim.commands import SimCardCommands
-from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, format_xplmn_w_act, dec_spn
+from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn, format_xplmn_w_act, dec_spn
def parse_options():
@@ -186,8 +186,10 @@ if __name__ == '__main__':
# print(scc.record_size(['3f00', '7f10', '6f40']))
(res, sw) = scc.read_record(['3f00', '7f10', '6f40'], 1)
if sw == '9000':
- if res[1] != 'f':
- print("MSISDN: %s" % (res,))
+ res_dec = dec_msisdn(res)
+ if res_dec is not None:
+ # (npi, ton, msisdn) = res_dec
+ print("MSISDN (NPI=%d ToN=%d): %s" % res_dec)
print("MSISDN: Not available")