mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
cli: hf mf econfig, hf mfu econfig (wip), fix dumphelp
This commit is contained in:
@@ -44,20 +44,22 @@ BANNER = """
|
||||
|
||||
|
||||
def dump_help(cmd_node, depth=0, dump_cmd_groups=False, dump_description=False):
|
||||
visual_col1_width = 28
|
||||
col1_width = visual_col1_width + len(f"{CG}{C0}")
|
||||
if cmd_node.cls:
|
||||
cmd_title = f"{CG}{cmd_node.fullname}{C0}"
|
||||
if dump_description:
|
||||
print(f" {cmd_title}".ljust(37) + f"{cmd_node.help_text}")
|
||||
print(f" {cmd_title}".ljust(col1_width) + f"{cmd_node.help_text}")
|
||||
else:
|
||||
print(f" {cmd_title}".ljust(37), end="")
|
||||
print(f" {cmd_title}".ljust(col1_width), end="")
|
||||
p = cmd_node.cls().args_parser()
|
||||
assert p is not None
|
||||
p.prog = ""
|
||||
usage = p.format_usage().removeprefix("usage: ").rstrip()
|
||||
p.prog = " " * (visual_col1_width - len("usage: ") - 1)
|
||||
usage = p.format_usage().removeprefix("usage: ").strip()
|
||||
if usage != "[-h]":
|
||||
usage = usage.removeprefix("[-h] ")
|
||||
if dump_description:
|
||||
print(f"{CG}{C0}".ljust(37), end="")
|
||||
print(f"{CG}{C0}".ljust(col1_width), end="")
|
||||
print(f"{CY}{usage}{C0}")
|
||||
else:
|
||||
print("")
|
||||
@@ -65,7 +67,7 @@ def dump_help(cmd_node, depth=0, dump_cmd_groups=False, dump_description=False):
|
||||
if dump_cmd_groups:
|
||||
cmd_title = f"{CY}{cmd_node.fullname}{C0}"
|
||||
if dump_description:
|
||||
print(f" {cmd_title}".ljust(37) + f"{{ {cmd_node.help_text}... }}")
|
||||
print(f" {cmd_title}".ljust(col1_width) + f"{{ {cmd_node.help_text}... }}")
|
||||
else:
|
||||
print(f" {cmd_title}")
|
||||
for child in cmd_node.children:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -259,8 +259,10 @@ class MifareClassicWriteMode(enum.IntEnum):
|
||||
SHADOW_REQ = 4
|
||||
|
||||
@staticmethod
|
||||
def list():
|
||||
return list(map(int, MifareClassicWriteMode))
|
||||
def list(exclude_meta=True):
|
||||
return [m for m in MifareClassicWriteMode
|
||||
if m != MifareClassicWriteMode.SHADOW_REQ
|
||||
or not exclude_meta]
|
||||
|
||||
def __str__(self):
|
||||
if self == MifareClassicWriteMode.NORMAL:
|
||||
@@ -285,10 +287,6 @@ class MifareClassicPrngType(enum.IntEnum):
|
||||
# the random number of the card response is unpredictable
|
||||
HARD = 2
|
||||
|
||||
@staticmethod
|
||||
def list():
|
||||
return list(map(int, MifareClassicPrngType))
|
||||
|
||||
def __str__(self):
|
||||
if self == MifareClassicPrngType.STATIC:
|
||||
return "Static"
|
||||
@@ -311,10 +309,6 @@ class MifareClassicDarksideStatus(enum.IntEnum):
|
||||
# Darkside running, can't change tag
|
||||
TAG_CHANGED = 4
|
||||
|
||||
@staticmethod
|
||||
def list():
|
||||
return list(map(int, MifareClassicDarksideStatus))
|
||||
|
||||
def __str__(self):
|
||||
if self == MifareClassicDarksideStatus.OK:
|
||||
return "Success"
|
||||
@@ -377,10 +371,6 @@ class ButtonPressFunction(enum.IntEnum):
|
||||
return "Show Battery Level"
|
||||
return "None"
|
||||
|
||||
@staticmethod
|
||||
def from_int(val):
|
||||
return ButtonPressFunction(val)
|
||||
|
||||
|
||||
class ChameleonCMD:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user