From 615a438003b685a820226e941e5a55d2e7d65421 Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Mon, 21 Jul 2025 22:42:16 +0200 Subject: [PATCH] Changed compatibility --- meshbook.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/meshbook.py b/meshbook.py index 56c25a3..32184c4 100644 --- a/meshbook.py +++ b/meshbook.py @@ -21,22 +21,22 @@ async def init_connection(credentials: dict) -> meshctrl.Session: Use the libmeshctrl library to initiate a Secure Websocket (wss) connection to the MeshCentral instance. ''' - if configuration["totp_secret"]: - totp = pyotp.TOTP(configuration["totp_secret"]) - otp = totp.now() - - session = meshctrl.Session( - configuration['hostname'], - user=configuration['username'], - password=configuration['password'], - token=otp - ) - else: - session = meshctrl.Session( - configuration['hostname'], - user=configuration['username'], - password=configuration['password'] - ) + if "totp_secret" in credentials: + totp = pyotp.TOTP(credentials["totp_secret"]) + otp = totp.now() + + session = meshctrl.Session( + credentials['hostname'], + user=credentials['username'], + password=credentials['password'], + token=otp + ) + else: + session = meshctrl.Session( + credentials['hostname'], + user=credentials['username'], + password=credentials['password'] + ) await session.initialized.wait() return session @@ -181,7 +181,7 @@ async def main(): console.nice_print(args, console.text_color.reset + "MeshBook Version: " + console.text_color.yellow + str(meshbook_version)) return - + if not args.meshbook: parser.print_help() return @@ -216,7 +216,7 @@ async def main(): else: console.nice_print(args, "Target Operating System category given: " + console.text_color.yellow + "All" + console.text_color.reset + ".") - + # Should Meshbook ignore categorisation? if "ignore_categorisation" in meshbook: console.nice_print(args, @@ -230,7 +230,7 @@ async def main(): else: console.nice_print(args, "Ignore the OS Categorisation file: " + console.text_color.yellow + "False" + console.text_color.reset + ".") - + # TARGET TAG PRINTING if "target_tag" in meshbook: console.nice_print(args,