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
This commit is contained in:
Pau Espin 2017-12-29 20:30:35 +01:00 committed by Harald Welte
parent 287b6ce1b4
commit 665bd22fc5
1 changed files with 1 additions and 1 deletions

View File

@ -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: