diff options
author | Christina Quast <chrysh.ng+git@gmail.com> | 2015-06-19 13:29:14 +0200 |
---|---|---|
committer | Christina Quast <chrysh.ng+git@gmail.com> | 2015-06-19 13:29:21 +0200 |
commit | ca0ebfdbd61d40c38edfaf84daaa343921260a78 (patch) | |
tree | d9b99c7fea04e3fd29389cd8613b154efe257d70 | |
parent | a929bc8850573e7790ad7fe35fcce189f85e899f (diff) |
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.
-rwxr-xr-x | usb_application/mitm.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usb_application/mitm.py b/usb_application/mitm.py index 6f501df..5e8ff6e 100755 --- a/usb_application/mitm.py +++ b/usb_application/mitm.py @@ -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) |