void client_OnMessage(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg) { // Client receive message cl.Send(new XPloitMsgLogin() { Domain = "?", User = "******", Password = "******", InResponseTo = msg.Id }); }
void client_OnMessage(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg) { // Client receive message cl.SendReply(new XPloitMsgLogin() { Domain = "?", User = "******", Password = "******" }, msg); }
public override bool Stop() { if (_Socket != null) { _Socket.Dispose(); _Socket = null; } return(true); }
void s_OnMessage2(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg) { // Server receive msg XPloitMsgString msgS = (XPloitMsgString)msg; //XPloitTelnetProtocol.Send(cl, XPloitTelnetProtocol.GetColorMessage()); //XPloitTelnetProtocol.Send(cl, new byte[] { 255, 247 }); XPloitTelnetProtocol.Send(cl, "Received: " + msgS.Data + Environment.NewLine); //isover = true; }
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 void TestSocketProtocol() { XPloitSocketProtocol proto = new XPloitSocketProtocol(Encoding.UTF8, XPloitSocketProtocol.EProtocolMode.UInt16); 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(); Thread.Sleep(100); 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 override bool Start() { Stop(); // Crypt password AESHelper crypt = null; if (!string.IsNullOrEmpty(_Config.CryptKey)) { crypt = new AESHelper(_Config.CryptKey, "Made with love ;)", 20000, "**#Int#Vector#**", AESHelper.EKeyLength.Length256); } _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()); }
void _Socket_OnMessage(XPloitSocket sender, XPloitSocketClient client, IXPloitSocketMsg msg) { }
void _Socket_OnDisconnect(XPloitSocket sender, XPloitSocketClient client, EDissconnectReason e) { }
void _Socket_OnConnect(XPloitSocket sender, XPloitSocketClient client) { }
void s_OnConnect2(XPloitSocket sender, XPloitSocketClient cl) { //XPloitTelnetProtocol.Send(cl, new byte[] { 255, 247 }); //XPloitTelnetProtocol.Send(cl, XPloitTelnetProtocol.GetColorMessage()); XPloitTelnetProtocol.Send(cl, "server to client" + Environment.NewLine); }
void s_OnMessage(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg) { // Server receive msg isover = true; }