Beispiel #1
0
        private void AddResultItem(ref ResultItemMap resultItemMap, string name, string value, DetectResult result)
        {
            string imagePath = string.Empty;

            switch (result)
            {
            case DetectResult.Supported:
                imagePath = "/KerberosPlugin;component/Icons/supported.png";
                break;

            case DetectResult.UnSupported:
                imagePath = "/KerberosPlugin;component/Icons/unsupported.png";
                break;

            case DetectResult.DetectFail:
                imagePath = "/KerberosPlugin;component/Icons/undetected.png";
                break;

            default:
                break;
            }

            ResultItem item = new ResultItem()
            {
                DetectedResult = result, ImageUrl = imagePath, Name = name, Value = value
            };

            resultItemMap.ResultItemList.Add(item);
        }
Beispiel #2
0
        private void AddLdapServer(ref ResultItemMap resultMap, Server server, DetectResult result)
        {
            if (!string.IsNullOrEmpty(server.ldapService.LdapServiceName))
            {
                AddResultItem(ref resultMap, "LdapServiceName: ", server.ldapService.LdapServiceName, result);
            }
            else
            {
                AddResultItem(ref resultMap, "LdapServiceName: ", server.ldapService.LdapServiceName, DetectResult.DetectFail);
            }

            if (!string.IsNullOrEmpty(server.ldapService.Port))
            {
                AddResultItem(ref resultMap, "LdapPort: ", server.ldapService.Port, result);
            }
            else
            {
                AddResultItem(ref resultMap, "LdapPort: ", server.ldapService.Port, DetectResult.DetectFail);
            }
            if (!string.IsNullOrEmpty(server.ldapService.GssToken))
            {
                AddResultItem(ref resultMap, "LdapGssToken: ", server.ldapService.GssToken, result);
            }
            else
            {
                AddResultItem(ref resultMap, "LdapGssToken: ", server.ldapService.GssToken, DetectResult.DetectFail);
            }
        }
Beispiel #3
0
 private void AddDomain(ref ResultItemMap resultMap, DomainInfo domain, DetectResult result)
 {
     AddResultItem(ref resultMap, "DomainName: ", domain.Name, result);
     AddResultItem(ref resultMap, "DomainAdmin: ", domain.Admin, result);
     AddResultItem(ref resultMap, "DomainAdminPwd: ", domain.AdminPassword, result);
     AddResultItem(ref resultMap, "DomainFunctionLevel: ", domain.FunctionalLevel, result);
 }
Beispiel #4
0
        private void AddOtherService(ref ResultItemMap resultMap, string computerName, OtherService service, DomainInfo domain)
        {
            try
            {
                ServerHelper.GetAccountAttribute(computerName, "Computers", "sAMAccountName", domain.Name, domain.Admin, domain.AdminPassword);

                if (!string.IsNullOrEmpty(service.FQDN))
                {
                    AddResultItem(ref resultMap, computerName + " FQDN: ", service.FQDN, DetectResult.Supported);
                }
                if (!string.IsNullOrEmpty(service.NetBios))
                {
                    AddResultItem(ref resultMap, computerName + " NetBios: ", service.NetBios, DetectResult.Supported);
                }
                if (!string.IsNullOrEmpty(service.Password))
                {
                    AddResultItem(ref resultMap, computerName + " Password: "******" DefaultServiceName: ", service.DefaultServiceName, DetectResult.Supported);
                }
                if (!string.IsNullOrEmpty(service.ServiceSalt))
                {
                    AddResultItem(ref resultMap, computerName + " ServiceSalt: ", service.ServiceSalt, DetectResult.Supported);
                }
            }
            catch
            {
                if (!string.IsNullOrEmpty(service.FQDN))
                {
                    AddResultItem(ref resultMap, computerName + " FQDN: ", service.FQDN, DetectResult.UnSupported);
                }
                if (!string.IsNullOrEmpty(service.NetBios))
                {
                    AddResultItem(ref resultMap, computerName + " NetBios: ", service.NetBios, DetectResult.UnSupported);
                }
                if (!string.IsNullOrEmpty(service.Password))
                {
                    AddResultItem(ref resultMap, computerName + " Password: "******" DefaultServiceName: ", service.DefaultServiceName, DetectResult.UnSupported);
                }
                if (!string.IsNullOrEmpty(service.ServiceSalt))
                {
                    AddResultItem(ref resultMap, computerName + " ServiceSalt: ", service.ServiceSalt, DetectResult.UnSupported);
                }
            }
        }
Beispiel #5
0
 private void AddEndpoint(ref ResultItemMap resultMap, ComputerInfo server, DetectResult result)
 {
     AddResultItem(ref resultMap, "ComputerName: ", server.ComputerName, result);
     AddResultItem(ref resultMap, "FQDN: ", server.FQDN, result);
     if (string.IsNullOrEmpty(server.IPv4))
     {
         AddResultItem(ref resultMap, "IP: ", server.IPv6, result);
     }
     else
     {
         AddResultItem(ref resultMap, "IP: ", server.IPv4, result);
     }
     AddResultItem(ref resultMap, "NetBIOS: ", server.NetBIOS, result);
     // AddResultItem(ref resultMap,"ComputerPwd: ",server.Password,result);
     //  AddResultItem(ref resultMap,"Port: ",server.Port,result);
     AddResultItem(ref resultMap, "ServiceSalt: ", server.ServiceSalt, result);
     AddResultItem(ref resultMap, "DefaultServiceName: ", server.DefaultServiceName, result);
     AddResultItem(ref resultMap, "IsWindows: ", server.IsWindows.ToString(), result);
 }
