本文整理匯總了Python中impacket.dcerpc.v5.samr.hSamrGetMembersInAlias方法的典型用法代碼示例。如果您正苦於以下問題:Python samr.hSamrGetMembersInAlias方法的具體用法?Python samr.hSamrGetMembersInAlias怎麽用?Python samr.hSamrGetMembersInAlias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類impacket.dcerpc.v5.samr
的用法示例。
在下文中一共展示了samr.hSamrGetMembersInAlias方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __getLocalAdminSids
# 需要導入模塊: from impacket.dcerpc.v5 import samr [as 別名]
# 或者: from impacket.dcerpc.v5.samr import hSamrGetMembersInAlias [as 別名]
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
示例2: test_hSamrGetMembersInAlias
# 需要導入模塊: from impacket.dcerpc.v5 import samr [as 別名]
# 或者: from impacket.dcerpc.v5.samr import hSamrGetMembersInAlias [as 別名]
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()