diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2017-12-29 20:30:35 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-01-02 07:20:57 +0000 |
commit | 665bd22fc5ca24fa9e9b8fa8f5f176b8164b89d5 (patch) | |
tree | 83b874158a58506d94ac9616af2c1b41c71b516b /pySim | |
parent | 287b6ce1b49fc924fd281a000748f2002114c408 (diff) |
utils.py: dec_imsi: Fix ValueError
It should fix the following observed error:
~/pysim$ ./pySim-read.py -p0
Reading ...
ICCID:
Traceback (most recent call last):
File "./pySim-read.py", line 99, in <module>
print("IMSI: %s" % (dec_imsi(res),))
File "/home/lab434/pysim/pySim/utils.py", line 57, in dec_imsi
l = int(ef[0:2]) * 2 # Length of the IMSI string
ValueError: invalid literal for int() with base 10: 'ff'
Change-Id: I7d3ecbf9edd190d1941816796cee60e3957d5943
Diffstat (limited to 'pySim')
-rw-r--r-- | pySim/utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pySim/utils.py b/pySim/utils.py index 011bd05..84b613f 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -54,7 +54,7 @@ def dec_imsi(ef): """Converts an EF value to the imsi string representation""" if len(ef) < 4: return None - l = int(ef[0:2]) * 2 # Length of the IMSI string + l = int(ef[0:2], 16) * 2 # Length of the IMSI string swapped = swap_nibbles(ef[2:]) oe = (int(swapped[0])>>3) & 1 # Odd (1) / Even (0) if oe: |