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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user