pySim-shell: Reject any non-decimal PIN values

Don't even send any non-decimal PIN values to the card, but reject
them when parsing the command arguments.

Change-Id: Icec1698851471af7f76f20201dcdcfcd48ddf365
This commit is contained in:
Harald Welte committed 2023-11-03 00:43:17 +01:00
1 parent 977c5925a1
commit 1c849f8bc2
2 files changed
+15 -8

No files matched your search

+7
View File
@@ -1487,3 +1487,10 @@ def is_hexstr(instr: str) -> str:
if len(instr) & 1:
raise ValueError('Input has un-even number of hex digits')
return instr
def is_decimal(instr: str) -> str:
"""Method that can be used as 'type' in argparse.add_argument() to validate the value consists of
an even sequence of decimal digits only."""
if not instr.isdecimal():
raise ValueError('Input must decimal')
return instr