From 665bd22fc5ca24fa9e9b8fa8f5f176b8164b89d5 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 29 Dec 2017 20:30:35 +0100 Subject: 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 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 --- pySim/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: -- cgit v1.2.3