diff --git a/frontend/help-ru.html b/frontend/help-ru.html index 8a4c7e9..65b436e 100644 --- a/frontend/help-ru.html +++ b/frontend/help-ru.html @@ -381,7 +381,7 @@
  • Атрибуты файла — тип файла, размер, длина записи и число записей из FCP-шаблона (любой можно оставить незаданным).
  • Проверить содержимое (опционально) — Точное (точное совпадение hex) или Маска, где ? — шаблон на один полубайт (маска без ? — совпадение префикса, например 0891 для MCC/MNC из IMSI). Для record-файлов хранится список по записям.
  • -

    Проверить карту выполняет каждое правило на подключённой карте и показывает строку прогресса и отчёт прохождения. Рядом с путём файла указывается, что именно проверялось (например, тип файла и размер, содержимое или полный FCI); если часть проверок прошла, а часть нет — каждый аспект помечается (тип файла ✓, размер ✗, содержимое ✓), а расхождения расписываются ниже. Несовпавшие сырые данные (FCI, содержимое, данные записей) показываются как поля только для чтения с моноширинным шрифтом — ожидаемое над фактическим, в одной и той же колонке — для удобного сравнения; для расхождений FCI дополнительно показывается декодированное сравнение по параметрам (размер файла, дескриптор/структура, жизненный цикл, FID, SFI, проприетарные параметры…). Декодированный просмотр FCP также отображается под полем FCI hex при редактировании правила. Для record-файлов при расхождении содержимого добавляется пометка совпадающие записи: 1-5, 7-10 со списком записей, которые совпали.

    +

    Проверить карту выполняет каждое правило на подключённой карте и показывает строку прогресса и отчёт прохождения. Рядом с путём файла указывается, что именно проверялось (например, тип файла и размер, содержимое или полный FCI); если часть проверок прошла, а часть нет — каждый аспект помечается (тип файла ✓, размер ✗, содержимое ✓), а расхождения расписываются ниже. Несовпавшие сырые данные (FCI, содержимое, данные записей) показываются как поля только для чтения с моноширинным шрифтом — ожидаемое над фактическим, в одной и той же колонке — для удобного сравнения; для расхождений FCI дополнительно показывается декодированное сравнение по параметрам (размер файла, дескриптор/структура, жизненный цикл, FID, SFI, проприетарные параметры…). Декодированный просмотр FCP также отображается рядом с полем FCI hex при редактировании правила. Для record-файлов при расхождении содержимого добавляется пометка совпадающие записи: 1-5, 7-10 со списком записей, которые совпали.

    Опции сканирования «Профиль с карты»

    Диалог сканирования запрашивает имя профиля и предлагает селектор «Проверка FCP/FCI» (те же три режима, по умолчанию Тип файла + размер (FCP)), применяемый ко всем создаваемым правилам, а также список «Игнорировать содержимое файлов» (все отмечены по умолчанию) часто перезаписываемых файлов, содержимое которых пропускается: EF.LOCI, EF.PSLOCI, EF.EPSLOCI, EF.5GS3GPPLOCI, EF.Keys, EF.KeysPS, EF.SMS, EF.Kc, EF.KcGPRS, EF.LOCIGPRS, EF.CBMID, EF.SMSS. Ещё две отмеченные по умолчанию опции «Сравнивать первые 4 байта для» EF.IMSI и EF.ICCID захватывают содержимое этих файлов как маску только первых 4 байт (снимите для точного сравнения). Строка прогресса показывает N / всего файлов с текущим путём файла во время сканирования; при сканировании опции скрываются, а кнопки блокируются. Правила создаются только для файлов, которые реально существуют на карте (возвращён FCP-шаблон); отсутствующие файлы пропускаются. Пользовательские файлы из подвкладки «Пользовательские файлы» включаются с той же проверкой существования.

    diff --git a/frontend/help.html b/frontend/help.html index c19ea41..073976c 100644 --- a/frontend/help.html +++ b/frontend/help.html @@ -381,7 +381,7 @@
  • File attributes — file type, size, record length and record count, taken from the FCP template (any may be left unset).
  • Check contents (optional) — Exact hex equality, or Mask where ? is a per-nibble wildcard (a mask with no ? is a prefix match, e.g. 0891 for the IMSI MCC/MNC). Record files store a per-record list.
  • -

    Check card runs every rule against the equipped card and shows a live progress line plus a pass/fail report. Each row states exactly what was verified next to the file path (e.g. filetype and size, contents or exact FCI); when some checks pass and others fail, each aspect is marked (filetype ✓, size ✗, contents ✓) with the mismatches detailed below. Mismatched raw data (FCI, contents, record data) is shown as read-only monospace fields — expected above actual, aligned in the same column — for easy comparison; FCI mismatches additionally show a decoded per-parameter comparison (file size, file descriptor/structure, life cycle, FID, SFI, proprietary parameters…). A decoded FCP preview is also shown under the FCI hex field while editing a rule. For record files with a contents mismatch, a matching records: 1-5, 7-10 note lists the records that did match.

    +

    Check card runs every rule against the equipped card and shows a live progress line plus a pass/fail report. Each row states exactly what was verified next to the file path (e.g. filetype and size, contents or exact FCI); when some checks pass and others fail, each aspect is marked (filetype ✓, size ✗, contents ✓) with the mismatches detailed below. Mismatched raw data (FCI, contents, record data) is shown as read-only monospace fields — expected above actual, aligned in the same column — for easy comparison; FCI mismatches additionally show a decoded per-parameter comparison (file size, file descriptor/structure, life cycle, FID, SFI, proprietary parameters…). A decoded FCP preview is also shown beside the FCI hex field while editing a rule. For record files with a contents mismatch, a matching records: 1-5, 7-10 note lists the records that did match.

    “Profile from card” scan options

    The scan dialog asks for a profile name and offers a “FCP/FCI check” selector (the same three modes above, default Filetype + size) applied to every generated rule, plus an “Ignore contents of files” checklist (all checked by default) of frequently-overwritten files whose contents are skipped: EF.LOCI, EF.PSLOCI, EF.EPSLOCI, EF.5GS3GPPLOCI, EF.Keys, EF.KeysPS, EF.SMS, EF.Kc, EF.KcGPRS, EF.LOCIGPRS, EF.CBMID, EF.SMSS. Two further checked-by-default options “Match first 4 bytes for” EF.IMSI and EF.ICCID capture those files’ contents as a mask of only the first 4 bytes (uncheck for exact matching). A progress line shows N / total files with the current file path while scanning; during the scan the options are hidden and the buttons are locked. Rules are created only for files that actually exist on the card (a FCP template is returned); missing files are skipped. Custom files from the Custom files sub-tab are included under the same existence check.

    diff --git a/frontend/index.html b/frontend/index.html index c9d2461..19ad60c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7410,9 +7410,12 @@ function profilerRenderRule(i, r) { } html += ''; if (fciMode === 'exact') { - html += '
    ' + - '' + - '
    ' + profilerFciPreviewHtml(r.fciHex || '') + '
    '; + html += '
    '; + html += '
    ' + + '
    '; + html += '
    ' + esc(t('Decoded FCP')) + '
    ' + + '
    ' + profilerFciPreviewItems(r.fciHex || '') + '
    '; + html += '
    '; } if (r.fileType !== 'df') { html += profilerRenderContentEditor(i, r); @@ -7929,22 +7932,25 @@ function fcpDiffHtml(expectedHex, actualHex) { return html; } -function profilerFciPreviewHtml(hex) { +function profilerFciPreviewItems(hex) { const d = fcpDecode(hex); if (!d.ok || !d.items.length) return ''; - let html = '
    ' + esc(t('Decoded FCP')) + '
    '; - html += '
    '; + let html = ''; for (const it of d.items) { if (it.decoded === null) continue; html += '
    ' + esc(it.name) + ': ' + esc(it.decoded || it.value) + '
    '; } - html += '
    '; return html; } function profilerUpdateFciPreview(i, value) { const el = document.getElementById('profiler-fci-preview-' + i); - if (el) el.innerHTML = profilerFciPreviewHtml(value); + if (el) el.innerHTML = profilerFciPreviewItems(value); +} + +function profilerFciInput(i, value) { + profilerUpdateRule(i, 'fciHex', value); + profilerUpdateFciPreview(i, value); } function profilerRenderReport(results) { diff --git a/frontend/sw.js b/frontend/sw.js index 536b596..a490a1c 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -1,4 +1,4 @@ -const CACHE = 'otaman-v72'; +const CACHE = 'otaman-v73'; const URLS = [ 'index.html', 'help.html', diff --git a/frontend/tests/profiler.test.js b/frontend/tests/profiler.test.js index 8b47047..8239701 100644 --- a/frontend/tests/profiler.test.js +++ b/frontend/tests/profiler.test.js @@ -21,7 +21,7 @@ function extractFunc(src, name, asyncFn) { return (asyncFn ? 'async ' : '') + src.slice(m.index, i + 1); } -const FNS = ['profilerNormHex', 'profilerNormHexStrict', 'profilerMatch', 'profilerMatchMin', 'profilerMaskPrefix4', 'profilerFileFields', 'profilerContentKindForFileType', 'profilerEmptyRecordContent', 'profilerValidateProfile', 'profilerCustomNameForPath', 'profilerUpdateRulePath', 'profilerResultAspects', 'profilerAspectSummary', 'profilerNumRanges', 'esc', 'escHtml', 'profilerRawDataCheck', 'profilerRenderReport', 'parseBerLen', 'parseTlvList', 'fcpInt', 'fcpFileDescriptor', 'fcpLifeCycle', 'fcpSfi', 'fcpDo', 'fcpDecode', 'fcpDiffHtml', 'profilerFciPreviewHtml']; +const FNS = ['profilerNormHex', 'profilerNormHexStrict', 'profilerMatch', 'profilerMatchMin', 'profilerMaskPrefix4', 'profilerFileFields', 'profilerContentKindForFileType', 'profilerEmptyRecordContent', 'profilerValidateProfile', 'profilerCustomNameForPath', 'profilerUpdateRulePath', 'profilerResultAspects', 'profilerAspectSummary', 'profilerNumRanges', 'esc', 'escHtml', 'profilerRawDataCheck', 'profilerRenderReport', 'parseBerLen', 'parseTlvList', 'fcpInt', 'fcpFileDescriptor', 'fcpLifeCycle', 'fcpSfi', 'fcpDo', 'fcpDecode', 'fcpDiffHtml', 'profilerFciPreviewItems', 'profilerUpdateFciPreview', 'profilerUpdateRule', 'profilerFciInput']; let code = ''; for (const f of FNS) code += extractFunc(html, f) + '\n'; code += extractFunc(html, 'profilerBuildFileRule', true) + '\n'; @@ -654,11 +654,26 @@ test('fcpDiffHtml highlights differing FCP parameters', () => { delete global.t; }); -test('profilerFciPreviewHtml renders a decoded preview and degrades gracefully', () => { +test('profilerFciPreviewItems renders decoded items and degrades gracefully', () => { global.t = s => s; - assert.ok(profilerFciPreviewHtml(FCP_TRANSPARENT).includes('File size: ')); - assert.strictEqual(profilerFciPreviewHtml('not hex'), ''); - assert.strictEqual(profilerFciPreviewHtml(''), ''); + assert.ok(profilerFciPreviewItems(FCP_TRANSPARENT).includes('File size: ')); + assert.strictEqual(profilerFciPreviewItems('not hex'), ''); + assert.strictEqual(profilerFciPreviewItems(''), ''); + delete global.t; +}); + +test('profilerFciInput stores the edited FCI and re-decodes the preview', () => { + global.t = s => s; + global.profilerDraft = { rules: [{ fciHex: '', fciMode: 'exact' }] }; + const el = { innerHTML: '' }; + global.document = { getElementById: id => (id === 'profiler-fci-preview-0' ? el : null) }; + profilerFciInput(0, FCP_TRANSPARENT); + assert.strictEqual(global.profilerDraft.rules[0].fciHex, FCP_TRANSPARENT); + assert.ok(el.innerHTML.includes('File size: ')); + profilerFciInput(0, 'zz'); + assert.strictEqual(el.innerHTML, ''); + global.profilerDraft = null; + delete global.document; delete global.t; });