HID SAM: Seader style downgrades, hf mf sam, hf mfdes sam, wiegand downgrade

Bring the SAM commands to parity with Seader's (bettse/seader, GPLv3)
read and save options:

- hf mf sam: MIFARE Classic SE via CMD_HF_SAM_MFC
- hf mfdes sam: DESFire EV1/EV2 via CMD_HF_SAM_SEOS, as Seader drives it
- --dg legacy|sr|prox|mfc and --save on hf iclass / seos / mf / mfdes sam
- wiegand downgrade: the same outputs offline, from a saved credential
  or PACS bits, plus --selftest

Outputs follow seader_credential.c:
- legacy / sr: 20 block iCLASS dump, Seader's config, epurse, Kd from the
  HID standard key, block 6 03030303 0003E014 (A3 for SR, PACS left
  unencrypted), PACS in block 7, SR SIO in blocks 10-17. A CSN read from
  iCLASS is kept, anything else gets Seader's fake CSN 7AF53113FEFF12E0.
- mfc: 1K dump with Seader's block 0, MAD, HID sector 1 keys and PACS in
  block 5, the layout hf mf encodehid writes.
- prox: lf hid clone --bin, and -w H10301 for 26 bits as Seader does.
- --save: a "hid credential" JSON with PACS, bits, UID, SIO, media type.

The PACS parsing hf iclass sam and hf seos sam each had a copy of moves
to hidsio.c; hf seos sam is now the shared ISO14443-A command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
iceman1001andClaude Opus 5.5 committed 2026-11-10 10:23:51 +07:00
1 parent fb193860e8
commit b077bf263d
9 files changed
+1019 -230

No files matched your search

+3
View File
@@ -571,6 +571,9 @@ while true; do
if ! CheckExecute "wiegand Verkada40 decode test 3" "$CLIENTBIN -c 'wiegand decode --raw 8A20002721'" "Verkada40.*FC: 81 CN: 5008 parity \( ok \)"; then break; fi
if ! CheckExecute "wiegand IR56 encode roundtrip" "$CLIENTBIN -c 'wiegand encode -w IR56 --fc 123 --cn 123 --pre'" "9E000000100007B0000007B"; then break; fi
if ! CheckExecute "wiegand IR56 decode roundtrip" "$CLIENTBIN -c 'wiegand decode --raw 9E000000100007B0000007B'" "IR56.*FC: 123 CN: 123"; then break; fi
if ! CheckExecute "wiegand downgrade selftest" "$CLIENTBIN -c 'wiegand downgrade --selftest'" "Tests \( ok \)"; then break; fi
if ! CheckExecute "wiegand downgrade prox" "$CLIENTBIN -c 'wiegand downgrade --new 068F80A8C0 --dg prox'" "lf hid clone -w H10301 --fc 31 --cn 337"; then break; fi
if ! CheckExecute "wiegand downgrade sr needs sio" "$CLIENTBIN -c 'wiegand downgrade --new 068F80A8C0 --dg sr'" "iCLASS SR needs a SIO"; then break; fi
echo -e "\n${C_BLUE}Testing LF:${C_NC}"
if ! CheckExecute "lf hitag2 test" "$CLIENTBIN -c 'lf hitag test'" "Tests \( ok"; then break; fi