Commit Graph

92 Commits

Author SHA1 Message Date
michael
c1ab980036 refactor: remove all backward-compat shims from sim/
Deletes 24 shim files from sim/. All test imports now point directly
to canonical transponders/ and trace/ paths. sim/ contains only
infrastructure (15 files): frame, memory, transponder ABC, reader ABC,
medium, sim_session, table_compiler, replay, relay, fuzzer, pm3medium,
mcu_bridge, mcu_protocol, dual_session, __init__.

751 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:56:40 -07:00
michael
8e8b945246 refactor: unify sim/trace_fmt.py into trace/ package
Merges the richer sim trace formatter into the shared trace/ package:
- trace/decode_iso14a.py — new, 14443-A request/response decoders
- trace/decode_iso15.py — enhanced with NXP annotations, IC identification,
  GET SYSTEM INFO parsing, decode_15693_nxp()
- trace/format.py — TraceFormatter class (mode-aware, CRC handling,
  SIGWINCH resize) + format_sniff_line convenience wrapper
- sim/trace_fmt.py → backward compat shim importing from trace/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:47:01 -07:00
michael
d777140066 docs: update refactor progress — transponder reorg + activate script
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:41:37 -07:00
michael
1027d187c4 feat: mode-based REPL auto-imports via activate script
source activate          — core (Proxmark3, Cmd, PM3Status, etc.)
source activate sim      — + SimSession, all transponder models
source activate sniff    — + SniffSession, trace decoders
source activate all      — everything

Sets PM3PY_MODE env var and PYTHONSTARTUP for the venv.
Prompt shows current mode: (pm3py:sim)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:40:46 -07:00
michael
18a992f3c7 refactor: reorganize transponder models into pm3py/transponders/
Moves 23 IC-specific files (tag + reader models) from sim/ into
transponders/ organized by standard/manufacturer:
- transponders/hf/iso14443a/ — 14443-A base, MIFARE Classic, DESFire, NDEF
- transponders/hf/iso15693/ — 15693 base, Type5, NXP ICODE/NTAG5 hierarchy
- transponders/lf/ — LF base, EM4100, HID, T5577
- transponders/implants.py — xEM, xNT, xM1, FlexDF, NExT

sim/ retains infrastructure (Medium, RFFrame, SimSession, TableCompiler,
etc.) and backward-compat shims for each moved file. sim/__init__.py now
imports transponder classes from their canonical transponders/ locations.

751 tests passing, zero test changes needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:32:47 -07:00
michael
a7b24dc215 docs: update CLAUDE.md and progress for sim migration
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:05:55 -07:00
michael
668170457e feat: migrate sim framework from worktree to master
Migrates all 43 sim modules and 23 test files (~7.8k LOC, 686 tests)
from .worktrees/sim-framework/ into pm3py/sim/. Import fixes:
- 4 files: ..protocol/..transport → ..core.protocol/..core.transport
- trace_fmt.py: pm3py.hf_15 → pm3py.trace.ndef
- test_sim_pm3medium.py: flat imports → core.*
- test_sim_trace_fmt.py: flat imports → core.*
- Added sim Cmd entries to core/protocol.py (EML_SETMEM, SIM_TABLE_*)

751 tests passing (686 sim + 65 core).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:04:55 -07:00
michael
7fc2470b01 docs: update CLAUDE.md and progress for trace/ package
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:49:59 -07:00
michael
117f46efb9 refactor: create pm3py/trace/ for shared trace infrastructure
Trace buffer parsing, protocol decoders, NDEF annotation, and
formatting are firmware-level features shared by sniff, sim, and
reader modes — not sniff-specific. Moves these from sniff/ into
trace/. sniff/ retains only SniffSession (orchestration) and
re-exports trace symbols for convenience.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:49:20 -07:00
michael
20f5d66f93 docs: update refactor progress — all phases complete
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:46:10 -07:00
michael
7c43a142e6 refactor: extract sniff infrastructure into pm3py/sniff/ sub-package
Phase 2 of package refactor. Extracts trace parsing, ISO 15693
decoders, NDEF annotation, and ANSI formatting from core/hf_iso15.py
into dedicated sniff/ modules:
- sniff/trace.py — parse_tracelog (protocol-agnostic)
- sniff/ndef.py — NDEF TLV/record decode
- sniff/decode_iso15.py — 15693 command/response decoders
- sniff/format.py — ANSI color formatting
- sniff/session.py — SniffSession with iso15() method

