MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / listShares

Method listShares

pager_lib/smb/SMBConnection.py:143–170  ·  view source on GitHub ↗

Retrieve a list of shared resources on remote server. :return: A list of :doc:`smb.base.SharedDevice ` instances describing the shared resource

(self, timeout = 30)

Source from the content-addressed store, hash-verified

141 self.sock = None
142
143 def listShares(self, timeout = 30):
144 """
145 Retrieve a list of shared resources on remote server.
146
147 :return: A list of :doc:`smb.base.SharedDevice<smb_SharedDevice>` instances describing the shared resource
148 """
149 if not self.sock:
150 raise NotConnectedError('Not connected to server')
151
152 results = [ ]
153
154 def cb(entries):
155 self.is_busy = False
156 results.extend(entries)
157
158 def eb(failure):
159 self.is_busy = False
160 raise failure
161
162 self.is_busy = True
163 try:
164 self._listShares(cb, eb, timeout)
165 while self.is_busy:
166 self._pollForNetBIOSPacket(timeout)
167 finally:
168 self.is_busy = False
169
170 return results
171
172 def listPath(self, service_name, path,
173 search = SMB_FILE_ATTRIBUTE_READONLY | SMB_FILE_ATTRIBUTE_HIDDEN | SMB_FILE_ATTRIBUTE_SYSTEM | SMB_FILE_ATTRIBUTE_DIRECTORY | SMB_FILE_ATTRIBUTE_ARCHIVE | SMB_FILE_ATTRIBUTE_INCL_NORMAL,

Callers 2

smb_connectMethod · 0.95
list_sharesMethod · 0.45

Calls 2

_pollForNetBIOSPacketMethod · 0.95
NotConnectedErrorClass · 0.70

Tested by

no test coverage detected