def store_sd(self, sd): #secdesc = SECURITY_DESCRIPTOR.from_bytes(sd.nTSecurityDescriptor) # if sd.objectClass[-1] in ['user', 'group']: obj_type = sd.objectClass[-1] elif sd.objectClass[-1] == 'computer': obj_type = 'machine' elif sd.objectClass[-1] == 'groupPolicyContainer': obj_type = 'gpo' elif sd.objectClass[-1] == 'organizationalUnit': obj_type = 'ou' else: obj_type = sd.objectClass[-1] jdsd = JackDawSD() jdsd.ad_id = self.ad_id jdsd.guid = str(sd.objectGUID) if sd.objectSid: jdsd.sid = str(sd.objectSid) jdsd.object_type = obj_type jdsd.sd = base64.b64encode(sd.nTSecurityDescriptor) self.session.add(jdsd) if self.sd_ctr % 1000 == 0: self.session.commit() else: self.session.flush()
async def store_sd(self, sd): if sd['adsec'] is None: return jdsd = JackDawSD() jdsd.ad_id = self.ad_id jdsd.guid = sd['guid'] jdsd.sid = sd['sid'] jdsd.object_type = sd['object_type'] jdsd.sd = base64.b64encode(sd['adsec']).decode() jdsd.sd_hash = sha1(sd['adsec']).hexdigest() self.sd_file.write(jdsd.to_json().encode() + b'\r\n')
async def store_sd(self, sd): #secdesc = SECURITY_DESCRIPTOR.from_bytes(sd.nTSecurityDescriptor) # #print(str(sd)) if sd['adsec'] is None: return jdsd = JackDawSD() jdsd.ad_id = self.ad_id jdsd.guid = sd['guid'] jdsd.sid = sd['sid'] jdsd.object_type = sd['object_type'] jdsd.sd = base64.b64encode(sd['adsec']).decode() jdsd.sd_hash = sha1(sd['adsec']).hexdigest() self.sd_file.write(jdsd.to_json().encode() + b'\r\n')