core/hf_iso15.py re-exports sniff symbols for backward compat.
Also fixes NTAG 5 placement (iso15693, not iso14443a4) in design doc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:44:54 -07:00
michael
ff8c5d4e73 Merge branch 'refactor/core-package' into master
Merges the package refactor (core/ sub-package, normalized naming,
scaffolded sub-packages) while preserving all in-progress sniff
infrastructure. Git rename detection carried WIP changes to new paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:34:48 -07:00
michael
ca3d4bf31b WIP: sniff infrastructure, transport additions, test coverage
In-progress work — committing before refactor merge so git rename
detection can carry changes to new file locations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:33:10 -07:00
michael
27ae5bd756 refactor: scaffold sniff/, transponders/, reader/, sim/ sub-packages
Phases 2-4 of package refactor. Creates the full directory tree with
__init__.py files per the design doc. Actual code migration from the
sim worktree is a separate effort — models have deep inheritance chains
and auth mixins that need base class extraction first.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:28:55 -07:00
michael
42e6b54f29 refactor: move modules into core/ sub-package, normalize naming
Phase 1 of package refactor. Moves all source modules into pm3py/core/
with file renames (hf_14a→hf_iso14a, hf_15→hf_iso15, hf_mf→hf_mfc)
and client attribute normalization (hf.a14→hf.iso14a, hf.mf→hf.mfc).
pm3py/__init__.py re-exports from core for backward compat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:24:05 -07:00
michael
ab3d37e7b3 docs: sync CLAUDE.md with worktree, fix PYTHON_SIM_DESIGN line count
- Add table compiler match pattern rules to main CLAUDE.md (was only in worktree)
- Update sim framework description (750+ tests, add DNA/NTAG5 to IC list)
- Update "planned" → "in progress" for Python-driven card sim
- Fix firmware patch size: ~320 lines (was inconsistently ~340 on line 49)
2026-03-18 19:07:26 -07:00
michael
75cb3d893d docs: update SLIX2 audit with cross-IC scope corrections 2026-03-18 18:19:59 -07:00
michael
e87b9f1933 docs: SLIX2 command audit against SL2S2602 datasheet
20+ commands audited, gaps identified and prioritized.
Must-haves: GET NXP SYSTEM INFO, READ SIGNATURE, ENABLE PRIVACY,
EAS/AFI password, PROTECT PAGE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 19:49:34 -07:00
michael
5551aee7b1 docs: TableCompiler update implementation plan
4 tasks: update TableEntry to 120-byte format, compile_nxp_icode,
compile_slix2, wire auto-compile into SimSession.start_15693.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 19:25:40 -07:00
michael
453d1cca68 docs: ISO 15693 relay timing findings
Tested retry-based relay and spin-wait approaches. Relay works
mechanically via retry but is unreliable (reader-dependent).
Spin-wait fails due to USB stack latency. Table is the only
viable mechanism for 15693 custom commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:57:23 -07:00
michael
2a56837935 docs: stateful response table firmware implementation plan
9 tasks: command IDs, iso15_tag_t extensions, sim_crypto, sim_table
header + implementation, appmain dispatch, native handler access
control + random UID, table fallback in default case, full build.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:00:42 -07:00
michael
518b924b01 docs: stateful response table firmware design
Covers: sim_table entry structure with EML actions and group-based
state machine, AES-CMAC for TAM/MAM, native handler access control,
14443-A integration, timing budget analysis.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 16:50:11 -07:00
michael
f9dc17cf98 chore: add .worktrees/ to .gitignore
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:06:17 -07:00
michael
2660b9cdb0 docs: add README.md and CLAUDE.md 2026-03-16 21:23:34 -07:00
michael
01c76c29f7 feat(pm3py): lf.search() returns LFSearchResult with callable next steps and sample download 2026-03-16 00:29:05 -07:00
michael
18817f75d3 fix(pm3py): on=False now correctly turns LEDs off instead of on 2026-03-16 00:25:36 -07:00
michael
a91d862647 fix(pm3py): platform-aware LED color mapping (Easy vs RDV4 have different physical layouts) 2026-03-16 00:22:43 -07:00
michael
cc7dfa89de feat(pm3py): validate PWM LED capability using device capabilities, raise on non-PWM LEDs 2026-03-16 00:20:47 -07:00
michael
e934eee676 fix(pm3py): LED return echoes what was sent instead of meaningless status int 2026-03-16 00:16:34 -07:00
michael
8cce7eeba3 feat(pm3py): LED API with color names and keyword actions (on/off/pulse/fade/blink/brightness) 2026-03-16 00:13:50 -07:00
michael
29bfccfb41 feat(pm3py): auto-detect proxmark3 port when none specified 2026-03-16 00:10:50 -07:00
michael
205e9b7993 feat(pm3py): add Proxmark3.sync() for REPL/script usage without async boilerplate 2026-03-16 00:09:14 -07:00
michael
8c0a57525a chore: remove venv from tracking, add to gitignore 2026-03-16 00:04:44 -07:00
michael
c015082b41 fix(pm3py): disable CRC for USB (matching C client), fix CRC byte order for FPC UART 2026-03-16 00:03:23 -07:00
michael
d9ec661d06 feat(pm3py): soft firmware compatibility check on connect (ping + version probe) 2026-03-15 22:25:37 -07:00
michael
fec04acc23 feat(pm3py): integration tests and final API wiring 2026-03-15 22:19:00 -07:00
michael
31a6036cd3 feat(pm3py): ISO15693 + MIFARE Classic commands 2026-03-15 22:18:11 -07:00
michael
2f88fabde6 feat(pm3py): HF core + ISO14443A commands 2026-03-15 22:16:54 -07:00
michael
95133843a4 feat(pm3py): LF commands (tune, read, sniff, sim, config, search, t55xx) 2026-03-15 22:15:51 -07:00
michael
10761b1d5f feat(pm3py): client shell and hw commands (ping, version, status, led, tune, etc) 2026-03-15 22:14:12 -07:00
michael
03569d2361 feat(pm3py): transport layer with NG/MIX frame encoding and async serial I/O 2026-03-15 22:12:53 -07:00
michael
22dc438464 feat(pm3py): project scaffolding with CRC-16/A and protocol constants 2026-03-15 22:11:38 -07:00