Files view: the PBR's SFI relations reach the APDU decode — and survive DF hops (v2.7.8)
- the PBR SFIs were learned only by the tracker; the message decode's per-channel SFI map still did not know them, so the SEARCH RECORD addressed by SFI 2 after the PBR read showed "SFI 2, unknown file" (the reported case: session 193, 5.434 s — the PBR read at 4.451 declared ADN 4F3A/SFI 2) - database._advance_state now parses an EF_PBR record it sees (a READ RECORD's data or an UPDATE RECORD's body) and merges its FID+SFI pairs into the channel's SFI map, so SFI-addressed SEARCH/READ resolve without the file's own FCP - the learned relations are cached per DF for the session: the live trace leaves DF_PHONEBOOK for DF_TELECOM (SELECT 7F10/6F06) and comes back, and the DF change used to rebuild the map from the static table only, dropping the PBR's pairs — the re-entry now merges the session cache - verified on session 193: the SEARCH at 5.434 s (SFI 2) now resolves to 4f3a (EF_ADN), as do the later ones (31.562/253.475/279.874 s) - tests: the DB-level case — a PBR read, an excursion to DF_TELECOM and back, then an SFI-addressed SEARCH asserting the declared file; 538 Python + 76 Node tests - PWA_VERSION/pyproject/version.py 2.7.8, SW cache simtrace-analyser-v88
This commit is contained in:
1 parent
ac424e67e3
commit
824405f936
7 files changed
+87
-9
No files matched your search
@@ -1782,6 +1782,53 @@ class TestSelectionTracking(unittest.TestCase):
|
||||
self.assertEqual(msgs[3]['decoded']['cla']['channel'], 8)
|
||||
self.assertEqual(msgs[5]['decoded']['cla']['channel'], 12)
|
||||
|
||||
def test_pbr_sfi_resolves_after_the_pbr_read(self):
|
||||
# The card declares the phonebook SFIs in EF_PBR (TS 31.102 §4.4.2.1:
|
||||
# FID + SFI per primitive tag). A SEARCH RECORD addressed by SFI 2
|
||||
# after the PBR read must resolve to the declared file (EF_ADN 4F3A)
|
||||
# even though nothing selected it and no FCP carried its '88' DO.
|
||||
import tempfile
|
||||
from simtrace_analyser.database import Database
|
||||
with tempfile.NamedTemporaryFile(suffix='.db') as tmp:
|
||||
db = Database(tmp.name)
|
||||
sid = db.create_session('capture')
|
||||
db.insert_message(sid, 0.0, 'tpdu',
|
||||
bytes.fromhex('00a40804047f105f3a6102'))
|
||||
db.insert_message(sid, 0.1, 'tpdu',
|
||||
bytes.fromhex('00c0000008' +
|
||||
'62088202412183025f3a' + '9000'))
|
||||
db.insert_message(sid, 0.2, 'tpdu',
|
||||
bytes.fromhex('00a40000024f306102'))
|
||||
db.insert_message(sid, 0.3, 'tpdu',
|
||||
bytes.fromhex('00c000000b' +
|
||||
'620b8205422100180183024f30' +
|
||||
'9000'))
|
||||
db.insert_message(sid, 0.4, 'tpdu',
|
||||
bytes.fromhex('00b2010418' +
|
||||
'a80ac0034f3a02c5034fa104'
|
||||
'aa0ac2034f4a06cb034f4f07' +
|
||||
'9000'))
|
||||
# Leave DF_PHONEBOOK and come back (the live trace does this):
|
||||
# the learned SFI relations must survive the excursion.
|
||||
db.insert_message(sid, 0.5, 'tpdu',
|
||||
bytes.fromhex('00a40804047f106f066102'))
|
||||
db.insert_message(sid, 0.6, 'tpdu',
|
||||
bytes.fromhex('00c000000b' +
|
||||
'620b82054221004b0183026f06' +
|
||||
'9000'))
|
||||
db.insert_message(sid, 0.7, 'tpdu',
|
||||
bytes.fromhex('00a40804047f105f3a6120'))
|
||||
db.insert_message(sid, 0.8, 'tpdu',
|
||||
bytes.fromhex('00c0000008' +
|
||||
'620882013883025f3a' +
|
||||
'9000'))
|
||||
db.insert_message(sid, 0.9, 'tpdu',
|
||||
bytes.fromhex('00a2011427' + 'ff' * 39 +
|
||||
'9000'))
|
||||
search = db.get_messages(sid)[9]['decoded']
|
||||
self.assertEqual(search['p2']['sfi'], 2)
|
||||
self.assertEqual(search['file'], {'fid': '4f3a', 'ef': '4F3A'})
|
||||
|
||||
def test_manage_channel_opens_use_their_channel(self):
|
||||
# The MANAGE CHANNEL open/close exchanges themselves run on the
|
||||
# basic channel; a later extended-channel command must not disturb it.
|
||||
|
||||
@@ -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.7')
|
||||
self.assertEqual(__version__, '2.7.8')
|
||||
|
||||
def test_status_includes_version(self):
|
||||
import os
|
||||
|
||||
Reference in new issue
Block a user