An reference to an instantiated object. This is a helper to manipulate this object and perform calls over it.
| 744 | |
| 745 | |
| 746 | class ObjectInstance: |
| 747 | """ |
| 748 | An reference to an instantiated object. |
| 749 | |
| 750 | This is a helper to manipulate this object and perform calls over it. |
| 751 | """ |
| 752 | |
| 753 | def __init__(self, client: "DCOM_Client", oid: int): |
| 754 | self.client = client |
| 755 | self.oid = oid |
| 756 | |
| 757 | def __repr__(self): |
| 758 | return f"<ObjectInstance {self.oid}>" |
| 759 | |
| 760 | @property |
| 761 | def valid(self): |
| 762 | """ |
| 763 | Returns whether the current object still exists |
| 764 | """ |
| 765 | return self.oid in self.client.OID_table |
| 766 | |
| 767 | @property |
| 768 | def ndr64(self): |
| 769 | """ |
| 770 | Whether NDR64 is required to talk to this object |
| 771 | """ |
| 772 | return self.client.ndr64 |
| 773 | |
| 774 | def sr1_req( |
| 775 | self, |
| 776 | pkt: NDRPacket, |
| 777 | iface: ComInterface, |
| 778 | ssp=None, |
| 779 | auth_level=None, |
| 780 | timeout=None, |
| 781 | **kwargs, |
| 782 | ): |
| 783 | """ |
| 784 | Make an ORPC call on this object instance. |
| 785 | |
| 786 | :param iface: the ComInterface to call. |
| 787 | :param pkt: the request to make. |
| 788 | |
| 789 | :param ssp: (optional) non default SSP to use to connect to the object exporter |
| 790 | :param auth_level: (optional) non default authn level to use |
| 791 | :param timeout: (optional) timeout for the connection |
| 792 | """ |
| 793 | # Look for this object's entry |
| 794 | try: |
| 795 | oid_entry = self.client.OID_table[self.oid] |
| 796 | except KeyError: |
| 797 | raise ValueError("This object has been released.") |
| 798 | |
| 799 | # Look for the ipid matching the interface required by the user |
| 800 | ipid = None |
| 801 | for ipid in oid_entry.ipids: |
| 802 | ipid_entry = self.client.IPID_table[ipid] |
| 803 | if ipid_entry.iid == iface.uuid: |
no outgoing calls
no test coverage detected
searching dependent graphs…