Detail view: P3 says Lc or Le, and SEARCH RECORD names its target (v2.7.9)

- the P3 row read "0x02 — 2 bytes" for both kinds of P3; the decode now marks
  it (p3_kind): a command that carries data has Lc (the command-data length),
  a case-2 command (APDU_SPEC 'le', e.g. READ BINARY/RECORD, GET RESPONSE,
  SEARCH…) has Le (the expected response length).  The detail row appends
  "· Lc (command data length)" / "· Le (expected response length)"
  («Lc (длина данных команды)» / «Le (ожидаемая длина ответа)»)
- a SEARCH RECORD without an SFI searched the current EF (TS 102 221
  §11.1.7.1) but showed no file at all; it now resolves like READ/UPDATE:
  the SFI's declared file when SFI-addressed (an unresolved SFI stays marked
  "SFI n"), otherwise the current selection — with the stale-selection note
  when that EF is not a record file.  Verified on session 193: the 5.371 s
  search (P2=0x04, no SFI) now shows 4FA1, the 5.434 s one (SFI 2) shows 4F3A
- tests: p3_kind cases (Le/Lc/none) and the SEARCH target cases (current EF,
  SFI-resolved, unknown SFI, transparent selection); a Node pin for the P3
  row and the two new Russian strings; 540 Python + 77 Node tests
- PWA_VERSION/pyproject/version.py 2.7.9, SW cache simtrace-analyser-v89
This commit is contained in:
catarrh committed 2026-10-18 01:34:01 +03:00
1 parent 824405f936
commit b743c6621d
8 files changed
+73 -13

No files matched your search

+36
View File
@@ -1967,6 +1967,42 @@ class TestP1P2(unittest.TestCase):
r = decode_message(bytes.fromhex('0020008108' + '12' * 8))
self.assertEqual(r['p2']['name'], 'Second PIN Appl 1')
def test_p3_kind_lc_le(self):
# P3 is the command-data length (Lc) when the command carries data and
# the expected response length (Le) for a case-2 command.
from simtrace_analyser.decode import decode_message
self.assertEqual(decode_message(bytes.fromhex('00b000000a'))['p3_kind'],
'le') # READ BINARY: Le
self.assertEqual(decode_message(
bytes.fromhex('00a40000023f00'))['p3_kind'], 'lc') # SELECT: Lc
self.assertEqual(decode_message(
bytes.fromhex('00a201040200006164'))['p3_kind'], 'lc') # pattern
# A zero-length SELECT carries neither (no data, no Le).
self.assertNotIn('p3_kind',
decode_message(bytes.fromhex('00a4000000')))
def test_search_record_target_file(self):
# A SEARCH RECORD without an SFI searches the current EF
# (TS 102 221 §11.1.7.1) — show the target like READ RECORD does.
from simtrace_analyser.decode import decode_message
prev = {'sel': {'fid': '4fa1', 'structure': 'linear fixed'},
'df': '5f3a'}
r = decode_message(bytes.fromhex('00a201040200006164'), prev=prev)
self.assertEqual(r['file'], {'fid': '4fa1', 'ef': '4FA1'})
# An SFI-addressed search resolves through the SFI map…
prev['sfi_map'] = {2: '4f3a'}
r = decode_message(bytes.fromhex('00a201142c' + 'ff' * 44), prev=prev)
self.assertEqual(r['file'], {'fid': '4f3a', 'ef': '4F3A'})
# …and an unknown SFI stays marked as such.
prev['sfi_map'] = {}
r = decode_message(bytes.fromhex('00a201142c' + 'ff' * 44), prev=prev)
self.assertTrue(r['file']['unknown'])
self.assertEqual(r['file']['sfi'], 2)
# A record search on a transparent selection is a stale-selection note.
prev2 = {'sel': {'fid': '2fe2', 'structure': 'transparent'}, 'df': '3f00'}
r = decode_message(bytes.fromhex('00a201040200006164'), prev=prev2)
self.assertTrue(r['file'].get('stale'))
def test_manage_channel_p2(self):
r = decode_message(bytes.fromhex('0070000300'))
self.assertEqual(r['p1']['name'], 'Open channel')
+1 -1
View File
@@ -224,7 +224,7 @@ class TestImportEndpoint(unittest.TestCase):
class TestVersion(unittest.TestCase):
def test_package_version(self):
from simtrace2_pysniff import __version__
self.assertEqual(__version__, '2.7.8')
self.assertEqual(__version__, '2.7.9')
def test_status_includes_version(self):
import os