MCPcopy Index your code
hub / github.com/secdev/scapy / SMB_Server

Class SMB_Server

scapy/layers/smbserver.py:198–1640  ·  view source on GitHub ↗

SMB server automaton :param shares: the shares to serve. By default, share nothing. Note that IPC$ is appended. :param ssp: the SSP to use All other options (in caps) are optional, and SMB specific: :param ANONYMOUS_LOGIN: mark the clients as anonymous

Source from the content-addressed store, hash-verified

196
197
198class SMB_Server(Automaton):
199 """
200 SMB server automaton
201
202 :param shares: the shares to serve. By default, share nothing.
203 Note that IPC$ is appended.
204 :param ssp: the SSP to use
205
206 All other options (in caps) are optional, and SMB specific:
207
208 :param ANONYMOUS_LOGIN: mark the clients as anonymous
209 :param GUEST_LOGIN: mark the clients as guest
210 :param REQUIRE_SIGNATURE: set 'Require Signature'
211 :param REQUIRE_ENCRYPTION: globally require encryption.
212 You could also make it share-specific on 3.1.1.
213 :param MAX_DIALECT: maximum SMB dialect. Defaults to 0x0311 (3.1.1)
214 :param TREE_SHARE_FLAGS: flags to announce on Tree_Connect_Response
215 :param TREE_CAPABILITIES: capabilities to announce on Tree_Connect_Response
216 :param TREE_MAXIMAL_ACCESS: maximal access to announce on Tree_Connect_Response
217 :param FILE_MAXIMAL_ACCESS: maximal access to announce in MxAc Create Context
218 """
219
220 pkt_cls = DirectTCP
221 socketcls = SMBStreamSocket
222
223 def __init__(self, shares=[], ssp=None, verb=True, readonly=True, *args, **kwargs):
224 self.verb = verb
225 if "sock" not in kwargs:
226 raise ValueError(
227 "SMB_Server cannot be started directly ! Use SMB_Server.spawn"
228 )
229 # Various SMB server arguments
230 self.ANONYMOUS_LOGIN = kwargs.pop("ANONYMOUS_LOGIN", False)
231 self.GUEST_LOGIN = kwargs.pop("GUEST_LOGIN", None)
232 self.EXTENDED_SECURITY = kwargs.pop("EXTENDED_SECURITY", True)
233 self.USE_SMB1 = kwargs.pop("USE_SMB1", False)
234 self.REQUIRE_SIGNATURE = kwargs.pop("REQUIRE_SIGNATURE", None)
235 self.REQUIRE_ENCRYPTION = kwargs.pop("REQUIRE_ENCRYPTION", False)
236 self.MAX_DIALECT = kwargs.pop("MAX_DIALECT", 0x0311)
237 self.TREE_SHARE_FLAGS = kwargs.pop(
238 "TREE_SHARE_FLAGS", "FORCE_LEVELII_OPLOCK+RESTRICT_EXCLUSIVE_OPENS"
239 )
240 self.TREE_CAPABILITIES = kwargs.pop("TREE_CAPABILITIES", 0)
241 self.TREE_MAXIMAL_ACCESS = kwargs.pop(
242 "TREE_MAXIMAL_ACCESS",
243 "+".join(
244 [
245 "FILE_READ_DATA",
246 "FILE_WRITE_DATA",
247 "FILE_APPEND_DATA",
248 "FILE_READ_EA",
249 "FILE_WRITE_EA",
250 "FILE_EXECUTE",
251 "FILE_DELETE_CHILD",
252 "FILE_READ_ATTRIBUTES",
253 "FILE_WRITE_ATTRIBUTES",
254 "DELETE",
255 "READ_CONTROL",

Callers

nothing calls this directly

Calls 1

SMB2_FILEIDClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…