private void ExportReportData(GraphObjectReference objectReference, List <string> UsersToInvestigate) { List <ADItem> aditems = null; foreach (var typology in objectReference.Objects.Keys) { var toDelete = new List <GraphSingleObject>(); foreach (var obj in objectReference.Objects[typology]) { Trace.WriteLine("Working on " + obj.Description); aditems = Search(obj.Name); if (aditems.Count != 0) { RelationFactory.AnalyzeADObject(aditems[0]); } else { Trace.WriteLine("Unable to find the user: "******"Working on " + user); aditems = Search(user); if (aditems.Count != 0) { string userKey = user; if (aditems[0].ObjectSid != null) { userKey = aditems[0].ObjectSid.Value; } objectReference.Objects[Data.CompromiseGraphDataTypology.UserDefined].Add(new GraphSingleObject(userKey, user)); RelationFactory.AnalyzeADObject(aditems[0]); } else { Trace.WriteLine("Unable to find the user: " + user); } } } foreach (var item in objectReference.TechnicalObjects) { aditems = Search(item); if (aditems.Count != 0) { RelationFactory.AnalyzeADObject(aditems[0]); } } AnalyzeMissingObjets(); }
private void ExportReportData(ADWebService adws, ADDomainInfo domainInfo, IRelationFactory relationFactory, IDataStorage storage, GraphObjectReference objectReference, List <string> UsersToInvestigate) { ADItem aditem = null; foreach (var typology in objectReference.Objects.Keys) { var toDelete = new List <GraphSingleObject>(); foreach (var obj in objectReference.Objects[typology]) { DisplayAdvancement("Working on " + obj.Description); aditem = Search(adws, domainInfo, obj.Name); if (aditem != null) { relationFactory.AnalyzeADObject(aditem); } else { Trace.WriteLine("Unable to find the user: "******"Working on " + user); aditem = Search(adws, domainInfo, user); if (aditem != null) { string userKey = user; if (aditem.ObjectSid != null) { userKey = aditem.ObjectSid.Value; } objectReference.Objects[Data.CompromiseGraphDataTypology.UserDefined].Add(new GraphSingleObject(userKey, user)); relationFactory.AnalyzeADObject(aditem); } else { Trace.WriteLine("Unable to find the user: " + user); } } AnalyzeMissingObjets(adws, domainInfo, relationFactory, storage); }
private void ExportPrimaryGroupData(ADWebService adws, ADDomainInfo domainInfo, IRelationFactory relationFactory, List <int> primaryGroupIDs) { WorkOnReturnedObjectByADWS callback = (ADItem aditem) => { relationFactory.AnalyzeADObject(aditem); }; foreach (int id in primaryGroupIDs) { adws.Enumerate(domainInfo.DefaultNamingContext, "(primaryGroupID=" + id + ")", properties.ToArray(), callback); } }
private void ExportSIDData(ADWebService adws, ADDomainInfo domainInfo, IRelationFactory relationFactory, List <string> sids) { WorkOnReturnedObjectByADWS callback = (ADItem aditem) => { relationFactory.AnalyzeADObject(aditem); }; foreach (string sid in sids) { adws.Enumerate(domainInfo.DefaultNamingContext, "(objectSid=" + ADConnection.EncodeSidToString(sid) + ")", properties.ToArray(), callback); } }
private void ExportCNData(ADWebService adws, ADDomainInfo domainInfo, IRelationFactory relationFactory, List <string> cns) { WorkOnReturnedObjectByADWS callback = (ADItem aditem) => { relationFactory.AnalyzeADObject(aditem); }; foreach (string cn in cns) { adws.Enumerate(domainInfo.DefaultNamingContext, "(distinguishedName=" + ADConnection.EscapeLDAP(cn) + ")", properties.ToArray(), callback); } }