parent
e6d44f9827
commit
21bc978f45
|
@ -83,12 +83,10 @@ class CMEModule:
|
|||
context.log.fail(f"Enable RDP via smb error: {str(e)}")
|
||||
elif self.method == "wmi":
|
||||
context.log.info("Executing over WMI(ncacn_ip_tcp)")
|
||||
try:
|
||||
wmi_rdp = rdp_WMI(context, connection, self.dcom_timeout)
|
||||
except:
|
||||
pass
|
||||
|
||||
if "wmi_rdp" in locals() and hasattr(wmi_rdp, '_rdp_WMI__iWbemLevel1Login'):
|
||||
wmi_rdp = rdp_WMI(context, connection, self.dcom_timeout)
|
||||
|
||||
if hasattr(wmi_rdp, '_rdp_WMI__iWbemLevel1Login'):
|
||||
if "ram" in self.action:
|
||||
# Nt version under 6 not support RAM.
|
||||
try:
|
||||
|
@ -259,7 +257,8 @@ class rdp_WMI:
|
|||
self.__iWbemLevel1Login = wmi.IWbemLevel1Login(iInterface)
|
||||
except Exception as e:
|
||||
self.logger.fail(f'Unexpected wmi error: {str(e)}, please try to use "-o" with "METHOD=smb"')
|
||||
self.__dcom.disconnect()
|
||||
if self.__iWbemLevel1Login in locals():
|
||||
self.__dcom.disconnect()
|
||||
|
||||
def rdp_Wrapper(self, action, old=False):
|
||||
if old == False:
|
||||
|
|
|
@ -1248,7 +1248,8 @@ class smb(connection):
|
|||
iEnumWbemClassObject = iWbemServices.ExecQuery(wmi_query)
|
||||
except Exception as e:
|
||||
self.logger.fail('Execute WQL error: {}'.format(e))
|
||||
dcom.disconnect()
|
||||
if "iWbemLevel1Login" in locals():
|
||||
dcom.disconnect()
|
||||
else:
|
||||
self.logger.info(f"Executing WQL syntax: {wmi_query}")
|
||||
while True:
|
||||
|
|
Loading…
Reference in New Issue