mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user