mitm.py: Bugfix: Always check for APDU_S_SEND_DATA

When the command a0 c0 00 00 16 was send, and the the bytes
a0 c0 00 00 where read first, and then only the byte 16 was read
from simtrace, the code never entered the if condition if cmd is not
None, and therefore never executed send_receive_cmd.

Bug fix: Check for state APDU_S_SEND_DATA after apdu_split (parsing)
the ACK-instruction byte, in case it was an instruction which requires
an answer from the SIM card.
This commit is contained in:
Christina Quast
2015-06-19 13:29:14 +02:00
parent a929bc8850
commit ca0ebfdbd6

View File

@@ -105,10 +105,10 @@ def do_mitm(dev, sim_emul=True):
write_phone(dev, replace(sim_data))
for c in sim_data:
apdu.split(c)
elif apdu.state == apdu_states.APDU_S_SEND_DATA:
sim_data = sm_con.send_receive_cmd(replace(apdu.buf))
sim_data.insert(0, apdu.ins)
write_phone(dev, replace(sim_data))
apdu.state = apdu_states.APDU_S_SW1
for c in sim_data:
apdu.split(c)
if apdu.state == apdu_states.APDU_S_SEND_DATA:
sim_data = sm_con.send_receive_cmd(replace(apdu.buf))
#sim_data.insert(0, apdu.ins)
write_phone(dev, replace(sim_data))
#apdu.state = apdu_states.APDU_S_SW1
for c in sim_data:
apdu.split(c)