本文整理汇总了Python中impacket.dcerpc.v5.samr.USER_READ_ACCOUNT属性的典型用法代码示例。如果您正苦于以下问题:Python samr.USER_READ_ACCOUNT属性的具体用法?Python samr.USER_READ_ACCOUNT怎么用?Python samr.USER_READ_ACCOUNT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类impacket.dcerpc.v5.samr
的用法示例。
在下文中一共展示了samr.USER_READ_ACCOUNT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_SamrOpenUser
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import USER_READ_ACCOUNT [as 别名]
def test_SamrOpenUser(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrOpenUser()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = samr.USER_READ_GENERAL | samr.USER_READ_PREFERENCES | samr.USER_READ_ACCOUNT
request['UserId'] = samr.DOMAIN_USER_RID_ADMIN
resp = dce.request(request)
resp.dump()
示例2: test_hSamrOpenUser
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import USER_READ_ACCOUNT [as 别名]
def test_hSamrOpenUser(self):
dce, rpctransport, domainHandle = self.connect()
resp = samr.hSamrOpenUser(dce, domainHandle, samr.USER_READ_GENERAL | samr.USER_READ_PREFERENCES | samr.USER_READ_ACCOUNT, samr.DOMAIN_USER_RID_ADMIN)
resp.dump()
示例3: test_SamrGetGroupsForUser
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import USER_READ_ACCOUNT [as 别名]
def test_SamrGetGroupsForUser(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrOpenUser()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = samr.USER_READ_GENERAL | samr.USER_READ_PREFERENCES | samr.USER_READ_ACCOUNT | samr.USER_LIST_GROUPS
request['UserId'] = samr.DOMAIN_USER_RID_ADMIN
resp = dce.request(request)
resp.dump()
request = samr.SamrGetGroupsForUser()
request['UserHandle'] = resp['UserHandle']
resp = dce.request(request)
resp.dump()
示例4: test_hSamrGetGroupsForUser
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import USER_READ_ACCOUNT [as 别名]
def test_hSamrGetGroupsForUser(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrOpenUser()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = samr.USER_READ_GENERAL | samr.USER_READ_PREFERENCES | samr.USER_READ_ACCOUNT | samr.USER_LIST_GROUPS
request['UserId'] = samr.DOMAIN_USER_RID_ADMIN
resp = dce.request(request)
resp.dump()
resp = samr.hSamrGetGroupsForUser(dce, resp['UserHandle'])
resp.dump()
示例5: test_SamrGetUserDomainPasswordInformation
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import USER_READ_ACCOUNT [as 别名]
def test_SamrGetUserDomainPasswordInformation(self):
dce, rpctransport, domainHandle = self.connect()
request = samr.SamrOpenUser()
request['DomainHandle'] = domainHandle
request['DesiredAccess'] = samr.USER_READ_GENERAL | samr.USER_READ_PREFERENCES | samr.USER_READ_ACCOUNT
request['UserId'] = samr.DOMAIN_USER_RID_ADMIN
resp = dce.request(request)
request = samr.SamrGetUserDomainPasswordInformation()
request['UserHandle'] = resp['UserHandle']
resp = dce.request(request)
resp.dump()
示例6: __fetchList
# 需要导入模块: from impacket.dcerpc.v5 import samr [as 别名]
# 或者: from impacket.dcerpc.v5.samr import USER_READ_ACCOUNT [as 别名]
def __fetchList(self, rpctransport):
dce = rpctransport.get_dce_rpc()
entries = []
dce.connect()
dce.bind(samr.MSRPC_UUID_SAMR)
try:
resp = samr.hSamrConnect(dce)
serverHandle = resp['ServerHandle']
resp = samr.hSamrEnumerateDomainsInSamServer(dce, serverHandle)
domains = resp['Buffer']['Buffer']
print 'Found domain(s):'
for domain in domains:
print " . %s" % domain['Name']
logging.info("Looking up users in domain %s" % domains[0]['Name'])
resp = samr.hSamrLookupDomainInSamServer(dce, serverHandle,domains[0]['Name'] )
resp = samr.hSamrOpenDomain(dce, serverHandle = serverHandle, domainId = resp['DomainId'])
domainHandle = resp['DomainHandle']
done = False
status = STATUS_MORE_ENTRIES
enumerationContext = 0
while status == STATUS_MORE_ENTRIES:
try:
resp = samr.hSamrEnumerateUsersInDomain(dce, domainHandle, enumerationContext = enumerationContext)
except Exception, e:
if str(e).find('STATUS_MORE_ENTRIES') < 0:
raise
resp = e.get_packet()
for user in resp['Buffer']['Buffer']:
r = samr.hSamrOpenUser(dce, domainHandle, samr.USER_READ_GENERAL | samr.USER_READ_PREFERENCES | samr.USER_READ_ACCOUNT, user['RelativeId'])
print "Found user: %s, uid = %d" % (user['Name'], user['RelativeId'] )
info = samr.hSamrQueryInformationUser2(dce, r['UserHandle'],samr.USER_INFORMATION_CLASS.UserAllInformation)
entry = (user['Name'], user['RelativeId'], info['Buffer']['All'])
entries.append(entry)
samr.hSamrCloseHandle(dce, r['UserHandle'])
enumerationContext = resp['EnumerationContext']
status = resp['ErrorCode']
except ListUsersException, e:
logging.critical("Error listing users: %s" % e)