Skip to content

Commit 8e80e31

Browse files
committed
CLI: improve keys display in "elog --decrypt"
1 parent b038810 commit 8e80e31

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

software/script/chameleon_cli_unit.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,10 @@ def decrypt_by_list(self, rs: list):
13351335
print()
13361336
return gen.keys
13371337

1338+
@staticmethod
1339+
def disp_key(key: str):
1340+
return f"{key} [{''.join(chr(c) if 31 < c < 127 else '.' for c in bytes.fromhex(key))}]"
1341+
13381342
def on_exec(self, args: argparse.Namespace):
13391343
if not args.decrypt:
13401344
count = self.cmd.mf1_get_detection_count()
@@ -1378,7 +1382,9 @@ def on_exec(self, args: argparse.Namespace):
13781382
print(" > Result ---------------------------")
13791383
for block, result_for_block in result_maps_for_uid.items():
13801384
for type_, results in result_for_block.items():
1381-
print(f" > Block {block}, {type_} key result: {results}")
1385+
print(f" > Block {block}, {type_} key result:")
1386+
for key in sorted(results):
1387+
print(f" - {self.disp_key(key)}")
13821388

13831389

13841390
@hf_mf.command('eload')

0 commit comments

Comments
 (0)