Commit Graph
100 Commits
Author SHA1 Message Date
catarrh 72b0116bad C-APDU Parser: client-side hex parser for APDU/expanded script decode
New 'Parser' subtab in C-APDU section. Detects format (compact C-APDU
chain, expanded AA/AE80 script) and renders collapsible tree with decoded
parameters. Key features:
- BER-TLV parser with multi-byte tag support and CR-bit handling
- Proactive command decoder (types from BER_QUAL, devices from BER_DEVICES)
- SIM/UICC toolkit parameter decoder (CA/EA/80)
- GSM7 text decode (7-bit packed, escape sequences)
- Best-effort UCS2/GSM7 text detection
- Compact C-APDU chain with implied-CLA support (SELECT + op chaining)
- 18 test cases from exchange vectors (apdu_parse.test.js)
2026-08-20 22:11:55 +03:00
catarrh 8019326cfb Error Action: render builder directly, remove redundant subtype select
Error Action (tag 82) now renders buildErrorActionRow() directly in
onBerTypeChange, bypassing the shared ber-subtype select which had
confusing 'Action indicator' option and dead 'Proactive command'/'Custom
hex' choices. Removed the now-unreachable type === 'error' branch from
onBerSubTypeChange.
2026-08-20 21:39:59 +03:00
catarrh 01931b9693 Fix Error Action proactive: filter REFRESH out of allowed commands
When Error Action (tag 82) uses the Proactive command subtype, only
DISPLAY TEXT and PLAY TONE are allowed per TS 102 226 Table 5.9.
Pass allowed=['display','tone'] to buildBerPcHtml for error-type rows.
2026-08-20 21:34:38 +03:00
catarrh 03ec13364c Fix onErrorActionTypeChange: sel.nextElementSibling -> sel.parentElement.nextElementSibling
The Error Action HTML structure wraps the select in a flex div sibling to
the .error-action-body div, so sel.nextElementSibling was null.
2026-08-20 21:29:07 +03:00
catarrh e6602c40bf RAM constructor fixes: EA/CA nesting, access domain order, menu pairs, BER lengths, services byte (TS 102 226)
- UICC Toolkit tag 80 nested inside EA (EA 12 80 10 ...)
- ram-tk-mode value ea (was 80), label 'UICC Toolkit (Tag EA)'
- SIM (CA) access domain FIRST in payload, blank = 00
- Menu entries: 2×m pairs (i=1 first, i=m last, else 0000)
- CA/EA lengths via berLenStr() (supports 81xx long form)
- UICC trailing 'Maximum number of services' byte (ram-tk-services)
- DELETE: P1=00 fixed, mode in P2 (80E4 00 <mode> ...)
- STORE DATA: ram-enc 00/40/80/C0/E0 with correct labels
- LOAD: P1 fixed to 0x80 (last block)
- USIM SELECT: selP1 0x09 -> 0x00 (select by file id)
- ram.test.js: 11 exact-hex tests from exchange vectors
- v1.8.1, SW cache otaman-v9
2026-08-20 21:23:37 +03:00
catarrh 4a6a142c3d Expanded Format spec fixes: REFRESH qualifiers, Error Action forms, Script Chaining flags, CR-bit tags (TS 102 226)
- BER_QUAL.refresh: full TS 102 223 §8.6 table (00-0A)
- Error Action rebuilt as single select: Proactive (DISPLAY/PLAY TONE only) /
  No action (82 00) / EFRMA ref (82 01 xx) / Custom hex; drop bogus
  Action Type / Trigger Conditions / Retry Count UI
- buildBerPcHtml(allowed): no Custom option; typeBytes tone 31 -> 20
- DISPLAY TEXT Duration control emitting 84 02 <unit> <interval>
- File list tag 12 -> 92 (CR bit set)
- Script Chaining flags 01/11/02/03 + keep-across-reset checkbox (RFM)
- ber.test.js: exact-hex tests for all above (exchange vectors)
2026-08-20 21:13:41 +03:00
catarrh 0217f8dc92 Error Action Recovery: add Action Indicator / Proactive Command / None selector per TS 102 226 §7.3.3 2026-08-20 02:04:18 +03:00
catarrh 6d8ef55398 Fix Error Action Recovery Action: extract buildBerPcHtml, fix container vs element in genBerPcValue call 2026-08-20 01:48:15 +03:00
catarrh 43242210ab Fix Error Action Recovery Action builder: append to DOM before querying 2026-08-20 01:41:09 +03:00
catarrh 53daf2c6ea Auto-connect on same-origin detection 2026-08-20 01:36:54 +03:00
catarrh 79cf003444 Fix Script Chaining selector bugs in genScriptChainingValue
Fixed all three selectors to use rowIdx from dataset.berIdx:
- 'chaining-][value="first"]' → 'chaining-{rowIdx}[value="first"]'
- 'chaining][value="intermediary"]' → 'chaining-{rowIdx}[value="intermediary"]'
- Already fixed: 'chaining]-last' → 'chaining-{rowIdx}-last'

Now bits 0/1/2 correctly set based on First/Intermediary/Last checkboxes.

Frontend: frontend/index.html
Tests: 14 Node green
2026-08-19 23:51:10 +03:00
catarrh e8a8ef3d1b Fix Script Chaining Last Script checkbox selector typo
Fixed malformed querySelector in genScriptChainingValue:
- 'chaining-]-last' → 'chaining-{rowIdx}-last'
- Last Script checkbox (bit 2) now correctly contributes to flags byte
- First+Last = 0x05, Intermediary+Last = 0x06, Last alone = 0x04

Frontend: frontend/index.html
Tests: 14 Node green
2026-08-19 23:44:33 +03:00
catarrh d75604a751 TS 102 226: Expanded Script compliance with Error Action, Script Chaining, Expanded Response
Server:
- ExpandedRemoteResponse parser for per-command results (TS 102 226 §5.2.2)
- _decode_por() tries expanded parsing first, fallback to CompactRemoteResp
- response_type indicator: 'expanded'/'compact'/'none' + per-command details

Frontend:
- Error Action TLV (tag 82): structured UI with Action Type, SW pattern builder, recovery command, retry count
- Script Chaining TLV (tag 83): First/Intermediary/Last flags, Script ID with auto-increment hints, Additional Data
- Error Action replaces old 'action indicator' dropdown (breaking change)
- genErrorActionValue()/genScriptChainingValue() encoding functions
- updateSwMaskDisplay() for visual SW pattern builder

Documentation:
- help.html/help-ru.html: Error Action, Script Chaining, Expanded Response sections

Tests:
- TestExpandedRemoteResponse: construct parsing, error handling, chaining context
- 49 Python + 14 Node tests green
2026-08-19 23:20:24 +03:00
catarrh 80a860549a v1.8.0: proactive log overhaul, Expanded Script rename, proactive view sizing
Server:
- Track all TERMINAL RESPONSEs (chain, TP, pySim auto-handler, menu-respond
  link to paused entry) with shared _build_tr/_record_tr
- Log entry ids + cmd_num; server-side decode of fetched commands and TRs
  (compact PLI port); Result CTLV extracted as tr_result/tr_result_name
- _LoggingApduTracer captures TR SW for pySim auto-handler responses
- _DefaultProactiveHandler answers PLI with editor data (no re-request)
- VERSION 1.8.0

Frontend:
- Expandable proactive log rows (click to expand, state survives re-render)
- Response section: Result name + hex, decoded fields, width-restrained
  readonly hex inputs; no SW display
- Rename Expanded Script tab/pill/button/docs; proactive UICC view font
  sizing increase; card reader pills text-sm
