public override void Build()
        {
            SendingBuffer  = @"\pi\\profileid\" + _result.UserProfile.ProfileId;
            SendingBuffer += @"\nick\" + _result.UserProfile.Nick;
            SendingBuffer += @"\uniquenick\" + _result.UserProfile.UniqueNick;
            SendingBuffer += @"\email\" + _result.UserProfile.Email;
            SendingBuffer += @"\firstname\" + _result.UserProfile.Firstname;
            SendingBuffer += @"\lastname\" + _result.UserProfile.Lastname;
            SendingBuffer += @"\icquin\" + _result.UserProfile.Icquin;
            SendingBuffer += @"\homepage\" + _result.UserProfile.Homepage;
            SendingBuffer += @"\zipcode\" + _result.UserProfile.Zipcode;
            SendingBuffer += @"\countrycode\" + _result.UserProfile.Countrycode;
            SendingBuffer += @"\lon\" + _result.UserProfile.Longitude;
            SendingBuffer += @"\lat\" + _result.UserProfile.Longitude;
            SendingBuffer += @"\loc\" + _result.UserProfile.Location;

            int birthStr = (int)_result.UserProfile.Birthday << 24 | (int)_result.UserProfile.Birthmonth << 16 | (int)_result.UserProfile.Birthyear;

            SendingBuffer += @"\birthday\" + birthStr;
            SendingBuffer += @"\sex\" + _result.UserProfile.Sex;
            SendingBuffer += @"\publicmask\" + _result.UserProfile.Publicmask;
            SendingBuffer += @"\aim\" + _result.UserProfile.Aim;
            SendingBuffer += @"\picture\" + _result.UserProfile.Picture;
            SendingBuffer += @"\ooc" + _result.UserProfile.Occupationid;
            SendingBuffer += @"\ind\" + _result.UserProfile.Industryid;
            SendingBuffer += @"\inc\" + _result.UserProfile.Incomeid;
            SendingBuffer += @"\mar\" + _result.UserProfile.Marriedid;
            SendingBuffer += @"\chc\" + _result.UserProfile.Childcount;
            SendingBuffer += @"\i1\" + _result.UserProfile.Interests1;
            SendingBuffer += @"\o1\" + _result.UserProfile.Ownership1;
            SendingBuffer += @"\conn\" + _result.UserProfile.Connectiontype;
            // SUPER NOTE: Please check the Signature of the PID, otherwise when it will be compared with other peers, it will break everything (See gpiPeer.c @ peerSig)
            SendingBuffer += @"\sig\+" + GameSpyRandom.GenerateRandomString(10, GameSpyRandom.StringType.Hex);
            SendingBuffer += @"\id\" + _request.OperationID + @"\final\";
        }
Пример #2
0
        public string GenerateServerChallenge()
        {
            //response total length bigger than 38bytes
            // challenge length should be bigger than 20bytes
            string serverChallengeKey = GameSpyRandom.GenerateRandomString(20, GameSpyRandom.StringType.Alpha);
            //string sendingBuffer = string.Format(@"\challenge\{0}\final\", ServerChallengeKey);
            //sendingBuffer = xor(sendingBuffer);
            string sendingBuffer = string.Format(@"\challenge\{0}", serverChallengeKey);

            return(sendingBuffer);
        }
