diff --git a/pm3py/cli/rawcli/identify.py b/pm3py/cli/rawcli/identify.py index 08fc19d..6361151 100644 --- a/pm3py/cli/rawcli/identify.py +++ b/pm3py/cli/rawcli/identify.py @@ -150,7 +150,7 @@ def identify(session, emit=None) -> dict: # always emit ANSI; the app's printer renders it (and strips it off a non-terminal) fmt = TraceFormatter(mode="reader", decoder=_ident_decode, crc_len=0, is_tty=True) for direction, data in _activation_frames(scan): - emit(fmt.format(direction, data).lstrip("\n")) + emit(fmt.format(direction, data).strip("\n")) model, version = None, None if scan.get("sak") == 0x00: # UL/NTAG family — ask GET_VERSION model, version = _probe_version(dev, fmt, emit) @@ -180,14 +180,14 @@ def identify(session, emit=None) -> dict: def _probe_version(dev, fmt, emit) -> tuple[str | None, bytes | None]: """Send a real GET_VERSION (0x60 +CRC), trace the exchange, decode the exact model.""" cmd = b"\x60" - emit(fmt.format(0, cmd).lstrip("\n")) + emit(fmt.format(0, cmd).strip("\n")) resp = _try(lambda: dev.hf.iso14a.raw(cmd, flags=ISO14A_APPEND_CRC), None) raw = resp.get("raw") if isinstance(resp, dict) else None if not raw: return None, None version = bytes(raw[:8]) display = bytes(raw).rstrip(b"\x00") or version # drop the firmware buffer padding - emit(fmt.format(1, display).lstrip("\n")) + emit(fmt.format(1, display).strip("\n")) model = decode_version(version) if model: emit(f" → {model}") diff --git a/pm3py/cli/rawcli/trace_view.py b/pm3py/cli/rawcli/trace_view.py index 1b009fe..8f8b6ab 100644 --- a/pm3py/cli/rawcli/trace_view.py +++ b/pm3py/cli/rawcli/trace_view.py @@ -18,7 +18,7 @@ def render_exchange(command: bytes, response: bytes | None, *, if present, a ``Tag → Reader`` line for ``response``. ``is_tty`` forces/suppresses ANSI.""" decoder, crc_len = _PROTOCOLS.get(protocol, (None, 0)) fmt = TraceFormatter(mode="reader", decoder=decoder, crc_len=crc_len, is_tty=is_tty) - lines = [fmt.format(0, bytes(command)).lstrip("\n")] + lines = [fmt.format(0, bytes(command)).strip("\n")] if response: - lines.append(fmt.format(1, bytes(response)).lstrip("\n")) + lines.append(fmt.format(1, bytes(response)).strip("\n")) return "\n".join(lines)