SessionTest_Connecting_ServerSendsIgnoreMessageBeforeKexInit_NoStrictKex.cs 986 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Net.Sockets;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using Renci.SshNet.Messages.Transport;
  4. namespace Renci.SshNet.Tests.Classes
  5. {
  6. [TestClass]
  7. public class SessionTest_Connecting_ServerSendsIgnoreMessageBeforeKexInit_NoStrictKex : SessionTest_ConnectingBase
  8. {
  9. protected override bool ServerSupportsStrictKex
  10. {
  11. get
  12. {
  13. return false;
  14. }
  15. }
  16. protected override void ActionBeforeKexInit()
  17. {
  18. var ignoreMessage = new IgnoreMessage();
  19. var ignore = ignoreMessage.GetPacket(8, null);
  20. // MitM sends ignore message to client
  21. _ = ServerSocket.Send(ignore, 4, ignore.Length - 4, SocketFlags.None);
  22. // MitM drops server message
  23. ServerOutboundPacketSequence++;
  24. }
  25. [TestMethod]
  26. public void DoesNotThrowException()
  27. {
  28. Session.Connect();
  29. }
  30. }
  31. }