Rename parse_fancy_apdu to parse_fancy
This commit is contained in:
parent
20b8d8167e
commit
e343352675
|
@ -53,7 +53,7 @@ class Passport_Security_Environment(TCOS_Security_Environment):
|
||||||
new_apdu.append("8E()00")
|
new_apdu.append("8E()00")
|
||||||
|
|
||||||
new_apdu_string = "".join(new_apdu)
|
new_apdu_string = "".join(new_apdu)
|
||||||
apdu = C_APDU.parse_fancy_apdu(new_apdu_string)
|
apdu = C_APDU.parse_fancy(new_apdu_string)
|
||||||
|
|
||||||
return TCOS_Security_Environment.before_send(self, apdu)
|
return TCOS_Security_Environment.before_send(self, apdu)
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ class Cyberflex_Shell(Shell):
|
||||||
|
|
||||||
def cmd_fancy(self, *args):
|
def cmd_fancy(self, *args):
|
||||||
"Parse a fancy APDU and print the result"
|
"Parse a fancy APDU and print the result"
|
||||||
apdu = utils.C_APDU.parse_fancy_apdu(*args)
|
apdu = utils.C_APDU.parse_fancy(*args)
|
||||||
data = apdu.render()
|
data = apdu.render()
|
||||||
if hasattr(self, "card"):
|
if hasattr(self, "card"):
|
||||||
self.card.last_result = utils.R_APDU(data+"\x00\x00")
|
self.card.last_result = utils.R_APDU(data+"\x00\x00")
|
||||||
|
@ -233,7 +233,7 @@ class Cyberflex_Shell(Shell):
|
||||||
"Parse and transmit a fancy APDU"
|
"Parse and transmit a fancy APDU"
|
||||||
apdu = None
|
apdu = None
|
||||||
try:
|
try:
|
||||||
apdu = utils.C_APDU.parse_fancy_apdu(*args)
|
apdu = utils.C_APDU.parse_fancy(*args)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -319,7 +319,7 @@ class C_APDU(Command_Frame,APDU):
|
||||||
_apduregex = re.compile(r'^\s*([0-9a-f]{2}\s*){4,}$', re.I)
|
_apduregex = re.compile(r'^\s*([0-9a-f]{2}\s*){4,}$', re.I)
|
||||||
_fancyapduregex = re.compile(r'^\s*([0-9a-f]{2}\s*){4,}\s*((xx|yy)\s*)?(([0-9a-f]{2}|:|\)|\(|\[|\])\s*)*$', re.I)
|
_fancyapduregex = re.compile(r'^\s*([0-9a-f]{2}\s*){4,}\s*((xx|yy)\s*)?(([0-9a-f]{2}|:|\)|\(|\[|\])\s*)*$', re.I)
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_fancy_apdu(*args):
|
def parse_fancy(*args):
|
||||||
apdu_string = " ".join(args)
|
apdu_string = " ".join(args)
|
||||||
if not C_APDU._fancyapduregex.match(apdu_string):
|
if not C_APDU._fancyapduregex.match(apdu_string):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
Loading…
Reference in New Issue