Python impacket.dcerpc.v5.samr.hSamrGetMembersInAlias() Examples
The following are 4
code examples of impacket.dcerpc.v5.samr.hSamrGetMembersInAlias().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
impacket.dcerpc.v5.samr
, or try the search function
.
Example #1
Source File: enum.py From Exchange2domain with MIT License | 6 votes |
def __getLocalAdminSids(self): dce = self.__getDceBinding(self.__samrBinding) dce.connect() dce.bind(samr.MSRPC_UUID_SAMR) resp = samr.hSamrConnect(dce) serverHandle = resp['ServerHandle'] resp = samr.hSamrLookupDomainInSamServer(dce, serverHandle, 'Builtin') resp = samr.hSamrOpenDomain(dce, serverHandle=serverHandle, domainId=resp['DomainId']) domainHandle = resp['DomainHandle'] resp = samr.hSamrOpenAlias(dce, domainHandle, desiredAccess=MAXIMUM_ALLOWED, aliasId=544) resp = samr.hSamrGetMembersInAlias(dce, resp['AliasHandle']) memberSids = [] for member in resp['Members']['Sids']: memberSids.append(member['SidPointer'].formatCanonical()) dce.disconnect() return memberSids
Example #2
Source File: enum.py From Slackor with GNU General Public License v3.0 | 6 votes |
def __getLocalAdminSids(self): dce = self.__getDceBinding(self.__samrBinding) dce.connect() dce.bind(samr.MSRPC_UUID_SAMR) resp = samr.hSamrConnect(dce) serverHandle = resp['ServerHandle'] resp = samr.hSamrLookupDomainInSamServer(dce, serverHandle, 'Builtin') resp = samr.hSamrOpenDomain(dce, serverHandle=serverHandle, domainId=resp['DomainId']) domainHandle = resp['DomainHandle'] resp = samr.hSamrOpenAlias(dce, domainHandle, desiredAccess=MAXIMUM_ALLOWED, aliasId=544) resp = samr.hSamrGetMembersInAlias(dce, resp['AliasHandle']) memberSids = [] for member in resp['Members']['Sids']: memberSids.append(member['SidPointer'].formatCanonical()) dce.disconnect() return memberSids
Example #3
Source File: enum.py From CVE-2019-1040 with MIT License | 6 votes |
def __getLocalAdminSids(self): dce = self.__getDceBinding(self.__samrBinding) dce.connect() dce.bind(samr.MSRPC_UUID_SAMR) resp = samr.hSamrConnect(dce) serverHandle = resp['ServerHandle'] resp = samr.hSamrLookupDomainInSamServer(dce, serverHandle, 'Builtin') resp = samr.hSamrOpenDomain(dce, serverHandle=serverHandle, domainId=resp['DomainId']) domainHandle = resp['DomainHandle'] resp = samr.hSamrOpenAlias(dce, domainHandle, desiredAccess=MAXIMUM_ALLOWED, aliasId=544) resp = samr.hSamrGetMembersInAlias(dce, resp['AliasHandle']) memberSids = [] for member in resp['Members']['Sids']: memberSids.append(member['SidPointer'].formatCanonical()) dce.disconnect() return memberSids
Example #4
Source File: test_samr.py From Slackor with GNU General Public License v3.0 | 5 votes |
def test_hSamrGetMembersInAlias(self): dce, rpctransport, domainHandle = self.connect() request = samr.SamrEnumerateAliasesInDomain() request['DomainHandle'] = domainHandle request['EnumerationContext'] = 0 request['PreferedMaximumLength'] = 500 status = nt_errors.STATUS_MORE_ENTRIES while status == nt_errors.STATUS_MORE_ENTRIES: try: resp4 = dce.request(request) except Exception as e: if str(e).find('STATUS_MORE_ENTRIES') < 0: raise resp4 = e.get_packet() resp4['Buffer'].dump() request['EnumerationContext'] = resp4['EnumerationContext'] status = resp4['ErrorCode'] request = samr.SamrOpenAlias() request['DomainHandle'] = domainHandle request['DesiredAccess'] = dtypes.MAXIMUM_ALLOWED request['AliasId'] = resp4['Buffer']['Buffer'][0]['RelativeId'] resp = dce.request(request) resp.dump() resp = samr.hSamrGetMembersInAlias(dce, resp['AliasHandle']) resp.dump()