2026-09-04 23:14:22 +02:00
|
|
|
# legic_kgh_tool
|
2026-08-19 12:22:30 +02:00
|
|
|
|
|
|
|
|
## Running
|
|
|
|
|
|
2026-09-04 23:14:22 +02:00
|
|
|
`legic_kgh_tool` reads KGH LEGIC card information, badge numbers, and stamps,
|
|
|
|
|
and writes the supported KGH card layout.
|
2026-08-19 12:22:30 +02:00
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-09-04 23:14:22 +02:00
|
|
|
./legic_kgh_tool COM13 read_badge_number
|
|
|
|
|
./legic_kgh_tool COM13 read_info
|
|
|
|
|
./legic_kgh_tool COM13 read_stamp
|
|
|
|
|
./legic_kgh_tool COM13 read_stamp -o stamp.bin
|
|
|
|
|
./legic_kgh_tool COM13 write_card 600001 --stamp-file stamp.bin
|
2026-08-19 12:22:30 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Commands:
|
|
|
|
|
|
|
|
|
|
- `read_badge_number` prints the badge number only.
|
|
|
|
|
- `read_info` prints one-line JSON.
|
2026-08-31 13:14:35 +02:00
|
|
|
- `read_stamp` prints the stamp as 8 hex chars, or writes raw 4 bytes with `-o/--output-file`.
|
2026-09-04 23:14:22 +02:00
|
|
|
- `write_card <badge> (--stamp-file <path> | --stamp-hex <8hex>)` writes the supported KGH layout.
|
2026-08-19 12:22:30 +02:00
|
|
|
|
|
|
|
|
Notes:
|
|
|
|
|
|
|
|
|
|
- Windows ProxSpace examples use `COM13`.
|
|
|
|
|
- The stamp is 4 bytes and specific to your site.
|
2026-09-04 23:14:22 +02:00
|
|
|
It can be specified as a `.bin` file or as `--stamp-hex` (for example, `003EF417`).
|
|
|
|
|
- You can retrieve the stamp from a supported KGH card with `read_info` or `read_stamp`.
|
2026-08-19 12:22:30 +02:00
|
|
|
- Linux examples usually use `/dev/ttyACM0` or similar.
|
|
|
|
|
- `--verbose` can be useful for `read_badge_number` and `write_card`, if they fail for mysterious reasons.
|
|
|
|
|
|
|
|
|
|
## Building in ProxSpace (for Windows)
|
|
|
|
|
|
|
|
|
|
Do this in ProxSpace:
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-09-04 23:14:22 +02:00
|
|
|
cd ~/proxmark3/tools/kgh
|
2026-08-19 12:22:30 +02:00
|
|
|
rm -rf build-lite
|
|
|
|
|
cmake -G "MSYS Makefiles" -S . -B build-lite \
|
|
|
|
|
-DSKIPPYTHON=1 \
|
|
|
|
|
-DSKIPREADLINE=1 \
|
2026-09-04 23:14:22 +02:00
|
|
|
-DSKIPJANSSONSYSTEM=1 \
|
2026-08-19 12:22:30 +02:00
|
|
|
-DSKIPWHEREAMISYSTEM=1 \
|
|
|
|
|
-DSKIPBT=1
|
2026-09-04 23:14:22 +02:00
|
|
|
cmake --build build-lite --target legic_kgh_tool -j
|
|
|
|
|
objdump -p build-lite/legic_kgh_tool.exe | grep -i "DLL Name"
|
2026-08-19 12:22:30 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Building Linux
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-09-04 23:14:22 +02:00
|
|
|
cd tools/kgh
|
2026-08-19 12:22:30 +02:00
|
|
|
rm -rf build-linux
|
|
|
|
|
cmake -S . -B build-linux \
|
|
|
|
|
-DSKIPPYTHON=1 \
|
|
|
|
|
-DSKIPREADLINE=1 \
|
2026-09-04 23:14:22 +02:00
|
|
|
-DSKIPJANSSONSYSTEM=1 \
|
2026-08-19 12:22:30 +02:00
|
|
|
-DSKIPWHEREAMISYSTEM=1 \
|
|
|
|
|
-DSKIPBT=1
|
2026-09-04 23:14:22 +02:00
|
|
|
cmake --build build-linux --target legic_kgh_tool -j
|
|
|
|
|
ldd build-linux/legic_kgh_tool
|
2026-08-19 12:22:30 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Static Link Notes
|
|
|
|
|
|
2026-09-04 23:14:22 +02:00
|
|
|
- `legic_kgh_tool` is linked against `pm3rrg_rdv4_static`.
|
2026-08-19 12:22:30 +02:00
|
|
|
- On MinGW, CMake adds `-static -static-libgcc` for the target.
|
|
|
|
|
- Linux builds are not the same as the ProxSpace single-EXE deployment.
|
|
|
|
|
- If CMakeCache paths change between ProxSpace and a native shell, delete the build dir and reconfigure.
|