From eafa14e4e573aba050963ba3e4afc008a334c42b Mon Sep 17 00:00:00 2001 From: turbocool3r Date: Fri, 5 Jul 2024 03:00:02 +0300 Subject: [PATCH] Add `hf mfu eview` command. --- software/script/chameleon_cli_unit.py | 27 +++++++++++++++++++++++++++ software/script/chameleon_cmd.py | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/software/script/chameleon_cli_unit.py b/software/script/chameleon_cli_unit.py index c0a1ead7..f0c1085b 100644 --- a/software/script/chameleon_cli_unit.py +++ b/software/script/chameleon_cli_unit.py @@ -1752,6 +1752,33 @@ class HFMFUWRPG(MFUAuthArgsUnit): print(f" - Ok") +@hf_mfu.command('eview') +class HFMFUEVIEW(DeviceRequiredUnit): + def args_parser(self) -> ArgumentParserNoExit: + parser = ArgumentParserNoExit() + parser.description = 'MIFARE Ultralight / NTAG view emulator data' + return parser + + def get_param(self, args): + class Param: + def __init__(self): + pass + + return Param() + + def on_exec(self, args: argparse.Namespace): + param = self.get_param(args) + + nr_pages = self.cmd.mfu_get_emu_pages_count() + page = 0 + while page < nr_pages: + count = min(nr_pages - page, 16) + data = self.cmd.mfu_read_emu_page_data(page, count) + for i in range(0, len(data), 4): + print(f"#{page+(i>>2):02x}: {data[i:i+4].hex()}") + page += count + + @hf_mfu.command('rcnt') class HFMFURCNT(MFUAuthArgsUnit): def args_parser(self) -> ArgumentParserNoExit: diff --git a/software/script/chameleon_cmd.py b/software/script/chameleon_cmd.py index ac46ee69..c38208e3 100644 --- a/software/script/chameleon_cmd.py +++ b/software/script/chameleon_cmd.py @@ -582,7 +582,6 @@ class ChameleonCMD: resp = self.device.send_cmd_sync(Command.MF0_NTAG_READ_EMU_PAGE_DATA, data) if len(resp.data) > 0: resp.parsed = resp.data[0] - print(resp.data) return resp @expect_response(Status.SUCCESS)