Esempio n. 1
0
 void client_OnMessage(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg)
 {
     // Client receive message
     cl.Send(new XPloitMsgLogin()
     {
         Domain = "?", User = "******", Password = "******", InResponseTo = msg.Id
     });
 }
Esempio n. 2
0
 void client_OnMessage(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg)
 {
     // Client receive message
     cl.SendReply(new XPloitMsgLogin()
     {
         Domain = "?", User = "******", Password = "******"
     }, msg);
 }
Esempio n. 3
0
        public override bool Stop()
        {
            if (_Socket != null)
            {
                _Socket.Dispose();
                _Socket = null;
            }

            return(true);
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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);
                }
            }
        }
Esempio n. 6
0
        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);
                    }
                }
        }
Esempio n. 7
0
        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());
        }
Esempio n. 8
0
 void _Socket_OnMessage(XPloitSocket sender, XPloitSocketClient client, IXPloitSocketMsg msg)
 {
 }
Esempio n. 9
0
 void _Socket_OnDisconnect(XPloitSocket sender, XPloitSocketClient client, EDissconnectReason e)
 {
 }
Esempio n. 10
0
 void _Socket_OnConnect(XPloitSocket sender, XPloitSocketClient client)
 {
 }
Esempio n. 11
0
 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);
 }
Esempio n. 12
0
 void s_OnMessage(XPloitSocket sender, XPloitSocketClient cl, IXPloitSocketMsg msg)
 {
     // Server receive msg
     isover = true;
 }