public static bool SupportSMB1(string server, out SMBSecurityModeEnum securityMode) { securityMode = SMBSecurityModeEnum.NotTested; try { return(Smb1Protocol.DoesServerSupportDialect(server, "NT LM 0.12", out securityMode)); } catch (Exception) { return(false); } }
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")); }