diff --git a/tools/pm3trace_edit.py b/tools/pm3_edit_trace.py old mode 100644 new mode 100755 similarity index 97% rename from tools/pm3trace_edit.py rename to tools/pm3_edit_trace.py index bf27031b7..299aedeaf --- a/tools/pm3trace_edit.py +++ b/tools/pm3_edit_trace.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -pm3trace_edit.py — Proxmark3 binary trace file editor +pm3_edit_trace.py — Proxmark3 binary trace file editor Binary record format (tracelog_hdr_t, include/pm3_cmd.h): [4] timestamp uint32 LE — carrier periods (14a/thinfilm), ETU (hitag), etc. @@ -10,8 +10,8 @@ Binary record format (tracelog_hdr_t, include/pm3_cmd.h): [P] parity ceil(data_len/8) bytes, bit j of byte i = odd-parity of data[i*8+j] Usage: - python3 pm3trace_edit.py # interactive editor - python3 pm3trace_edit.py --dump # dump to stdout and exit + python3 pm3_edit_trace.py # interactive editor + python3 pm3_edit_trace.py --dump # dump to stdout and exit Interactive commands: l / list [N] list all frames, or frame N only @@ -150,14 +150,20 @@ def serialise_trace(frames: list[Frame]) -> bytes: HEADER = ( f"{'#':>5} {'Timestamp':>10} {'Dur':>6} {'Src':>3} " - f"{'Data (hex)':<50} {'Par':>3}" + f"{'Data (hex)':<50}" ) SEP = '-' * len(HEADER) +# reader lines in yellow, when stdout is a terminal +YELLOW = '\033[33m' if sys.stdout.isatty() else '' +RESET = '\033[0m' if sys.stdout.isatty() else '' + def print_frame(idx: int, f: Frame) -> None: - print(f'{idx:>5} {f.timestamp:>10} {f.duration:>6} {f.src:>3} ' - f'{f.data_hex():<50} {f.parity_status:>3}') + colour = '' if f.is_response else YELLOW + reset = '' if f.is_response else RESET + print(f'{colour}{idx:>5} {f.timestamp:>10} {f.duration:>6} {f.src:>3} ' + f'{f.data_hex():<50}{reset}') def cmd_list(frames: list[Frame], args: list[str]) -> None: diff --git a/traces/README.md b/traces/README.md index 7c2a84e5f..db0ac32e0 100644 --- a/traces/README.md +++ b/traces/README.md @@ -113,3 +113,17 @@ |--------|-----------| |lf_hitag_crypto_dump.trace |Execution of `lf hitag dump --crypto` against Hitag2 card in crypto mode| + +## LF emulator dumps + +Tag images for `lf hitag eload`, used to simulate a Hitag 2 in each of its +operating modes. Byte 0 of page 3 is the configuration byte that selects the +mode, so the files differ mainly in that one byte. + +|filename|description| +|--------|-----------| +|lf-hitag-CE129911-dump.bin |Hitag2 in password mode (config `0x06`), password `BDF5E846`| +|lf_ht2_crypto.bin |Hitag2 in crypto mode (config `0x0E`), key `4F4EBDF5E846`| +|lf_ht2_publicA.bin |Hitag2 in Public Mode A (config `0x02`), Manchester, pages 4-5, carries an EM4102 payload| +|lf_ht2_publicB.bin |Hitag2 in Public Mode B (config `0x00`), biphase 32 T0, pages 4-7| +|lf_ht2_publicC.bin |Hitag2 in Public Mode C (config `0x04`), biphase 64 T0, pages 4-7| diff --git a/traces/lf_ht2_crypto.bin b/traces/lf_ht2_crypto.bin new file mode 100644 index 000000000..d2d4b9700 Binary files /dev/null and b/traces/lf_ht2_crypto.bin differ diff --git a/traces/lf_ht2_publicA.bin b/traces/lf_ht2_publicA.bin new file mode 100644 index 000000000..12f957793 Binary files /dev/null and b/traces/lf_ht2_publicA.bin differ diff --git a/traces/lf_ht2_publicB.bin b/traces/lf_ht2_publicB.bin new file mode 100644 index 000000000..eec56b3ec Binary files /dev/null and b/traces/lf_ht2_publicB.bin differ diff --git a/traces/lf_ht2_publicC.bin b/traces/lf_ht2_publicC.bin new file mode 100644 index 000000000..3d9bf7b43 Binary files /dev/null and b/traces/lf_ht2_publicC.bin differ diff --git a/traces/lf_ht2_pwd_sniff.trace b/traces/lf_ht2_pwd_sniff.trace new file mode 100644 index 000000000..a44475465 Binary files /dev/null and b/traces/lf_ht2_pwd_sniff.trace differ