mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
cli: check if helper tools are available
This commit is contained in:
@@ -94,6 +94,7 @@ class ChameleonCLI:
|
||||
raise Exception("This script requires at least Python 3.9")
|
||||
|
||||
self.print_banner()
|
||||
chameleon_cli_unit.check_tools()
|
||||
cmd_strs = []
|
||||
while True:
|
||||
if cmd_strs:
|
||||
|
||||
@@ -37,12 +37,21 @@ type_id_SAK_dict = {0x00: "MIFARE Ultralight Classic/C/EV1/Nano | NTAG 2xx",
|
||||
0x38: "SmartMX with MIFARE Classic 4K",
|
||||
}
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
# in pyinstaller
|
||||
default_cwd = str(Path(sys._MEIPASS) / "bin")
|
||||
default_cwd = Path.cwd() / Path(sys._MEIPASS) / "bin"
|
||||
else:
|
||||
# from source
|
||||
default_cwd = str(Path(__file__).parent.parent / "bin")
|
||||
default_cwd = Path.cwd() / Path(__file__).parent.parent / "bin"
|
||||
|
||||
|
||||
def check_tools():
|
||||
tools = ['staticnested', 'nested', 'darkside', 'mfkey32v2']
|
||||
if sys.platform == "win32":
|
||||
tools = [x+'.exe' for x in tools]
|
||||
missing_tools = [tool for tool in tools if not (default_cwd / tool).exists()]
|
||||
if len(missing_tools) > 0:
|
||||
print(f'{CR}Warning, tools {", ".join(missing_tools)} not found. Corresponding commands will not work as intended.{C0}')
|
||||
|
||||
|
||||
class BaseCLIUnit:
|
||||
|
||||
Reference in New Issue
Block a user