I am using Ubuntu 16.04 and am using WMI-CLient-Wrapper module to connect to a remote Windows Machine and send an executable to it(eg. Process Explorer) and further execute it and collect the logs it creates and fetch them back to my Linux Machine for further processing. Using WMI CLient Wrapper is the only option available as WMI Module doesn’t work with Linux.
I am able to send the file to the remote Windows machine, by establishing a connection using WMI-Client-Wrapper and SMB File Transfer Mechanism. After that when I try to create a Process for the same and try to execute that process it gives me an error stating that some of the attributes that WMI actually has, are not supported by WMI client Wrapper.
What I tried
import os import wmi_client_wrapper as wmic from socket import * import time wmic = wmic.WmiClientWrapper( host ="192.168.115.128", username = "LegalWrongDoer", password = "sasuke14" ) SW_SHOWNORMAL = 1 str = "smbclient //192.168.115.128/C$ -U LegalWrongDoer%sasuke14 -c \'put \"procexp64.exe\"\'" os.system(str) print("Folder sent") process_startup = wmic.Win32_ProcessStartup.new() process_startup.ShowWindow = SW_SHOWNORMAL process_id, result = wmic.Win32_Process.Create(CommandLine="C:/procexp64.exe", ProcessStartupInformation=process_startup) process_startup.ShowWindow = SW_SHOWNORMAL if result == 0: print("Process started successfully") else: print("Sorry, but can't execute Process!")
When I run this python file, it gives me the output to the initial query I make. But the Process_StartUp fails.
Further Traceback Calls:
Traceback (most recent call last): File "WMIClient.py", line 22, in <module> process_startup = wmic.Win32_ProcessStartup.new() AttributeError: 'WmiClientWrapper' object has no attribute 'Win32_ProcessStartup'
I’d be extremely grateful if anyone of you can be able to help me through this. Thanks in advance 🙂