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

Method recv

scapy/layers/msrpce/rpcserver.py:217–413  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

215 raise ValueError("Unsupported transport :(")
216
217 def recv(self, data):
218 if isinstance(data, bytes):
219 req = DceRpc5(data)
220 else:
221 req = data
222 # If the packet has padding, it contains several fragments
223 pad = None
224 if conf.padding_layer in req:
225 pad = req[conf.padding_layer].load
226 req[conf.padding_layer].underlayer.remove_payload()
227 # Ask the DCE/RPC session to process it (match interface, etc.)
228 req = self.session.in_pkt(req)
229 hdr = DceRpc5(
230 endian=req.endian,
231 encoding=req.encoding,
232 float=req.float,
233 call_id=req.call_id,
234 )
235 # Now process the packet based on the DCE/RPC type
236 if DceRpc5Bind in req or DceRpc5AlterContext in req or DceRpc5Auth3 in req:
237 # Log
238 if self.verb:
239 print(
240 conf.color_theme.opening(
241 "<< %s" % req.payload.__class__.__name__
242 + (
243 " (with %s%s)"
244 % (
245 self.session.ssp.__class__.__name__,
246 (
247 f" - {self.session.auth_level.name}"
248 if self.session.auth_level is not None
249 else ""
250 ),
251 )
252 if self.session.ssp
253 else ""
254 )
255 )
256 )
257 if not self.session.rpc_bind_interface:
258 # The session did not find a matching interface !
259 self.queue.extend(self.session.out_pkt(hdr / DceRpc5BindNak()))
260 if self.verb:
261 print(conf.color_theme.fail("! DceRpc5BindNak (unknown interface)"))
262 else:
263 auth_value, status = None, 0
264 if (
265 self.session.ssp
266 and req.auth_verifier
267 and req.auth_verifier.auth_value
268 ):
269 (
270 self.session.sspcontext,
271 auth_value,
272 status,
273 ) = self.session.ssp.GSS_Accept_sec_context(
274 self.session.sspcontext, req.auth_verifier.auth_value

Callers 3

loopMethod · 0.95
get_next_msgMethod · 0.45
add_ClientDataMethod · 0.45

Calls 15

make_replyMethod · 0.95
DceRpc5Class · 0.90
DceRpc5BindNakClass · 0.90
RPC_C_AUTHN_LEVELClass · 0.90
CommonAuthVerifierClass · 0.90
DceRpc5ResultClass · 0.90
RandShortClass · 0.90
DceRpc5PortAnyClass · 0.90
DceRpc5ResponseClass · 0.90
extendMethod · 0.80
encodeMethod · 0.80

Tested by

no test coverage detected