Answer to ept_map_Request.
(self, req)
| 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 |
nothing calls this directly
no test coverage detected