From 3fb7412b7af03b9005e9d041c86048344a74197a Mon Sep 17 00:00:00 2001 From: XiaoliChan <2209553467@qq.com> Date: Tue, 22 Aug 2023 21:10:04 +0800 Subject: [PATCH] [smb] RDP module - bug fix I Signed-off-by: XiaoliChan <2209553467@qq.com> --- cme/modules/rdp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cme/modules/rdp.py b/cme/modules/rdp.py index a8c9e538..736387d6 100644 --- a/cme/modules/rdp.py +++ b/cme/modules/rdp.py @@ -86,8 +86,8 @@ class CMEModule: except Exception as e: context.log.fail(f"Unexpected wmi error: {str(e)}") wmi_rdp._rdp_WMI__dcom.disconnect() - - if wmi_rdp: + + if hasattr(wmi_rdp, '_rdp_WMI__iWbemLevel1Login'): if "ram" in self.action: # Nt version under 6 not support RAM. try: @@ -98,7 +98,7 @@ class CMEModule: else: context.log.fail(str(e)) pass - wmi_rdp._rdp_WMI__dcom.disconnect() + wmi_rdp._rdp_WMI__dcom.disconnect() else: try: wmi_rdp.rdp_Wrapper(self.action, self.oldSystem) @@ -237,7 +237,7 @@ class rdp_WMI: self.logger.fail(f'WMIEXEC: Dcom initialization failed on connection with stringbinding: "{self.__stringBinding}", please increase the timeout with the module option "DCOM-TIMEOUT=10". If it\'s still failing maybe something is blocking the RPC connection, try "METHOD=smb"') # Make it force break function self.__dcom.disconnect() - return False + return self.__iWbemLevel1Login = wmi.IWbemLevel1Login(iInterface) def rdp_Wrapper(self, action, old=False):