示例#1
0
	def get_effective_memberships(self, membership_attr):
		try:
			for sid in self.ldap.get_tokengroups(membership_attr['dn']):
				s = JackDawTokenGroup()
				s.cn = membership_attr['cn']
				s.dn = membership_attr['dn']
				s.guid = membership_attr['guid']
				s.sid = membership_attr['sid']
				s.member_sid = sid
				s.is_user = True if membership_attr['type'] == 'user' else False
				s.is_group = True if membership_attr['type'] == 'group' else False
				s.is_machine = True if membership_attr['type'] == 'machine' else False
				self.agent_out_q.put((LDAPAgentCommand.MEMBERSHIP, s))
		except Exception as e:
			self.agent_out_q.put((LDAPAgentCommand.EXCEPTION, str(traceback.format_exc())))
		finally:
			self.agent_out_q.put((LDAPAgentCommand.MEMBERSHIPS_FINISHED, None))
示例#2
0
	async def get_all_effective_memberships(self):
		try:
			async for res in self.ldap.get_all_tokengroups():
				s = JackDawTokenGroup()
				s.cn = res['cn']
				s.dn = res['dn']
				s.guid = res['guid']
				s.sid = res['sid']
				s.member_sid = res['token']
				s.is_user = True if res['type'] == 'user' else False
				s.is_group = True if res['type'] == 'group' else False
				s.is_machine = True if res['type'] == 'computer' else False
				await self.agent_out_q.coro_put((LDAPAgentCommand.MEMBERSHIP, s))
		except:
			await self.agent_out_q.coro_put((LDAPAgentCommand.EXCEPTION, str(traceback.format_exc())))
		finally:
			await self.agent_out_q.coro_put((LDAPAgentCommand.MEMBERSHIPS_FINISHED, None))
示例#3
0
文件: ldap.py 项目: yarbs/jackdaw
	def get_user_effective_memberships(self, user):
		for sid in self.ldap.get_tokengroups(user.dn):
			s = JackDawTokenGroup()
			s.cn = str(user.cn)
			s.dn = str(user.dn)
			
			if isinstance(user, JackDawADUser):
				s.guid = str(user.objectGUID)
				s.sid = str(user.objectSid)
				s.member_sid = sid
				s.is_user = True
			elif isinstance(user, JackDawADMachine):
				s.guid = str(user.objectGUID)
				s.sid = str(user.objectSid)
				s.member_sid = sid
				s.is_machine = True
			elif isinstance(user, JackDawADGroup):
				s.guid = str(user.guid)
				s.sid = str(user.sid)
				s.member_sid = sid
				s.is_group = True		
				
			yield s