diff --git a/software/script/chameleon_cli_main.py b/software/script/chameleon_cli_main.py index beec2630..337ca142 100755 --- a/software/script/chameleon_cli_main.py +++ b/software/script/chameleon_cli_main.py @@ -94,6 +94,7 @@ def startCLI(self): 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: diff --git a/software/script/chameleon_cli_unit.py b/software/script/chameleon_cli_unit.py index ec6b5b48..3c7f7956 100644 --- a/software/script/chameleon_cli_unit.py +++ b/software/script/chameleon_cli_unit.py @@ -37,12 +37,21 @@ 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: