Skip to content

Commit

Permalink
CLI: improve keys display in "elog --decrypt"
Browse files Browse the repository at this point in the history
  • Loading branch information
p-l- committed Aug 20, 2024
1 parent b038810 commit 8e80e31
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion software/script/chameleon_cli_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,10 @@ def decrypt_by_list(self, rs: list):
print()
return gen.keys

@staticmethod
def disp_key(key: str):
return f"{key} [{''.join(chr(c) if 31 < c < 127 else '.' for c in bytes.fromhex(key))}]"

def on_exec(self, args: argparse.Namespace):
if not args.decrypt:
count = self.cmd.mf1_get_detection_count()
Expand Down Expand Up @@ -1378,7 +1382,9 @@ def on_exec(self, args: argparse.Namespace):
print(" > Result ---------------------------")
for block, result_for_block in result_maps_for_uid.items():
for type_, results in result_for_block.items():
print(f" > Block {block}, {type_} key result: {results}")
print(f" > Block {block}, {type_} key result:")
for key in sorted(results):
print(f" - {self.disp_key(key)}")


@hf_mf.command('eload')
Expand Down

0 comments on commit 8e80e31

Please sign in to comment.