Exemplo n.º 1
0
	def get_all_groups(self):
		try:
			for group in self.ldap.get_all_groups():
				self.agent_out_q.put((LDAPAgentCommand.GROUP, JackDawADGroup.from_dict(group.to_dict())))
		except Exception as e:
			self.agent_out_q.put((LDAPAgentCommand.EXCEPTION, str(traceback.format_exc())))
		finally:
			self.agent_out_q.put((LDAPAgentCommand.GROUPS_FINISHED, None))
Exemplo n.º 2
0
	async def get_all_groups(self):
		try:
			async for group in self.ldap.get_all_groups():
				g = JackDawADGroup.from_dict(group.to_dict())
				await self.agent_out_q.coro_put((LDAPAgentCommand.GROUP, g))
				del g
		except:
			await self.agent_out_q.coro_put((LDAPAgentCommand.EXCEPTION, str(traceback.format_exc())))
		finally:
			await self.agent_out_q.coro_put((LDAPAgentCommand.GROUPS_FINISHED, None))
Exemplo n.º 3
0
    def import_groups(self):
        print('Importing groups!')
        for groups in self.get_file('groups')['groups']:
            #pprint.pprint(groups)
            #input()
            try:
                ad_name = groups['Name'].rsplit('@', 1)[1]
                m = JackDawADGroup()
                m.ad_id = self.adn[ad_name]
                m.name = groups['Name'].split('@', 1)[0]
                m.objectSid = groups['Properties']['objectsid']
                m.description = groups['Properties'].get('description', None)

                self.db_session.add(m)
            except Exception as e:
                print(e)
                pprint.pprint(groups)
                input()
                continue
        self.db_session.commit()
Exemplo n.º 4
0
	def get_all_groups(self):
		for group in self.ldap.get_all_groups():
			yield JackDawADGroup.from_dict(group.to_dict())