2026-08-19 18:04:08 +03:00
catarrh a916e8a255 PLI list: vertical layout, full descriptions, wider inputs, row separators
- Drop truncation: full qualifier descriptions (wrap)
- Raw hex input moves under the description, fills row width (flex-1)
- Subtle bottom-border separator between qualifiers
2026-08-16 00:47:06 +03:00
catarrh 62ba09d25e Probe: require JSON version field to confirm same-origin API
SPA-fallback static hosts return 200 HTML for /api/version, which falsely
triggered same-origin mode. Now validate the body parses as JSON with a string
version field before switching to a relative base.
2026-08-15 14:33:00 +03:00
catarrh 966ada21eb Replace embedded flag with same-origin API probe
- Server serves frontend verbatim (drop window.PYSIM_EMBEDDED injection)
- Frontend probes /api/version once; res.ok -> relative base + cleared URL input,
  otherwise fall back to http://127.0.0.1:8080
- sw.js: never intercept/cache /api/* (live card data)
2026-08-15 14:10:24 +03:00
catarrh 1971eca381 pyproject: restrict package discovery to pysim_otaman_server
Fix setuptools flat-layout error ('Multiple top-level packages discovered'
for frontend/ node_modules/ pysim_otaman_server/) by explicit find.include.
2026-08-14 16:02:44 +03:00
catarrh d2c292e5b8 Merge pysim-otaman-server into otaman (monorepo, v1.7.0)
- Move PWA into frontend/; server package at pysim_otaman_server/
- Server now serves the PWA (same origin -> no CORS/PNA): static file handler
  + --web-dir flag + injects window.PYSIM_EMBEDDED marker into index.html
- Frontend defaults to relative API base when embedded (pysimBase = '')
- Version 1.7.0 aligned: server.py VERSION, pyproject.toml, PWA header
- SW cache bump otaman-v7 -> otaman-v8
- Docs: combined README + docs/api.md endpoint reference; update links
- Fix stale package.json repository URL
2026-08-14 15:48:38 +03:00
catarrh 8e96c5d4a0 Reduce input field vertical padding (py-2.5->py-1.5) in C-APDU, Secured Packet, Response parser and Cards tabs 2026-08-14 14:13:30 +03:00
catarrh 05096a184a Reduce top bar height (py-4->py-2, mb-6->mb-3); rebuild Tailwind CSS 2026-08-14 13:44:02 +03:00
catarrh 65127b8cfe Show connect-phase messages in visible slot (was writing to hidden #pysim-status)
#pysim-status lives inside the hidden #pysim-connected-row, so 'Checking card…',
version warnings, and the connection-failure hint were never visible. Add
#pysim-connect-msg inside the disconnected info block and route pre-connect
messages to it.
2026-08-14 00:18:22 +03:00
catarrh a88930b7b1 Show actionable warning when card server fetch fails; fix connect-button locale
- Detect likely browser PNA/local-network block via origin-vs-target heuristic
- Show warning mentioning both causes (server down + browser block)
- Fix 'Connect' button resetting to English after failed connect (t('Connect'))
- Fix 'Connection failed:' translation never matching (trailing-space key)
2026-08-14 00:14:32 +03:00
catarrh ab78455ff6 docs: document browser local-network permission for public-hosted PWA 2026-08-13 23:59:53 +03:00
catarrh e8158fa5c4 v1.6.1: document Private Network Access for public-hosted PWA 2026-08-13 23:35:54 +03:00
catarrh 3c03b04157 Add AES-128/192/256 support to secured packet builder (v1.6.0)
- Bundle aes-js as aes-bundle.js (standalone aesjs global), precache in SW (v7)
- Add AES-CBC (zero IV, 16/24/32B) + AES-CMAC (SP 800-38B, 8-octet) helpers
- genSp(): algorithm dispatch, AES counter hard-block (b5b4 = 10/11 per Rel-18)
- Cross-checked AES vectors against pySim OtaDialectSms.encode_cmd
- Docs: AES + 3DES deprecation, fix stale SPI1 value table
2026-08-13 22:56:35 +03:00
catarrh 6e2a670fc8 Help manual: note SMPP bridge omitted on Windows 2026-08-13 22:11:26 +03:00
catarrh 65aa38dc1b Help manual: recommend Python 3.10-3.13 for pyscard wheels on Windows 2026-08-13 21:41:10 +03:00
catarrh 6418e1e37d Help manual: note pyscard precompiled wheels + C++ Build Tools fallback 2026-08-13 21:31:32 +03:00
catarrh e3b8664286 Fix disconnect message: pySim -> pysim-otaman-server 2026-08-13 21:11:34 +03:00
catarrh 925ff80d80 Add offline HTML help manual (EN/RU) with sidebar TOC + context-aware help link 2026-08-13 15:26:08 +03:00
catarrh 69a20baa9f v1.5.1 2026-08-11 23:54:46 +03:00
catarrh f764760b0a Proactive log: decode PLI response data using PLI_CODECS; hide empty Response 2026-08-11 23:26:05 +03:00
catarrh a2f7b60333 Proactive log: qualifier names for all multi-qual commands, Response line under command 2026-08-11 23:13:32 +03:00
catarrh 3b7dbf1743 Proactive log: inline TR hex, remove expand toggle + polling re-render 2026-08-11 23:05:34 +03:00
catarrh 7c5d0051d4 PWA poll loop: detect card disconnect, show 'Card disconnected' 2026-08-11 22:36:27 +03:00
catarrh 302a1f87a2 Rebuild CSS (gap-6 was purged) 2026-08-11 22:22:17 +03:00
catarrh 52bcd31387 Auto-poll toggle + PWA backend poll loop (5s) for proactive tab 2026-08-11 21:44:37 +03:00
catarrh d4f40aaaef Fix privilege byte 1 decode: add missing Mandated DAP Verification checkbox (bit 1) 2026-08-10 21:41:30 +03:00
catarrh bdf3d1a352 Remove byte count from proactive command list 2026-08-10 20:16:34 +03:00
catarrh c0784a10c6 Proactive log: show TERMINAL RESPONSE hex + SW on expand 2026-08-10 20:12:59 +03:00
catarrh 4de1bd49d8 Proactive log: expandable hex dump + decoded PLI qualifier names 2026-08-10 20:02:54 +03:00
catarrh e4ef33c097 Add Send STATUS button above event list in Proactive UICC 2026-08-10 19:53:56 +03:00
catarrh 6e460908d8 README: Proactive UICC pill features 2026-08-10 19:46:23 +03:00
catarrh ef754befab v1.5.0: PLI data dictionary, event send, rejection cause dropdown, clipboard import fix 2026-08-10 19:44:25 +03:00
catarrh f6d36aaf99 v1.4.3 2026-08-10 03:05:45 +03:00
catarrh 9608302a52 feat: Proactive UICC tab shows fetched proactive command log with type name, elapsed time, and byte count (i18n: RU) 2026-08-10 03:03:24 +03:00
catarrh b67c9cb7cc v1.4.2 2026-08-10 02:00:19 +03:00
catarrh dc5b936f91 fix: move pysim-sub-proactive into correct tab parent (pysim, not C-APDU) 2026-08-10 01:31:21 +03:00
catarrh 15804f7d99 fix: move pysim-sub-proactive from C-APDU tab to card reader sub-tabs 2026-08-10 00:55:29 +03:00
catarrh 7bcc79d859 add 'Proactive UICC' pill to Card reader tab with event list display from SET UP EVENT LIST 2026-08-10 00:40:12 +03:00
catarrh 98b24a5389 hide OK button on SELECT ITEM view, show only on DISPLAY TEXT 2026-08-09 23:40:40 +03:00
catarrh c0d69040d5 fix conversion layout (button below input), add missing closing divs, add HTML div-balance test 2026-08-09 22:47:49 +03:00
catarrh 9510813e78 fix: remove extra closing div that placed conversion below flex row 2026-08-09 22:41:40 +03:00
catarrh a9de20aa0a fix: remove extra closing div that broke outer container for non-C-APDU tabs 2026-08-09 22:39:45 +03:00
catarrh d81305e157 fix C-APDU DOM nesting: add missing flex-1 and tab-c-apdu closing divs 2026-08-09 22:35:09 +03:00
catarrh 3388048ead move Conversion block to right column in C-APDU tab 2026-08-09 22:31:13 +03:00
catarrh 40381bf6a5 share Conversion section across all C-APDU sub-tabs, remove duplicate from SIM/USIM 2026-08-09 22:27:31 +03:00
catarrh 5d6460c649 decrease vertical padding on top-level tabs (py-2 -> py-1.5) 2026-08-09 22:13:11 +03:00
catarrh f2b18aafd5 C-APDU pills: centered, larger font, more padding 2026-08-09 22:12:15 +03:00
catarrh 1f0ab59c40 fix C-APDU DOM nesting: remove extra closing divs from sed substitution 2026-08-09 22:08:30 +03:00
catarrh 0987278d79 group SIM/USIM/BER-TLV/RAM tabs into C-APDU tab with sub-tab pills 2026-08-09 21:59:31 +03:00
catarrh 1c54e70c72 remove redundant file tree refresh on file manager open, saves ~40 APDUs per open 2026-08-09 17:40:43 +03:00
catarrh 54ceaddeb8 i18n: translate Back button in STK menu 2026-08-09 17:28:23 +03:00
catarrh 7bf5aa2711 fix disconnected state: split 'once ready' into 'Click' + 'Connect' + 'when ready' for clean EN/RU rendering 2026-08-09 16:57:31 +03:00
catarrh 4c4a5032f1 remove bold 'Connect' span between disconnected-state instructions 2026-08-09 16:53:50 +03:00
catarrh 72e44943d7 translate bold 'Connect' to 'Подключиться' in disconnected state 2026-08-09 16:52:04 +03:00
catarrh 4b38217c98 restore full Russian text for disconnected-state instruction 2026-08-09 16:49:30 +03:00
catarrh 6356110516 fix: remove redundant 'Press Connect' from Russian disconnected-state text 2026-08-09 16:47:41 +03:00
catarrh 8bbf89af4e hide Send to Card when disconnected; add RU translation 2026-08-09 16:45:07 +03:00
catarrh 4c05bf743a hide Verify vs pySim button when disconnected; add RU translation 2026-08-09 16:43:22 +03:00
catarrh 2699f267db i18n: translate card reader connected state — 30 new keys for buttons, pills, labels, status messages 2026-08-09 16:36:25 +03:00
catarrh 3778a95462 v1.4.1: Cards tab with localStorage, i18n translations, response parser privilege fix, STK menu refresh on equip 2026-08-09 16:16:29 +03:00
catarrh e92f85d3e0 fix: refresh STK menu after equip, prevent stale card data in STK pill 2026-08-09 15:39:46 +03:00
catarrh c7c1b4d3e7 fix: improve Russian translation for 'once pysim-otaman-server is ready' 2026-08-09 15:29:14 +03:00
catarrh 8dc9b8f64c fix: change SP card selector label to 'Выбор карты' 2026-08-09 15:27:35 +03:00
catarrh 1c636a55f2 fix: change 'Пресеты карт' to 'Данные карт' in Russian translations 2026-08-09 15:25:20 +03:00
catarrh e2dac3d42f fix: move cardsLoad() after currentLang init to avoid TDZ error 2026-08-09 15:23:38 +03:00
catarrh 09cd72ab17 i18n: translate Cards tab, Card reader disconnected state, SP card selector — 18 new keys with Russian translations 2026-08-09 15:04:22 +03:00
catarrh 35f8716d24 i18n: add data-l10n keys for Response parser, Cards, Card reader tabs; Russian translations 2026-08-09 09:38:14 +03:00
catarrh 65ad13272d fix PRIVILEGE_NAMES byte 1: insert null for reserved b6, shift Delegated Management to b5 per GP Card Spec v2.3 Table 11-7 2026-08-09 08:33:35 +03:00
catarrh f5285d330e fix disconnected instruction: line break before 'Refer to' 2026-08-09 03:08:09 +03:00
catarrh 88416ebb39 fix disconnected state instruction: line break before README files reference 2026-08-09 03:06:50 +03:00
catarrh cfc92a5083 move Cards tab after Response parser 2026-08-09 03:01:51 +03:00
catarrh 80c5e0c7c9 Cards tab: move export/import below table, add instruction line, fix closing div 2026-08-09 02:53:49 +03:00
catarrh 7f8bcb59d8 add Cards tab with localStorage persistence, export/import, SP card selector dropdown 2026-08-09 02:43:08 +03:00
catarrh e81fd3205f v1.4.0: STK menu browser, GP APDU builder fixes, response parser auto-populate 2026-08-09 02:06:38 +03:00
catarrh 961befb3f3 hide Back button on root menu; show on display_text/select_item 2026-08-08 23:43:21 +03:00
catarrh 718160b708 STK menu: remove warning, restructure buttons (OK/Back/Cancel/Timeout/Exit), fix double-fetch 2026-08-08 23:38:31 +03:00
catarrh 4dd2eb1956 fix stkCheckMenu placement: move from error path to success path in pysimConnect 2026-08-08 22:01:37 +03:00
catarrh 72ba0c4d87 add STK menu browser: STK menu pill, menu panel with display text/select item support, OK/Back/Cancel/Timeout buttons, pill locking during menu session 2026-08-08 21:45:56 +03:00
catarrh 0386c1b224 fix GP APDU builders: INSTALL P1 values (install-make-sel 0x08, reg-update 0x40, extradition 0x10), GET STATUS P2 labels (0x02/03 are v2.3 current), remove invalid SET STATUS P1 0x60 2026-08-08 20:46:12 +03:00
catarrh 8d823bf408 fix pysimSendOta: populate Response parser from por.decoded (SW + response data), remove broken resp-sw1/sw2 refs; bump to v1.3.2 2026-08-08 14:38:58 +03:00
catarrh 31f962e1f6 ship des.js bundle (des-bundle.js) so static deploys serve the DES lib; bump SW cache to otaman-v4 2026-08-08 13:30:18 +03:00
catarrh fc537a8186 add key-free unit tests for genSp/secured packet (node:test, synthetic + sysmocom vectors) 2026-08-08 13:20:44 +03:00
catarrh c269b6521b v1.3.0: TS 03.48/TS 102 225 genSp — CBC-MAC (ISO 9797-1 alg 2) KID, spec-conformant SP layout, PoR display, verify vs pySim
- replace retailMac() with cbcMac() (zero IV, '00' padding, last 8 bytes) — matches pySim/TS 03.48
- genSp: CPL/CHL/SPI/KIc/KID/TAR/CNTR/PCNTR/CC layout per TS 102 225 + TS 31.115; drop bogus CPI/CHI bytes
- ciphering covers CNTR..end; padding only when ciphering; CC over all but the CC field
- byte-identical output to pySim OtaDialectSms.encode_cmd (verified live vs card)
- Send to Card now reports PoR status/TAR/last SW; new 'Verify vs pySim' button
2026-08-08 13:06:09 +03:00
catarrh 2d3618e9c5 bump version to v1.2.2 2026-08-08 12:18:37 +03:00
catarrh 10360ba17f bump version to v1.2.1 2026-08-08 12:10:09 +03:00
catarrh 5d2c8464f8 bump version to v1.2.0 2026-08-08 11:50:52 +03:00
catarrh 85e4258891 fix secured packet encryption offset, add Send to Card button, pCntr fix 2026-08-08 09:58:38 +03:00