Python Forum
How to run a file with smb.py!! - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: How to run a file with smb.py!! (/thread-6089.html)



How to run a file with smb.py!! - cscacsa - Nov-05-2017

Hi. how i can use smb.py and smbConnection.py from impacket to run a file?
I'm looking for something like:
dir = smbConn.connectTree('C$')
smbConn.openFile(dir,  '/picture.jpg')
when i use help show me this:

Help on method openFile in module impacket.smbconnection:

openFile(self, treeId, pathName, desiredAccess=3, shareMode=1, creationOption=64, creationDisposition=1, fileAttributes=128, impersonationLevel=2, securityFlags=0, oplockLevel=0, createContexts=None) method of impacket.smbconnection.SMBConnection instance
opens a remote file

:param HANDLE treeId: a valid handle for the share where the file is to be opened
:param string pathName: the path name to open
:return: a valid file descriptor, if not raises a SessionError exception.

please explain with example. Rolleyes


RE: How to run a file with smb.py!! - cscacsa - Nov-07-2017

Sad Sad Sad So how you can explain this Help?!!!!

Help on method openFile in module impacket.smbconnection:

openFile(self, treeId, pathName, desiredAccess=3, shareMode=1, creationOption=64, creationDisposition=1, fileAttributes=128, impersonationLevel=2, securityFlags=0, oplockLevel=0, createContexts=None) method of impacket.smbconnection.SMBConnection instance
opens a remote file

:param HANDLE treeId: a valid handle for the share where the file is to be opened
:param string pathName: the path name to open
:return: a valid file descriptor, if not raises a SessionError exception.