How can I use smb.py and smbConnection.py
from impacket to run a file? I\'m looking for something like:
dir = smbConn.connectTree(\'C$\')
smbConn.op
The SMB Protocol (in all its version) doesn't provide functionality to execute files at the remote systems. Its main objective is to support the sharing of file and print resource between machines.
There are several approaches for executing files remotely on Windows machines. Some of these approaches include the following techniques:
1) https://github.com/CoreSecurity/impacket/blob/master/examples/wmiexec.py: Calling WMI Win32_Process.Create()
2) https://github.com/CoreSecurity/impacket/blob/master/examples/atexec.py: Using the Windows Task Scheduler remotely.
3) https://github.com/CoreSecurity/impacket/blob/master/examples/smbexec.py: Creates a Windows Service with the command string to execute.
4) https://github.com/CoreSecurity/impacket/blob/master/examples/psexec.py: Uploads a Windows Service that provides a remote shell capability.
5) https://github.com/CoreSecurity/impacket/blob/master/examples/mmcexec.py: Executes files remotely through the MMC DCOM Object.
Although there are several more (and constantly newer ones discovered).