mirror of https://gerrit.osmocom.org/simtrace2
Added more cmds to phone.py smartcard emulator
This commit is contained in:
parent
531d10b403
commit
e5342b3c25
|
@ -99,29 +99,37 @@ def handle_phone_request(dev, state):
|
||||||
INS = 1
|
INS = 1
|
||||||
|
|
||||||
def send_response(dev, cmd):
|
def send_response(dev, cmd):
|
||||||
print("Write response");
|
print("Write response to ")
|
||||||
|
print("".join("%02x " % b for b in cmd))
|
||||||
# FIXME: We could get data of length 5 as well! Implement another distinct criteria!
|
# FIXME: We could get data of length 5 as well! Implement another distinct criteria!
|
||||||
if len(cmd) == 5: # Received cmd from phone
|
if len(cmd) == 5: # Received cmd from phone
|
||||||
if cmd[INS] == 0xA4:
|
if cmd[INS] == 0xA4:
|
||||||
resp = [cmd[INS]] # Respond with INS byte
|
resp = [cmd[INS]] # Respond with INS byte
|
||||||
print("Cmd: ")
|
|
||||||
print(cmd)
|
|
||||||
elif cmd[INS] == 0xC0:
|
elif cmd[INS] == 0xC0:
|
||||||
|
data = [0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x7F, 0x20, 0x02, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x91, 0x00, 0x17,
|
||||||
|
0x04, 0x00, 0x83, 0x8A,
|
||||||
|
0x83, 0x8A]
|
||||||
SW = [0x90, 0x00]
|
SW = [0x90, 0x00]
|
||||||
resp = [cmd[INS], 0xA, 0xA, SW] # Respond with INS byte
|
resp = [cmd[INS], data, SW] # Respond with INS byte
|
||||||
print("Cmd, resp: ")
|
else:
|
||||||
print(cmd)
|
print("Unknown cmd")
|
||||||
print(resp)
|
resp = [0x60, 0x00]
|
||||||
|
elif len(cmd) == 2:
|
||||||
|
resp = [0x9F, 0x16]
|
||||||
else:
|
else:
|
||||||
# FIXME:
|
resp = [0x60, 0x00]
|
||||||
resp = [0x9F, 0x02]
|
|
||||||
|
print("Cmd, resp: ")
|
||||||
|
print("".join("%02x " % b for b in cmd))
|
||||||
|
print("".join("%02x " % b for b in resp))
|
||||||
|
|
||||||
print(resp)
|
|
||||||
written = dev.write(0x01, resp, 10000);
|
written = dev.write(0x01, resp, 10000);
|
||||||
print("Bytes written:")
|
if written > 0:
|
||||||
print(written)
|
print("Bytes written:")
|
||||||
|
print(written)
|
||||||
|
|
||||||
def emulate_sim():
|
def emulate_sim():
|
||||||
dev = find_dev()
|
dev = find_dev()
|
||||||
|
|
Loading…
Reference in New Issue