Beispiel #6
0
        private void AddHttpServer(ref ResultItemMap resultMap, Server server, DetectResult result)
        {
            if (!string.IsNullOrEmpty(server.httpService.HttpServiceName))
            {
                AddResultItem(ref resultMap, "HttpServiceName: ", server.httpService.HttpServiceName, result);
            }
            else
            {
                AddResultItem(ref resultMap, "HttpServiceName: ", server.httpService.HttpServiceName, DetectResult.DetectFail);
            }


            if (!string.IsNullOrEmpty(server.httpService.Uri))
            {
                AddResultItem(ref resultMap, "HttpUri: ", server.httpService.Uri, result);
            }
            else
            {
                AddResultItem(ref resultMap, "HttpUri: ", server.httpService.Uri, DetectResult.DetectFail);
            }
        }
Beispiel #7
0
        private void AddSmb2Server(ref ResultItemMap resultMap, Server server, DetectResult result)
        {
            if (!string.IsNullOrEmpty(server.smb2Service.CBACShare))
            {
                AddResultItem(ref resultMap, "CBACShare: ", server.smb2Service.CBACShare, result);
            }
            else
            {
                AddResultItem(ref resultMap, "CBACShare: ", server.smb2Service.CBACShare, DetectResult.DetectFail);
            }

            if (!string.IsNullOrEmpty(server.smb2Service.DACShare))
            {
                AddResultItem(ref resultMap, "DACShare: ", server.smb2Service.DACShare, result);
            }
            else
            {
                AddResultItem(ref resultMap, "DACShare: ", server.smb2Service.DACShare, DetectResult.DetectFail);
            }
            if (!string.IsNullOrEmpty(server.smb2Service.SMB2Dialect))
            {
                AddResultItem(ref resultMap, "SMB2Dialect: ", server.smb2Service.SMB2Dialect, result);
            }
            else
            {
                AddResultItem(ref resultMap, "SMB2Dialect: ", server.smb2Service.SMB2Dialect, DetectResult.DetectFail);
            }
            if (!string.IsNullOrEmpty(server.smb2Service.SMB2ServiceName))
            {
                AddResultItem(ref resultMap, "SMB2ServiceName: ", server.smb2Service.SMB2ServiceName, result);
            }
            else
            {
                AddResultItem(ref resultMap, "SMB2ServiceName: ", server.smb2Service.SMB2ServiceName, DetectResult.DetectFail);
            }
        }
Beispiel #8
0
        private void AddUserList(ref ResultItemMap resultMap, Dictionary <string, User> users, DomainInfo domain)
        {
            foreach (string key in users.Keys)
            {
                User user = users[key];
                try
                {
                    //detect the user in domain
                    //if cannot get the user information, set unsupported result.

                    string userName = ServerHelper.GetAccountAttribute(user.Name, "Users", "sAMAccountName", domain.Name, domain.Admin, domain.AdminPassword);

                    if (string.IsNullOrEmpty(userName))
                    {
                        AddResultItem(ref resultMap, key + " User Name: ", user.Name, DetectResult.UnSupported);

                        //cannot detect the password, assume the default value
                        AddResultItem(ref resultMap, key + " User Password: "******" User Salt: ", user.Salt, DetectResult.UnSupported);
                        }
                    }
                    else
                    {
                        AddResultItem(ref resultMap, key + " User Name: ", user.Name, DetectResult.Supported);
                        AddResultItem(ref resultMap, key + " User Password: "******" User Salt: ", user.Salt, DetectResult.Supported);
                        }
                    }
                }
                catch
                {
                    AddResultItem(ref resultMap, key + " User Name: ", "", DetectResult.DetectFail);
                    AddResultItem(ref resultMap, key + " User Password: "******"", DetectResult.DetectFail);
                }

                try
                {
                    string spn = ServerHelper.GetAccountAttribute(user.Name, "Users", "servicePrincipalName", domain.Name, domain.Admin, domain.AdminPassword);
                    if (user.ServiceName != null)
                    {
                        if (!string.IsNullOrEmpty(spn))
                        {
                            user.ServiceName = spn;
                            AddResultItem(ref resultMap, key + " User ServiceName: ", user.ServiceName, DetectResult.Supported);
                        }
                        else
                        {
                            AddResultItem(ref resultMap, key + " User ServiceName: ", user.ServiceName, DetectResult.UnSupported);
                        }
                    }
                }
                catch
                {
                    if (user.ServiceName != null)
                    {
                        AddResultItem(ref resultMap, key + " User ServiceName: ", "", DetectResult.DetectFail);
                    }
                }
            }
        }