Пример #3
0
        public void SendServerChallenge()
        {
            // Only send the login challenge once
            if (PlayerInfo.LoginProcess != LoginStatus.Connected)
            {
                DisconnectByReason(DisconnectReason.ClientChallengeAlreadySent);
                // Throw the error
                ToLog(LogLevel.Warning, "The server challenge has already been sent. Cannot send another login challenge.");
            }

            // We send the client the challenge key
            string serverChallengeKey = GameSpyRandom.GenerateRandomString(10, GameSpyLib.Common.GameSpyRandom.StringType.Alpha);

            PlayerInfo.ServerChallenge = serverChallengeKey;
            PlayerInfo.LoginProcess    = LoginStatus.Processing;
            string sendingBuffer = string.Format(@"\lc\1\challenge\{0}\id\{1}\final\", serverChallengeKey, 1);

            SendAsync(sendingBuffer);
        }
Пример #4
0
        /// <summary>
        /// Elevates security, for use with CRYPT method.
        /// </summary>
        public void ElevateSecurity(string secretKey)
        {
            string Info = $"{ServerName} Elevating security for user {Id} with game {chatUserInfo.gameName}";

            ToLog(Info);

            // 1. Generate the two keys
            string clientKey = GameSpyRandom.GenerateRandomString(16, GameSpyRandom.StringType.Alpha);
            string serverKey = GameSpyRandom.GenerateRandomString(16, GameSpyRandom.StringType.Alpha);

            // 2. Prepare two keys
            ChatCrypt.Init(chatUserInfo.ClientCTX, clientKey, secretKey);
            ChatCrypt.Init(chatUserInfo.ServerCTX, serverKey, secretKey);

            // 3. Response the crypt command
            SendCommand(ChatRPL.SecureKey, "* " + clientKey + " " + serverKey);

            // 4. Start using encrypted connection
            chatUserInfo.encrypted = true;
        }
Пример #5
0
        protected override void DataOperation()
        {
            using (var db = new retrospyContext())
            {
                var result = from p in db.Profiles
                             join s in db.Subprofiles on p.Profileid equals s.Profileid
                             join u in db.Users on p.Userid equals u.Userid
                             where p.Profileid == _profileid && s.Namespaceid == _session.UserInfo.NamespaceID
                             select new
                {
                    nick           = p.Nick,
                    profileid      = p.Profileid,
                    uniquenick     = s.Uniquenick,
                    email          = u.Email,
                    firstname      = p.Firstname,
                    lastname       = p.Lastname,
                    icquin         = p.Icquin,
                    homepage       = p.Homepage,
                    zipcode        = p.Zipcode,
                    countrycode    = p.Countrycode,
                    longitude      = p.Longitude,
                    latitude       = p.Latitude,
                    location       = p.Location,
                    birthday       = p.Birthday,
                    birthmonth     = p.Birthmonth,
                    birthyear      = p.Birthyear,
                    sex            = p.Sex,
                    publicmask     = p.Publicmask,
                    aim            = p.Aim,
                    picture        = p.Picture,
                    occupationid   = p.Occupationid,
                    industryid     = p.Industryid,
                    incomeid       = p.Incomeid,
                    marriedid      = p.Marriedid,
                    childcount     = p.Childcount,
                    interest1      = p.Interests1,
                    ownership1     = p.Ownership1,
                    connectiontype = p.Connectiontype,
                };

                if (result.Count() == 0)
                {
                    _errorCode = GPErrorCode.DatabaseError;
                    return;
                }

                var info = result.First();

                _sendingBuffer  = @"\pi\\profileid\" + info.profileid;
                _sendingBuffer += @"\nick\" + info.nick;
                _sendingBuffer += @"\uniquenick\" + info.uniquenick;
                _sendingBuffer += @"\email\" + info.email;
                _sendingBuffer += @"\firstname\" + info.firstname;
                _sendingBuffer += @"\lastname\" + info.lastname;
                _sendingBuffer += @"\icquin\" + info.icquin;
                _sendingBuffer += @"\homepage\" + info.homepage;
                _sendingBuffer += @"\zipcode\" + info.zipcode;
                _sendingBuffer += @"\countrycode\" + info.countrycode;
                _sendingBuffer += @"\lon\" + info.countrycode;
                _sendingBuffer += @"\lat\" + info.latitude;
                _sendingBuffer += @"\loc\" + info.location;

                int tempbirth = (int)info.birthday << 24 | (int)info.birthmonth << 16 | (int)info.birthyear;

                _sendingBuffer += @"\birthday\" + tempbirth;
                _sendingBuffer += @"\sex\" + info.sex;
                _sendingBuffer += @"\publicmask\" + info.publicmask;
                _sendingBuffer += @"\aim\" + info.aim;
                _sendingBuffer += @"\picture\" + info.picture;
                _sendingBuffer += @"\ooc" + info.occupationid;
                _sendingBuffer += @"\ind\" + info.industryid;
                _sendingBuffer += @"\inc\" + info.incomeid;
                _sendingBuffer += @"\mar\" + info.marriedid;
                _sendingBuffer += @"\chc\" + info.childcount;
                _sendingBuffer += @"\i1\" + info.interest1;
                _sendingBuffer += @"\o1\" + info.ownership1;
                _sendingBuffer += @"\conn\" + info.connectiontype;
                // SUPER NOTE: Please check the Signature of the PID, otherwise when it will be compared with other peers, it will break everything (See gpiPeer.c @ peerSig)
                _sendingBuffer += @"\sig\+" + GameSpyRandom.GenerateRandomString(10, GameSpyRandom.StringType.Hex);
                _sendingBuffer += @"\id\" + _operationID + @"\final\";
            }
        }