public void Collect(List <SearchString> searchStringList) { ICollector collector = null; IDisplay displayer = null; if (searchStringList.FirstOrDefault() is LDAPSearchString) { collector = new CollectWithFilter(); displayer = new DisplayLDAPObjects(); } else if (searchStringList.FirstOrDefault() is NestedGMSearchString) { collector = new CollectNestedGroupMembership(); displayer = new DisplayList(); } else if (searchStringList.FirstOrDefault() is AppliedGPOSearchString) { collector = new CollectAppliedGPO(); displayer = new DisplayDD(); } foreach (SearchString searchString in searchStringList) { displayer.DisplayTitle(searchString.Title); IResult result = collector.Collect(searchString); displayer.DisplayResult(result); } }
public void InvokeACLScan(string user) { if (user == null) { return; } var displayer = new DisplayDACL(); displayer.DisplayTitle($"Interesting ACL for {user.ToUpper()}"); DACLResult result = new DACLResult(); var groups = new CollectNestedGroupMembership(); groups.Collect(new NestedGMSearchString { SAMAccountName = user }); var groupSIDs = CollectNestedGroupMembership.UserSIDNameDictionary[user.ToUpper()].Keys.ToList(); result.Result = DACL.ACLScan(user, groupSIDs); displayer.DisplayResult(result); }