WMIExec - Set Of Python Scripts Which Perform Different Ways Of Command Execution Via WMI Protocol
Set of python scripts which perform different ways of command execution via WMI protocol.
Blog Post
https://whiteknightlabs.com/2023/06/26/navigating-stealthy-wmi-lateral-movement/
Usage
wmiexec_scheduledjob.py
Is a python script which authenticates to a remote WMI instance and execute commands via Scheduled Tasks.
To run the script:
python3 wmiexec_scheduledjob.py -i <ip_address> -u <username> -p <password> -c <command>
wmiexec_win32process.py
Is a python script which authenticates to a remote WMI instance and execute commands via Win32_Process
.
To run the script:
python3 wmiexec_win32process.py -i <ip_address> -u <username> -p <password> -c <command>
webserver_ssl.py
Is a python script which creates a HTTPS server (with a self-signed SSL certificate). Used to exfiltrate the command's output.
Before running the HTTP server, make sure to generate the certificates by running:
openssl genpkey -algorithm RSA -out server.keyopenssl req -new -key server.key -out server.csropenssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
If everything is done correctly, the server will be running without any error:
python3 webserver_ssl.py
Credits
https://github.com/XiaoliChan/wmiexec-RegOut
https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-scheduledjob
Author
Kleiton Kurti (@kleiton0x00)
Source: www.kitploit.com
![WMIExec - Set Of Python Scripts Which Perform Different Ways Of Command Execution Via WMI Protocol](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqa6SB_Zsl6zloKm7R8-TaZCoh9M8TT8xbGQsFHNmoJZTo6XFvc75azvWJH1mVZ5OE6C_x6jtAKz3qfoyDrrnKHNYcteFFib-24JuEH2JlbaZNVjMOJ9I7M1IGLwAtjTCzxsJMO7d3WanMmzEaUX6yyQMqs4ifbL5CWK3F0xHbKYzdBjg1zAZv7SCqA4Lx/s72-w640-c-h318/WMIExec.png)