Accept Proxmark dump uploads, mfc v2 JSON, and key.bin

Parse object-shaped mfc v2 dumps (the format Proxmark writes today) and
let the new-tag form upload dump.json/dump.bin plus an optional binary
hf-mf-*-key.bin instead of only pasting text.
This commit is contained in:
Cursor Agent
2026-08-24 07:12:44 +00:00
parent 21e2592f92
commit 5fcc106a3a
8 changed files with 1184 additions and 91 deletions
+23 -2
View File
@@ -8,7 +8,7 @@ PWA + REST API for storing LF/HF RFID tag dumps organized by site. Use the web U
- Multi-user auth (shared workspace, no RBAC yet) — local password + optional OIDC
- Personal API tokens (Settings UI) for Bearer auth
- Export: JSON, Proxmark, MCT, hex
- Import dumps + full JSON backup
- Import dumps (file upload or paste) + full JSON backup
- Installable PWA with offline read of cached pages
- Vitest unit/integration tests + GitHub Actions CI
@@ -102,7 +102,7 @@ Authenticate with a session cookie **or** `Authorization: Bearer rfid_…` (crea
| GET/PATCH/DELETE | `/api/v1/tags/{id}` | Tag detail |
| PUT | `/api/v1/tags/by-uid/{uid}?siteId=` | Upsert by UID |
| GET | `/api/v1/tags/{id}/export?format=` | `json` \| `proxmark` \| `mct` \| `hex` |
| POST | `/api/v1/tags/import` | Parse dump → create tag |
| POST | `/api/v1/tags/import` | Parse dump → create tag (JSON body or multipart files) |
| GET | `/api/v1/search?q=` | Cross-site search |
| GET/POST | `/api/v1/backup` | Full backup export / import |
| GET/POST | `/api/v1/tokens` | List / create PATs |
@@ -124,8 +124,29 @@ curl -sH "Authorization: Bearer $TOKEN" \
curl -sH "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-X PUT "$HOST/api/v1/tags/by-uid/04A1B2C3?siteId=$SITE" \
-d '{"label":"Dock fob","frequency":"HF","protocol":"MIFARE_CLASSIC_1K","uid":"04A1B2C3","dumpData":{"size":"1K","sectors":[]},"keys":{"A":["FFFFFFFFFFFF"]}}'
# Import a Proxmark dump.json (optional key.bin is binary — use multipart)
curl -sH "Authorization: Bearer $TOKEN" \
-F "siteId=$SITE" \
-F "label=Front door" \
-F "[email protected]" \
-F "[email protected]" \
"$HOST/api/v1/tags/import"
```
### Proxmark files
On **New tag → Import dump** you can upload files or paste JSON:
| File | Typical Proxmark name | Notes |
|------|------------------------|--------|
| Dump JSON | `hf-mf-<UID>-dump.json` | `FileType` `mfc v2` (blocks as an object + `SectorKeys`) or older `mfcard` (blocks array) |
| Binary dump | `hf-mf-<UID>.bin` / `dump.bin` | 1024 bytes (1K) or 4096 bytes (4K) |
| Keys | `hf-mf-<UID>-key.bin` | **Binary**, 12 bytes/sector (192 for 1K, 480 for 4K). Not needed if the JSON already has `SectorKeys`. |
| MCT / EML | `*.mct` / `*.eml` | Text dumps |
Pasting `mfc v2` JSON is supported; older parsers rejected object-shaped `blocks`.
## Tests & CI
```bash