Make an ORPC call. :param ipid: the reference to a specific interface on an object. :param pkt: the request to make. :param ssp: (optional) non default SSP to use to connect to the object exporter :param auth_level: (optional) non default authn level to use
(
self,
pkt: NDRPacket,
ipid: uuid.UUID,
ssp=None,
auth_level=None,
timeout=5,
**kwargs,
)
| 1337 | ) |
| 1338 | |
| 1339 | def sr1_orpc_req( |
| 1340 | self, |
| 1341 | pkt: NDRPacket, |
| 1342 | ipid: uuid.UUID, |
| 1343 | ssp=None, |
| 1344 | auth_level=None, |
| 1345 | timeout=5, |
| 1346 | **kwargs, |
| 1347 | ): |
| 1348 | """ |
| 1349 | Make an ORPC call. |
| 1350 | |
| 1351 | :param ipid: the reference to a specific interface on an object. |
| 1352 | :param pkt: the request to make. |
| 1353 | |
| 1354 | :param ssp: (optional) non default SSP to use to connect to the object exporter |
| 1355 | :param auth_level: (optional) non default authn level to use |
| 1356 | :param timeout: (optional) timeout for the connection |
| 1357 | """ |
| 1358 | # [MS-DCOM] sect 3.2.4.2 |
| 1359 | |
| 1360 | # 1. look up the object exporter information in the client tables |
| 1361 | |
| 1362 | try: |
| 1363 | # "The client MUST use the IPID specified by the client application to |
| 1364 | # look up the IPID entry in the IPID table." |
| 1365 | ipid_entry = self.IPID_table[ipid] |
| 1366 | except KeyError: |
| 1367 | raise ValueError("The IPID that was passed is unknown.") |
| 1368 | |
| 1369 | # "The client MUST then look up the OXID entry" |
| 1370 | oxid_entry = self.OXID_table[ipid_entry.oxid] |
| 1371 | oid_entry = self.OID_table[ipid_entry.oid] |
| 1372 | resolver_entry = self.Resolver_table[oid_entry.hash] |
| 1373 | |
| 1374 | # Get opnum |
| 1375 | try: |
| 1376 | opnum = pkt.overload_fields[DceRpc5Request]["opnum"] |
| 1377 | except KeyError: |
| 1378 | raise ValueError("This packet is not part of a registered COM interface !") |
| 1379 | |
| 1380 | # Build ORPC request |
| 1381 | |
| 1382 | if resolver_entry.client is None: |
| 1383 | # We don't have a client ready, make one. |
| 1384 | resolver_entry.client = DCERPC_Client( |
| 1385 | DCERPC_Transport.NCACN_IP_TCP, |
| 1386 | ssp=ssp or self.ssp, |
| 1387 | auth_level=auth_level or oxid_entry.authnHint, |
| 1388 | verb=self.verb, |
| 1389 | ) |
| 1390 | |
| 1391 | resolver_entry.client.connect( |
| 1392 | host=oxid_entry.bindingInfo[0], |
| 1393 | port=oxid_entry.bindingInfo[1], |
| 1394 | timeout=timeout, |
| 1395 | ) |
| 1396 |
no test coverage detected