diff --git a/nxc/modules/wireless.py b/nxc/modules/wireless.py index 199fd834..f477e409 100644 --- a/nxc/modules/wireless.py +++ b/nxc/modules/wireless.py @@ -49,7 +49,7 @@ class NXCModule: conn = DPLootSMBConnection(target) conn.smb_session = connection.conn except Exception as e: - context.log.debug("Could not upgrade connection: {}".format(e)) + context.log.debug(f"Could not upgrade connection: {e}") return masterkeys = [] @@ -57,13 +57,13 @@ class NXCModule: masterkeys_triage = MasterkeysTriage(target=target, conn=conn) masterkeys += masterkeys_triage.triage_system_masterkeys() except Exception as e: - context.log.debug("Could not get masterkeys: {}".format(e)) + context.log.debug(f"Could not get masterkeys: {e}") if len(masterkeys) == 0: context.log.fail("No masterkeys looted") return - context.log.success("Got {} decrypted masterkeys. Looting Wifi interfaces".format(highlight(len(masterkeys)))) + context.log.success(f"Got {highlight(len(masterkeys))} decrypted masterkeys. Looting Wifi interfaces") try: # Collect Chrome Based Browser stored secrets @@ -73,42 +73,20 @@ class NXCModule: context.log.debug("Error while looting wifi: {}".format(e)) for wifi_cred in wifi_creds: if wifi_cred.auth.upper() == "OPEN": - context.log.highlight("[OPEN] %s" % (wifi_cred.ssid)) + context.log.highlight(f"[OPEN] {wifi_cred.ssid}") elif wifi_cred.auth.upper() in ["WPAPSK", "WPA2PSK", "WPA3SAE"]: try: - context.log.highlight( - "[%s] %s - Passphrase: %s" - % ( - wifi_cred.auth.upper(), - wifi_cred.ssid, - wifi_cred.password.decode("latin-1"), - ) - ) - except: - context.log.highlight("[%s] %s - Passphrase: %s" % (wifi_cred.auth.upper(), wifi_cred.ssid, wifi_cred.password)) - elif wifi_cred.auth.upper() in ['WPA', 'WPA2']: + context.log.highlight(f"[{wifi_cred.auth.upper()}] {wifi_cred.ssid} - Passphrase: {wifi_cred.password.decode('latin-1')}") + except Exception: + context.log.highlight(f"[{wifi_cred.auth.upper()}] {wifi_cred.ssid} - Passphrase: {wifi_cred.password}") + elif wifi_cred.auth.upper() in ["WPA", "WPA2"]: try: if self.eap_username is not None and self.eap_password is not None: - context.log.highlight( - "[%s] %s - %s - Identifier: %s:%s" - % ( - wifi_cred.auth.upper(), - wifi_cred.ssid, - wifi_cred.eap_type, - wifi_cred.eap_username, - wifi_cred.eap_password, - ) - ) + context.log.highlight(f"[{wifi_cred.auth.upper()}] {wifi_cred.ssid} - {wifi_cred.eap_type} - Identifier: {wifi_cred.eap_username}:{wifi_cred.eap_password}") else: - context.log.highlight( - "[%s] %s - %s " - % ( - wifi_cred.auth.upper(), - wifi_cred.ssid, - wifi_cred.eap_type, - ) - ) - except: - context.log.highlight("[%s] %s - Passphrase: %s" % (wifi_cred.auth.upper(), wifi_cred.ssid, wifi_cred.password)) + context.log.highlight(f"[{wifi_cred.auth.upper()}] {wifi_cred.ssid} - {wifi_cred.eap_type}") + except Exception: + context.log.highlight( + f"[{wifi_cred.auth.upper()}] {wifi_cred.ssid} - Passphrase: {wifi_cred.password}") else: - context.log.highlight("[WPA-EAP] %s - %s" % (wifi_cred.ssid, wifi_cred.eap_type)) + context.log.highlight(f"[WPA-EAP] {wifi_cred.ssid} - {wifi_cred.eap_type}")