public XPloitSocketProtocol(Encoding codec, AESHelper crypt, EProtocolMode mode)
        {
            _Codec = codec;
            _Crypt = crypt;
            _Mode = mode;

            // Header is present
            _HeaderLength = (byte)mode;

            _HeaderPadding = new byte[_HeaderLength];
            _MaxLength = (int)Math.Pow(255, _HeaderLength);
            WriteLengthInPacket(_HeaderPadding, 0, _MaxLength);
        }
Exemple #2
0
        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.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();
        }
 public XPloitSocketProtocol(AESHelper crypt, EProtocolMode mode) : this(Encoding.UTF8, crypt, mode) { }