Пример #1
0
        public static bool SupportSMB2And3(string server, out SMBSecurityModeEnum securityMode)
        {
            bool tempResult = false;
            bool result     = false;

            securityMode = SMBSecurityModeEnum.NotTested;
            SMBSecurityModeEnum smbv2temp;

            foreach (int dialect in new int[] { 0x0202, 0x0210, 0x0300, 0x0302, 0x0311 })
            {
                try
                {
                    tempResult = Smb2ProtocolTest.DoesServerSupportDialectWithSmbV2(server, dialect, out smbv2temp);
                    if (tempResult)
                    {
                        result       = true;
                        securityMode = CombineSecurityMode(securityMode, smbv2temp);
                    }
                }
                catch (SmbPortClosedException)
                {
                    break;
                }
                catch (Exception)
                {
                }
            }
            return(result);
        }
        override protected string GetCsvData(string computer)
        {
            StringBuilder sb = new StringBuilder();

            DisplayAdvancement(computer, "Connecting to SMB3");

            var o = Smb2ProtocolTest.GetFCTL_QUERY_NETWORK_INFO(computer, Credential);

            if (o == null)
            {
                sb.Append(computer);
                sb.Append("\t");
                sb.Append("Unable to retrive the information");
            }
            else
            {
                foreach (var info in o)
                {
                    if (sb.Length != 0)
                    {
                        sb.Append("\r\n");
                    }
                    sb.Append(computer);
                    sb.Append("\t");
                    sb.Append(info.Index);
                    sb.Append("\t");
                    sb.Append(info.IP);
                    sb.Append("\t");
                    sb.Append(info.LinkSpeed);
                }
            }
            return(sb.ToString());
        }
Пример #3
0
        override protected string GetCsvData(string computer)
        {
            bool isPortOpened = true;
            bool SMBv1        = false;
            bool SMBv2_0x0202 = false;
            bool SMBv2_0x0210 = false;
            bool SMBv2_0x0300 = false;
            bool SMBv2_0x0302 = false;
            bool SMBv2_0x0311 = false;
            SMBSecurityModeEnum smbv1secmode = SMBSecurityModeEnum.NotTested;
            SMBSecurityModeEnum smbv2secmode = SMBSecurityModeEnum.NotTested;
            SMBSecurityModeEnum smbv2temp;

            try
            {
                try
                {
                    SMBv1 = Smb1Protocol.DoesServerSupportDialect(computer, "NT LM 0.12", out smbv1secmode);
                }
                catch (Smb1NotSupportedException)
                {
                }
                try
                {
                    SMBv2_0x0202 = Smb2ProtocolTest.DoesServerSupportDialectWithSmbV2(computer, 0x0202, out smbv2secmode);
                    SMBv2_0x0210 = Smb2ProtocolTest.DoesServerSupportDialectWithSmbV2(computer, 0x0210, out smbv2temp);
                    smbv2secmode = CombineSecurityMode(smbv2secmode, smbv2temp);
                    SMBv2_0x0300 = Smb2ProtocolTest.DoesServerSupportDialectWithSmbV2(computer, 0x0300, out smbv2temp);
                    smbv2secmode = CombineSecurityMode(smbv2secmode, smbv2temp);
                    SMBv2_0x0302 = Smb2ProtocolTest.DoesServerSupportDialectWithSmbV2(computer, 0x0302, out smbv2temp);
                    smbv2secmode = CombineSecurityMode(smbv2secmode, smbv2temp);
                    SMBv2_0x0311 = Smb2ProtocolTest.DoesServerSupportDialectWithSmbV2(computer, 0x0311, out smbv2temp);
                    smbv2secmode = CombineSecurityMode(smbv2secmode, smbv2temp);
                }
                catch (Smb2NotSupportedException)
                {
                }
            }
            catch (SmbPortClosedException)
            {
                isPortOpened = false;
            }
            return(computer + "\t" + (isPortOpened ? "Yes" : "No") + "\t" + (SMBv1 ? "Yes" : "No")
                   + "\t" + ((smbv1secmode & SMBSecurityModeEnum.SmbSigningRequired) != 0 ? "Yes" : "No")
                   + "\t" + (SMBv2_0x0202 ? "Yes" : "No")
                   + "\t" + (SMBv2_0x0210 ? "Yes" : "No")
                   + "\t" + (SMBv2_0x0300 ? "Yes" : "No")
                   + "\t" + (SMBv2_0x0302 ? "Yes" : "No")
                   + "\t" + (SMBv2_0x0311 ? "Yes" : "No")
                   + "\t" + ((smbv2secmode & SMBSecurityModeEnum.SmbSigningRequired) != 0 ? "Yes" : "No"));
        }