Add per-command response decoders (FCP, AUTH, TERMINAL RESPONSE)
decode.py: - _decode_fcp: FCP/FCI/FMD template — full bit-level file descriptor (TS 102 221 Table 11.5: file type, structure, shareable, data coding, record length, num records), file ID (+ KNOWN_FIDS name), DF name, SFI, life cycle - _decode_auth: GSM SRES+Kc, or 3G tag DB (RES/CK/IK/KC) / DC (AUTS) - _decode_tr_result: TERMINAL RESPONSE Result TLV (code + name) - _decode_response_for(ins, data): GET RESPONSE decodes its body using the previous command's INS (SELECT→FCP, AUTHENTICATE→auth) - decode_message wires response decoding for TR and GET RESPONSE database.py: prev context now carries 'ins' (INS byte) via _context_from_decoded, used by GET RESPONSE response decoding tests: FCP, AUTH (GSM/3G), TR result, GET RESPONSE wiring (57 total)
This commit is contained in:
1 parent
e68df163a9
commit
f30fe41d75
3 files changed
+261
-5
No files matched your search
@@ -202,7 +202,16 @@ class Database:
|
||||
d = decode_sniff_msg(row[0], 'tpdu', 0)
|
||||
if not d:
|
||||
return None
|
||||
return {'ins_name': d.get('ins_name'), 'sw1': (d.get('sw') or {}).get('sw1')}
|
||||
return self._context_from_decoded(d)
|
||||
|
||||
def _context_from_decoded(self, d):
|
||||
ins_hex = d.get('ins_hex')
|
||||
ins = int(ins_hex, 16) if ins_hex else None
|
||||
return {
|
||||
'ins': ins,
|
||||
'ins_name': d.get('ins_name'),
|
||||
'sw1': (d.get('sw') or {}).get('sw1'),
|
||||
}
|
||||
|
||||
def _decode_rows(self, rows, initial_prev=None):
|
||||
msgs = []
|
||||
@@ -211,9 +220,6 @@ class Database:
|
||||
msg = self._row_to_message(row, prev=prev)
|
||||
d = msg.get('decoded')
|
||||
if msg['type'] == 'tpdu' and d and d.get('ins_hex'):
|
||||
prev = {
|
||||
'ins_name': d.get('ins_name'),
|
||||
'sw1': (d.get('sw') or {}).get('sw1'),
|
||||
}
|
||||
prev = self._context_from_decoded(d)
|
||||
msgs.append(msg)
|
||||
return msgs
|
||||
Reference in new issue
Block a user