Files view: the full DF chain in the file path (v2.7.6)

- the tracker kept only the immediate parent DF, so a phonebook file read as
  "DF_PHONEBOOK/4FA1" — the trace's own selection path (00a4080406
  7F105F3A4FA1) spells out the whole chain; the channel state now carries it
  (selected_df_state() returns (df, path), e.g. ('5f3a', ['7f10', '5f3a'])),
  the tracker stores it per file and _file_path() renders it:
  "DF_TELECOM/DF_PHONEBOOK/4FA1"
- chain rules: a child DF selected by FID appends to the current chain, MF and
  the ADF restart it, an AID is its own root, a path selection uses the DFs
  in the path (an explicit '7fff' collapsing to the ADF), and an EF selects
  keeps it.  A leading MF is implicit in a longer path; MF-only files keep
  "MF/…", ADF files "ADF/…" (the previous labels unchanged)
- the chain is learned from the FCP sighting too and extends a shorter path
  recorded earlier, so entries created from a GET RESPONSE still get the full
  path
- verified on the live traces (sessions 47/193): 5f3a/4fa1 ->
  DF_TELECOM/DF_PHONEBOOK/4FA1, 5f3a/4f30 -> DF_TELECOM/DF_PHONEBOOK/EF_PBR
  (4F30), while 3f00/2fe2 -> MF/EF_ICCID (2FE2) and 7fff/6f07 ->
  ADF/EF_IMSI (6F07) stay as before
- tests: selected_df_state (path/FID/MF/ADF/AID/EF cases) and a tracker flow
  with a path selection asserting the full path; 529 Python + 76 Node tests
- README/README_RUS show the chain; PWA_VERSION/pyproject/version.py 2.7.6,
  SW cache simtrace-analyser-v86
This commit is contained in:
catarrh committed 2026-10-18 01:05:55 +03:00
1 parent 1df52a34e5
commit 5dea6bceb8
12 files changed
+184 -52

No files matched your search

+27
View File
@@ -1814,6 +1814,33 @@ class TestSfiResolution(unittest.TestCase):
self.assertEqual(r['file']['ef'], 'EF_LOCI')
self.assertEqual(r['file']['tmsi'], '1E731E57')
def test_selected_df_state(self):
from simtrace_analyser.decode import selected_df_state
def sel(p1, body):
return {'ins_hex': 'a4', 'p1': {'raw': p1}, 'body': {'hex': body}}
# A path selection spells out the DF chain: 7F10/5F3A/4FA1.
self.assertEqual(selected_df_state(sel('08', '7f105f3a4fa1')),
('5f3a', ['7f10', '5f3a']))
# A child DF selected by FID appends to the current chain.
self.assertEqual(selected_df_state(sel('00', '5f3a'), '7f10', ['7f10']),
('5f3a', ['7f10', '5f3a']))
# MF and the ADF start a fresh chain; an AID is the root.
self.assertEqual(selected_df_state(sel('00', '3f00'), '7f10',
['7f10', '5f3a']),
('3f00', ['3f00']))
self.assertEqual(selected_df_state(sel('08', '7fff6f07'), '3f00',
['3f00']), ('7fff', ['7fff']))
aid = 'aid:a00000015141434c00'
self.assertEqual(selected_df_state(sel('04', 'A00000015141434C00'),
'3f00', ['3f00']), (aid, [aid]))
# An EF selection leaves the chain in place; non-SELECTs never move it.
self.assertEqual(selected_df_state(sel('09', '4fa1'), '5f3a',
['7f10', '5f3a']),
('5f3a', ['7f10', '5f3a']))
self.assertEqual(selected_df_state({'ins_hex': 'b0'}), (None, None))
def test_selected_df_fid(self):
from simtrace_analyser.decode import selected_df_fid, sfi_table
self.assertEqual(selected_df_fid({'ins_hex': 'a4', 'p1': {'raw': '08'},
+26
View File
@@ -13,6 +13,11 @@ def sel_fid(fid, le='02'):
return f'00a4000002{fid}61{le}'
def sel_path(path_hex, le='02'):
"""SELECT a path from the MF (P1=08)."""
return f'00a40804{len(path_hex) // 2:02x}{path_hex}61{le}'
def gr(data_hex, total=None):
"""GET RESPONSE carrying *data_hex* (the FCP or the read data)."""
n = len(data_hex) // 2 if total is None else total
@@ -541,6 +546,20 @@ class TestNaming(TrackerCase):
'DF_GSM/EF_SST (6F38)')
class TestDfChain(TrackerCase):
def test_path_selection_keeps_the_full_df_chain(self):
# The trace's own path selection spells out DF_TELECOM/DF_PHONEBOOK;
# the Files view used to show only the parent DF.
data = self.track(
sel_path('7f105f3a4fa1'),
gr(fcp('4fa1', rec_len=44, n_rec=100)),
)
entry = data['files']['5f3a/4fa1']
self.assertEqual(entry['path'], 'DF_TELECOM/DF_PHONEBOOK/4FA1')
self.assertEqual(entry['record_len'], 44)
self.assertEqual(entry['n_records'], 100)
class TestFilePath(unittest.TestCase):
def test_paths(self):
from simtrace_analyser.filetrack import _file_path
@@ -556,6 +575,13 @@ class TestFilePath(unittest.TestCase):
# The DF_TELECOM files are named from TS 51.011 10.5 / TS 31.102 4.5.
self.assertEqual(_file_path('7f10', '6f3a', '6F3A'),
'DF_TELECOM/EF_ADN (6F3A)')
# The full DF chain (learned from the selection path) is part of the
# path — the immediate DF alone hid DF_TELECOM for the phonebook.
self.assertEqual(_file_path('5f3a', '4fa1', '4FA1', None,
['7f10', '5f3a']),
'DF_TELECOM/DF_PHONEBOOK/4FA1')
self.assertEqual(_file_path('7fff', '6f07', 'EF_IMSI', None, ['7fff']),
'ADF/EF_IMSI (6F07)')
# An application selected by an unknown AID: the AID is the DF name,
# with the EF.DIR label when the trace surfaced it.
self.assertEqual(_file_path('aid:a00000015141434c00', '4f09', '4F09'),
+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.5')
self.assertEqual(__version__, '2.7.6')
def test_status_includes_version(self):
import os