本文整理汇总了Python中impacket.dcerpc.v5.samr.SamrEnumerateGroupsInDomain方法的典型用法代码示例。如果您正苦于以下问题:Python samr.SamrEnumerateGroupsInDomain方法的具体用法?Python samr.SamrEnumerateGroupsInDomain怎么用?Python samr.SamrEnumerateGroupsInDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类impacket.dcerpc.v5.samr
的用法示例。
在下文中一共展示了samr.SamrEnumerateGroupsInDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_SamrEnumerateGroupsInDomain
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import SamrEnumerateGroupsInDomain [as 别名]
def test_SamrEnumerateGroupsInDomain(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrEnumerateGroupsInDomain()
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, e:
if str(e).find('STATUS_MORE_ENTRIES') < 0:
raise
resp4 = e.get_packet()
resp4['Buffer'].dump()
request['EnumerationContext'] = resp4['EnumerationContext']
status = resp4['ErrorCode']
示例2: enumerate_domain_groups
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import SamrEnumerateGroupsInDomain [as 别名]
def enumerate_domain_groups(self, dce, domain_handle):
request = samr.SamrEnumerateGroupsInDomain()
request['DomainHandle'] = domain_handle
request['EnumerationContext'] = 0
request['PreferedMaximumLength'] = 0xffffffff
while True:
try:
resp = dce.request(request)
except Exception as dce_exception:
if dce_exception.error_code == nt_errors.STATUS_MORE_ENTRIES:
resp = dce_exception.get_packet()
request['EnumerationContext'] = resp['EnumerationContext']
groups = resp['Buffer']['Buffer']
for i, group in enumerate(groups):
rid = resp['Buffer']['Buffer'][i]['RelativeId']
group_name = (resp['Buffer']['Buffer'][i]['Name']).encode('utf8')
group_and_rid = ('{0},{1}'.format(group_name, rid))
self.log.info(group_and_rid)
self.data.append(group_and_rid)
continue
break
示例3: test_SamrEnumerateGroupsInDomain
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import SamrEnumerateGroupsInDomain [as 别名]
def test_SamrEnumerateGroupsInDomain(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrEnumerateGroupsInDomain()
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']