MCPcopy Create free account
hub / github.com/secdev/scapy / ept_map

Method ept_map

scapy/layers/msrpce/rpcserver.py:424–474  ·  view source on GitHub ↗

Answer to ept_map_Request.

(self, req)

Source from the content-addressed store, hash-verified

422
423 @answer.__func__(ept_map_Request) # hack for Python <= 3.9
424 def ept_map(self, req):
425 """
426 Answer to ept_map_Request.
427 """
428 if self.transport != DCERPC_Transport.NCACN_IP_TCP:
429 raise ValueError("Unimplemented")
430
431 tower = protocol_tower_t(
432 req[ept_map_Request].valueof("map_tower.tower_octet_string")
433 )
434 uuid = tower.floors[0].uuid
435 if_version = (tower.floors[0].rhs << 16) | tower.floors[0].version
436
437 # Check for results in our portmap
438 port = None
439 if (uuid, if_version) in DCE_RPC_INTERFACES:
440 interface = DCE_RPC_INTERFACES[(uuid, if_version)]
441 if interface in self.portmap:
442 port = self.portmap[interface]
443
444 if port is not None:
445 # Found result
446 resp_tower = twr_p_t(
447 tower_octet_string=bytes(
448 protocol_tower_t(
449 floors=[
450 tower.floors[0], # UUID
451 tower.floors[1], # NDR version
452 tower.floors[2], # RPC version
453 prot_and_addr_t(
454 lhs_length=1,
455 protocol_identifier="NCACN_IP_TCP",
456 rhs_length=2,
457 rhs=port,
458 ),
459 prot_and_addr_t(
460 lhs_length=1,
461 protocol_identifier="IP",
462 rhs_length=4,
463 rhs=self.local_ip or "0.0.0.0",
464 ),
465 ]
466 )
467 )
468 )
469 resp = ept_map_Response(ITowers=[resp_tower], ndr64=self.ndr64)
470 resp.ITowers.max_count = req.max_towers # ugh
471 else:
472 # No result found
473 pass
474 return resp

Callers

nothing calls this directly

Calls 5

protocol_tower_tClass · 0.90
twr_p_tClass · 0.90
prot_and_addr_tClass · 0.90
ept_map_ResponseClass · 0.90
valueofMethod · 0.45

Tested by

no test coverage detected