public void TestSocketProtocol() { XPloitSocketProtocol proto = new XPloitSocketProtocol(Encoding.UTF8, XPloitSocketProtocol.EProtocolMode.Byte); using (XPloitSocket server = new XPloitSocket(proto, 77) { TimeOut = TimeSpan.Zero }) using (XPloitSocket client = new XPloitSocket(proto, "127.0.0.1:77") { TimeOut = TimeSpan.Zero }) { server.OnMessage += s_OnMessage; server.Start(); client.OnMessage += client_OnMessage; client.Start(); IXPloitSocketMsg ret = server.Clients[0].SendAndWait(new XPloitMsgLogin() { Domain = "2500bytes".PadLeft(2000, ' '), User = "******", Password = "******" }); if (ret != null) { isover = true; } while (!isover) Thread.Sleep(1); } }
public void TestTelnetProtocol() { using (XPloitSocket server = new XPloitSocket(new XPloitTelnetProtocol(Encoding.UTF8), 23) { TimeOut = TimeSpan.Zero }) { server.OnConnect += s_OnConnect2; server.OnMessage += s_OnMessage2; server.Start(); while (!isover) Thread.Sleep(1); } }
public override bool Start() { Stop(); // Crypt password AESHelper crypt = null; if (_Config.CryptKey != null && !string.IsNullOrEmpty(_Config.CryptKey.RawPassword)) crypt = new AESHelper(_Config.CryptKey.RawPassword, "Made with love ;)", 20000, "**#Int#Vector#**", AESHelper.EKeyLength.Length_256); _Socket = new XPloitSocket(new XPloitSocketProtocol(_Codec, crypt, XPloitSocketProtocol.EProtocolMode.UInt16), _Config.Address, _Config.Port, _IsServer) { IPFilter = _IPFilter, TimeOut = TimeSpan.Zero }; _Socket.OnConnect += _Socket_OnConnect; _Socket.OnDisconnect += _Socket_OnDisconnect; _Socket.OnMessage += _Socket_OnMessage; return _Socket.Start(); }