public static bool DetectDC(DomainInfo domain, Server dc, DetectLogger logWriter)
        {
            logWriter.AddLog(DetectLogLevel.Warning, string.Format("===== Detect DC in Domain {0} =====", domain.Name));
            DirectoryContext context = new DirectoryContext(DirectoryContextType.Domain, domain.Name, domain.Admin, domain.AdminPassword);

            string hostName  = DomainController.FindOne(context).Name;
            var    hostEntry = Dns.GetHostEntry(hostName);

            try
            {
                string computerName = hostEntry.HostName;
                computerName    = computerName.Split('.')[0];
                dc.ComputerName = computerName;
                dc.FQDN         = ServerHelper.GetDCAttribute(computerName, "dNSHostName", domain.Name, domain.Admin, domain.AdminPassword);
                dc.IsWindows    = ServerHelper.FetchPlatformInfo(computerName, logWriter);
            }
            catch
            {
                logWriter.AddLog(DetectLogLevel.Warning, "Failed", false, LogStyle.StepFailed);
                logWriter.AddLineToLog(DetectLogLevel.Information);
                return(false);
            }

            if (dc.FQDN == null)
            {
                logWriter.AddLog(DetectLogLevel.Warning, "Failed", false, LogStyle.StepFailed);
                logWriter.AddLineToLog(DetectLogLevel.Information);
                return(false);
            }

            try
            {
                dc.NetBIOS            = ServerHelper.GetDCAttribute(dc.ComputerName, "sAMAccountName", domain.Name, domain.Admin, domain.AdminPassword);//DC01$: NetBIOS name
                dc.DefaultServiceName = "krbtgt/" + domain.Name.ToUpper();
                dc.ServiceSalt        = domain.Name.ToUpper() + "host" + dc.FQDN.ToLower();
            }
            catch
            {
                logWriter.AddLog(DetectLogLevel.Warning, "Failed", false, LogStyle.StepFailed);
                logWriter.AddLineToLog(DetectLogLevel.Information);
                return(false);
            }
            try
            {
                domain.FunctionalLevel = ServerHelper.GetDomainFunctionalLevel(domain.Name, domain.Admin, domain.AdminPassword);
            }
            catch
            {
                logWriter.AddLog(DetectLogLevel.Warning, "Failed", false, LogStyle.StepFailed);
                logWriter.AddLineToLog(DetectLogLevel.Information);
                return(false);
            }

            logWriter.AddLog(DetectLogLevel.Warning, "Success", false, LogStyle.StepPassed);
            logWriter.AddLineToLog(DetectLogLevel.Information);
            return(true);
        }
        public static bool DetectClient(DomainInfo domain, ComputerInfo client, DetectLogger logWriter)
        {
            logWriter.AddLog(DetectLogLevel.Warning, string.Format("===== Detect Client/Driver in Domain {0} =====", domain.Name));
            string ip = client.IPv4 != null ? client.IPv4 : client.IPv6;

            try
            {
                string computerName = Dns.GetHostEntry(ip).HostName;
                computerName = computerName.Split('.')[0];
            }
            catch
            {
                logWriter.AddLog(DetectLogLevel.Error, "Failed", false, LogStyle.StepFailed);
                logWriter.AddLineToLog(DetectLogLevel.Information);
                return(false);
            }

            logWriter.AddLog(DetectLogLevel.Warning, "Success", false, LogStyle.StepPassed);
            logWriter.AddLineToLog(DetectLogLevel.Information);
            return(true);
        }
        public FSDetector
            (DetectLogger logger,
            string targetSUT,
            AccountCredential accountCredential,
            SecurityPackageType securityPackageType)
        {
            sutName             = targetSUT;
            Credential          = accountCredential;
            SecurityPackageType = securityPackageType;

            logWriter = logger;
            logWriter.AddLog(DetectLogLevel.Information, string.Format("SutName: {0}", sutName));
            logWriter.AddLog(DetectLogLevel.Information, string.Format("DomainName: {0}", Credential.DomainName));
            logWriter.AddLog(DetectLogLevel.Information, string.Format("UserName: {0}", Credential.AccountName));
            logWriter.AddLog(DetectLogLevel.Information, string.Format("UserPassword: {0}", Credential.Password));
            logWriter.AddLog(DetectLogLevel.Information, string.Format("SecurityPackageType: {0}", SecurityPackageType.ToString()));
            logWriter.AddLineToLog(DetectLogLevel.Information);
        }