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

Method __init__

scapy/layers/smbclient.py:131–182  ·  view source on GitHub ↗
(self, sock, ssp=None, *args, **kwargs)

Source from the content-addressed store, hash-verified

129 cls = DirectTCP
130
131 def __init__(self, sock, ssp=None, *args, **kwargs):
132 # Various SMB client arguments
133 self.EXTENDED_SECURITY = kwargs.pop("EXTENDED_SECURITY", True)
134 self.USE_SMB1 = kwargs.pop("USE_SMB1", False)
135 self.REQUIRE_SIGNATURE = kwargs.pop("REQUIRE_SIGNATURE", None)
136 self.REQUIRE_ENCRYPTION = kwargs.pop("REQUIRE_ENCRYPTION", False)
137 self.RETRY = kwargs.pop("RETRY", 0) # optionally: retry n times session setup
138 self.SMB2 = kwargs.pop("SMB2", False) # optionally: start directly in SMB2
139 self.HOST = kwargs.pop("HOST", "")
140 # Store supported dialects
141 if "DIALECTS" in kwargs:
142 self.DIALECTS = kwargs.pop("DIALECTS")
143 else:
144 MIN_DIALECT = kwargs.pop("MIN_DIALECT", 0x0202)
145 self.MAX_DIALECT = kwargs.pop("MAX_DIALECT", 0x0311)
146 self.DIALECTS = sorted(
147 [
148 x
149 for x in [0x0202, 0x0210, 0x0300, 0x0302, 0x0311]
150 if x >= MIN_DIALECT and x <= self.MAX_DIALECT
151 ]
152 )
153 # Internal Session information
154 self.ErrorStatus = None
155 self.NegotiateCapabilities = None
156 self.GUID = RandUUID()._fix()
157 self.SequenceWindow = (0, 0) # keep track of allowed MIDs
158 if ssp is None:
159 # We got no SSP. Assuming the server allows anonymous
160 ssp = SPNEGOSSP(
161 [
162 NTLMSSP(
163 UPN="guest",
164 HASHNT=b"",
165 )
166 ]
167 )
168 # Initialize
169 kwargs["sock"] = sock
170 Automaton.__init__(
171 self,
172 *args,
173 **kwargs,
174 )
175 if self.is_atmt_socket:
176 self.smb_sock_ready = threading.Event()
177 # Set session options
178 self.session.ssp = ssp
179 self.session.SigningRequired = (
180 self.REQUIRE_SIGNATURE if self.REQUIRE_SIGNATURE is not None else bool(ssp)
181 )
182 self.session.Dialect = self.MAX_DIALECT
183
184 @classmethod
185 def from_tcpsock(cls, sock, **kwargs):

Callers

nothing calls this directly

Calls 6

RandUUIDClass · 0.90
SPNEGOSSPClass · 0.90
NTLMSSPClass · 0.90
popMethod · 0.80
_fixMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected