aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-11-01 23:35:31 +0100
committerHarald Welte <laforge@osmocom.org>2023-11-03 00:43:17 +0100
commitf9ea63ea51ef4a7bdf6a7ef531a3da9d2d53468e (patch)
treeb5da07c72a8f4f5ea47f2843cb50a3a9ed2705cc /pySim-shell.py
parent469db9393f18dee986cd0635fc969c050288df36 (diff)
pySim-shell: Improved argument validation for verify_adm argument
Let's make sure we don't even bother to ask the card to verify anything as ADM1 pin which is not either a sequence of decimal digits or an even number of hex digits (even number of bytes). Change-Id: I4a193a3cf63462fad73d145ab1481070ddf767ca
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pySim-shell.py b/pySim-shell.py
index 7aaa234..c2bb15c 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -53,6 +53,7 @@ from pySim.transport import init_reader, ApduTracer, argparse_add_reader_args, P
from pySim.cards import card_detect, SimCardBase, UiccCardBase
from pySim.utils import h2b, b2h, i2h, swap_nibbles, rpad, JsonEncoder, bertlv_parse_one, sw_match
from pySim.utils import sanitize_pin_adm, tabulate_str_list, boxed_heading_str, Hexstr, dec_iccid
+from pySim.utils import is_hexstr_or_decimal
from pySim.card_handler import CardHandler, CardHandlerAuto
from pySim.filesystem import CardDF, CardADF, CardModel, CardApplication
@@ -777,7 +778,7 @@ class PySimCommands(CommandSet):
self._cmd.poutput("no description available")
verify_adm_parser = argparse.ArgumentParser()
- verify_adm_parser.add_argument('ADM1', nargs='?', type=str,
+ verify_adm_parser.add_argument('ADM1', nargs='?', type=is_hexstr_or_decimal,
help='ADM1 pin value. If none given, CSV file will be queried')
@cmd2.with_argparser(verify_adm_parser)