Ejemplo n.º 1
0
    def sid2cn(self, sid, throw=False):
        session = self.get_session()
        tsid = session.query(
            JackDawADGroup.cn).filter(JackDawADGroup.sid == sid).first()
        if tsid is not None:
            return tsid[0]

        tsid = session.query(
            JackDawADUser.cn).filter(JackDawADUser.objectSid == sid).first()
        if tsid is not None:
            return tsid[0]

        tsid = session.query(JackDawADMachine.cn).filter(
            JackDawADMachine.objectSid == sid).first()
        if tsid is not None:
            return tsid[0]

        tsid = session.query(JackDawADTrust.cn).filter(
            JackDawADTrust.securityIdentifier == sid).first()
        if tsid is not None:
            return tsid[0]

        t = str(get_name_or_sid(str(sid)))
        if t == sid and throw == True:
            raise Exception('No CN found for SID = %s' % repr(sid))
        return t
Ejemplo n.º 2
0
	def sid2cn(self, sid, throw = False):
		session = self.get_session()
		tsid = session.query(JackDawTokenGroup.cn).filter(JackDawTokenGroup.sid == sid).first()
		#print('sid2cn: %s' % tsid)
		if not tsid:
			t = str(get_name_or_sid(str(sid)))
			if t == sid and throw == True:
				raise Exception('No CN found for SID = %s' % repr(sid))
			return t
		return tsid[0]
Ejemplo n.º 3
0
	def add_sid_to_node(self, node, node_type, construct, name = None):
		if construct.is_blacklisted_sid(node):
			return
		if not name:
			name = str(get_name_or_sid(str(node)))
		
		#this presence-filter is important, as we will encounter nodes that are known and present in the graph already
		#ald later will be added via tokengroups as unknown
		if node not in self.graph.nodes:
			self.graph.add_node(str(node), name=name, node_type=node_type, construct = construct)