diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2019-09-12 13:03:23 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2019-09-13 11:04:13 +0200 |
commit | 7592eeea5943cff129514beb376d8269a999aa5e (patch) | |
tree | 8d2e652e0e9b7397101c7250cd3c3d09ae97c597 /pySim-prog.py | |
parent | be069e26ae6e6d0e6aaa50498f274bddebe8e99e (diff) |
pySim-prog: use functions to derive MCC/MNC from IMSI
In case the MCC/MNC are not supplied with a CSV file we cut out the
missing values from the IMSI string. Lets use a function to do this and
also check the input parameters.
Change-Id: I98e5bf8f9ff2a852efb190cc789edf42c5075bf8
Diffstat (limited to 'pySim-prog.py')
-rwxr-xr-x | pySim-prog.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pySim-prog.py b/pySim-prog.py index 9149709..990fe15 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -43,6 +43,7 @@ from pySim.cards import _cards_classes from pySim.utils import h2b, swap_nibbles, rpad, derive_milenage_opc, calculate_luhn, dec_iccid from pySim.ts_51_011 import EF from pySim.card_handler import * +from pySim.utils import * def parse_options(): @@ -483,8 +484,9 @@ def _read_params_csv(opts, iccid=None, imsi=None): def read_params_csv(opts, imsi=None, iccid=None): row = _read_params_csv(opts, iccid=iccid, imsi=imsi) if row is not None: - row['mcc'] = row.get('mcc', row['imsi'][0:3]) - row['mnc'] = row.get('mnc', row['imsi'][3:5]) + row['mcc'] = row.get('mcc', mcc_from_imsi(row.get('imsi'))) + row['mnc'] = row.get('mnc', mnc_from_imsi(row.get('imsi'))) + pin_adm = None # We need to escape the pin_adm we get from the csv if 'pin_adm' in row: |