コード例 #1
0
        static void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            myUniqueId = callback.UniqueID.ToString();

            steamUser.AcceptNewLoginKey(callback);


            var list = JsonConvert.DeserializeObject <RootObject>(File.ReadAllText(Program.AccountsJsonFile));

            foreach (var a in list.Accounts)
            {
                if (a.username == user)
                {
                    a.LoginKey  = callback.LoginKey; // check this
                    NewloginKey = callback.LoginKey; // check this

                    if (a.SteamID.ToString() == "0") //add null or empty?
                    {
                        a.SteamID = steamClient.SteamID.ConvertToUInt64();
                    }
                    Console.WriteLine("[" + Program.BOTNAME + "] - Got Login-Key, setting in config!");
                }
            }
            File.WriteAllText(Program.AccountsJsonFile, JsonConvert.SerializeObject(list, Formatting.Indented));
        }
コード例 #2
0
 private void OnLoginKey(SteamUser.LoginKeyCallback callback)
 {
     if (rememberLogin)
     {
         File.WriteAllText("login.dat", $"{username}|{callback.LoginKey}");
     }
 }
コード例 #3
0
ファイル: Chat.cs プロジェクト: toaster468/discord
 public static void HandleLogin(SteamUser.LoginKeyCallback msg)
 {
     Steam.Friends.SetPersonaName(String.IsNullOrWhiteSpace(Configurator.Config.BotName) ? "AgopBot" : Configurator.Config.BotName);
     Steam.Friends.SetPersonaState((EPersonaState)6); // Looking to Play - hehe.
     //Join(103582791430091926);
     Join(103582791433166824);
 }
コード例 #4
0
        void OnLoginKeyCallback(SteamUser.LoginKeyCallback cb)
        {
            var login_key_ack = new ClientMsgProtobuf <CMsgClientNewLoginKeyAccepted>(EMsg.ClientNewLoginKeyAccepted);

            login_key_ack.Body.unique_id = cb.UniqueID;

            Instance.SteamClient.Send(login_key_ack);
        }
コード例 #5
0
ファイル: Steam.cs プロジェクト: eai04191/OnPS
 private void OnLoginKey(SteamUser.LoginKeyCallback callback)
 {
     if (string.IsNullOrEmpty(callback.LoginKey))
     {
         return;
     }
     IniModel.SetSteamLoginKey(callback.LoginKey);
     steamUser.AcceptNewLoginKey(callback);
 }
コード例 #6
0
        private void LoginKeyCallback(SteamUser.LoginKeyCallback loginKey)
        {
            Console.WriteLine("Accepted new login key for account {0}", logonDetails.Username);

            ConfigStore.TheConfig.LoginKeys[logonDetails.Username] = loginKey.LoginKey;
            ConfigStore.Save();

            steamUser.AcceptNewLoginKey(loginKey);
        }
コード例 #7
0
        private void LoginKeyCallback(SteamUser.LoginKeyCallback loginKey)
        {
            DebugLog.WriteLine("Steam3Session", "Accepted new login key for account " + logonDetails.Username);

            ConfigStore.TheConfig.LoginKeys[logonDetails.Username] = loginKey.LoginKey;
            ConfigStore.Save();

            steamUser.AcceptNewLoginKey(loginKey);
        }
コード例 #8
0
        private void LoginKeyCallback(SteamUser.LoginKeyCallback loginKey)
        {
            Console.WriteLine("Accepted new login key for account {0}", logonDetails.Username);

            AccountSettingsStore.Instance.LoginKeys[logonDetails.Username] = loginKey.LoginKey;
            AccountSettingsStore.Save();

            steamUser.AcceptNewLoginKey(loginKey);
        }
コード例 #9
0
 /// <summary>
 /// This is fired when steam gives the login key, so we store it
 /// </summary>
 /// <param name="callback"></param>
 private void OnLoginKey(SteamUser.LoginKeyCallback callback)
 {
     if ((callback != null) && (!string.IsNullOrEmpty(callback.LoginKey))) //Check if the data is valid
     {
         steamUser.AcceptNewLoginKey(callback);                            //Tell steam we have accepted their offering
         File.WriteAllText(LoginKeyFile, callback.LoginKey);               //We now will write the data
         LoginData.LoginKey = callback.LoginKey;                           //We will now set the login Key used in Log-in
         Console.WriteLine("Wrote New LoginKey");                          //Tell the user we have wrote a new login key file
     }
 }
コード例 #10
0
ファイル: EventHandler.cs プロジェクト: kraxarn/dashe4
        private void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            // Save unique ID to use with SteamCommunity
            kraxbot.UniqueID = callback.UniqueID;

            // Save key to file
            File.WriteAllTextAsync("loginkey", callback.LoginKey);
            kraxbot.AcceptNewLoginKey(callback);
            Kraxbot.Log("Saved login key");
        }
コード例 #11
0
ファイル: CSGOClient.cs プロジェクト: Kaotic/csgo-bot
        void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            File.WriteAllText(loginKeyFileName, callback.LoginKey);
            steamUser.AcceptNewLoginKey(callback);
        }
コード例 #12
0
 void OnKeyGet(SteamUser.LoginKeyCallback callback)
 {
     if (RememberMe == true && File.Exists("sentry.bin"))
     {
         byte[] newpass    = Encoding.Unicode.GetBytes(callback.LoginKey);
         byte[] newphashed = CryptoHelper.SymmetricEncrypt(newpass, getstandardkey());
         File.WriteAllBytes("UserKey.bin", newphashed);
         Console.WriteLine("UserKey encrypted and stored!", Console.ForegroundColor = ConsoleColor.Green);
         Console.ResetColor();
     }
 }
コード例 #13
0
        private void LoginKeyCallback(SteamUser.LoginKeyCallback loginKey)
        {
            Log.Info("Accepted new login key for account {0}", logonDetails.Username);

            AccountSettingsStore.Instance.LoginKeys[logonDetails.Username] = loginKey.LoginKey;
            AccountSettingsStore.Save();

            steamUser.AcceptNewLoginKey(loginKey);

            bDidReceiveLoginKey = true;
        }
コード例 #14
0
        static public void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            informationsteam = (String.Format("Обновляю ключ..."));
            File.WriteAllText(LoginKeyFileName, callback.LoginKey);

            SteamUser.AcceptNewLoginKey(callback);
            informationsteam = (String.Format("Обновляю ключ...готово!"));
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: yretenai/EngineCategorizer
        private void OnLoginKey(SteamUser.LoginKeyCallback obj)
        {
            Logger.Log24Bit(ConsoleSwatch.XTermColor.Pink, false, Console.Out, string.Empty,
                            "Updating login key file... ");
            if (File.Exists("login.key"))
            {
                File.Delete("login.key");
            }

            User.AcceptNewLoginKey(obj);
            File.WriteAllText("login.key", obj.LoginKey);
            Logger.Log24Bit(ConsoleSwatch.XTermColor.Pink, true, Console.Out, string.Empty, "Done!");
        }
コード例 #16
0
        static public void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            informationsteam = (String.Format("Updating key..."));
            File.WriteAllText(LoginKeyFileName, callback.LoginKey);

            SteamUser.AcceptNewLoginKey(callback);
            informationsteam = (String.Format("Updating key... Done!"));
        }
コード例 #17
0
        private void LoginKey(SteamUser.LoginKeyCallback callback)
        {
            myUniqueId = callback.UniqueID.ToString();
            UserWebLogOn();

            Console.WriteLine("Steam Bot Logged In Completely!");

            LoggedIn = true;

            if (!botThread.IsBusy)
            {
                botThread.RunWorkerAsync();
            }

            ScanMarket();
        }
コード例 #18
0
        /// <summary>
        /// Retreive the login key for account
        /// </summary>
        /// <param name="callback">SteamUser.LoginKeyCallback</param>
        private void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            /*With the LoginKey we'll be able to auto-login to the account
             * without the user needing to enter their Authentication code*/
            mLog.Write(Log.LogLevel.Info, $"Received LoginKey from Steam");
            mAccountSettings.Details.LoginKey = callback.LoginKey;
            mSteam.loginDetails.LoginKey      = callback.LoginKey;

            mSteam.uniqueId = callback.UniqueID.ToString();
            mSteam.user.AcceptNewLoginKey(callback);

            if (mAccountSettings.ConnectToSteamCommunity)
            {
                mLog.Write(Log.LogLevel.Info, $"Authenticating user ...");
                UserWebLogOn();
            }
        }
コード例 #19
0
        ///<summary>
        /// Authenticate using SteamKit2 and ISteamUserAuth.
        /// This does the same as SteamWeb.DoLogin(), but without contacting the Steam Website.
        /// </summary>
        /// <remarks>Should this one doesnt work anymore, use <see cref="SteamWeb.DoLogin"/></remarks>
        public static bool Authenticate(SteamUser.LoginKeyCallback callback, SteamClient client, out string sessionId, out string token)
        {
            sessionId = Convert.ToBase64String(Encoding.UTF8.GetBytes(callback.UniqueID.ToString()));

            using (dynamic userAuth = WebAPI.GetInterface("ISteamUserAuth"))
            {
                // generate an AES session key
                var sessionKey = CryptoHelper.GenerateRandomBlock(32);

                // rsa encrypt it with the public key for the universe we're on
                byte[] cryptedSessionKey = null;
                using (RSACrypto rsa = new RSACrypto(KeyDictionary.GetPublicKey(client.ConnectedUniverse)))
                {
                    cryptedSessionKey = rsa.Encrypt(sessionKey);
                }


                byte[] loginKey = new byte[20];
                Array.Copy(Encoding.ASCII.GetBytes(callback.LoginKey), loginKey, callback.LoginKey.Length);

                // aes encrypt the loginkey with our session key
                byte[] cryptedLoginKey = CryptoHelper.SymmetricEncrypt(loginKey, sessionKey);

                KeyValue authResult;

                try
                {
                    authResult = userAuth.AuthenticateUser(
                        steamid: client.SteamID.ConvertToUInt64(),
                        sessionkey: HttpUtility.UrlEncode(cryptedSessionKey),
                        encrypted_loginkey: HttpUtility.UrlEncode(cryptedLoginKey),
                        method: "POST"
                        );
                }
                catch (Exception)
                {
                    token = null;
                    return(false);
                }

                token = authResult ["token"].AsString();

                return(true);
            }
        }
コード例 #20
0
            public void OnLoginKey(SteamUser.LoginKeyCallback e)
            {
                Bot._myUniqueId = e.UniqueID.ToString();

                Bot._userWebLogOn();

                if (Trade.CurrentSchema == null)
                {
                    Log.Info("Downloading Schema...");
                    Trade.CurrentSchema = Schema.FetchSchema(Bot.ApiKey, Bot.schemaLang);
                    Log.Success("Schema Downloaded!");
                }

                Bot.SteamFriends.SetPersonaName(Bot.DisplayNamePrefix + Bot.DisplayName);
                Bot.SteamFriends.SetPersonaState(EPersonaState.Online);

                Log.Success("Steam Bot Logged In Completely!");

                Bot._getUserHandler(Bot.SteamClient.SteamID).OnLoginCompleted();
            }
コード例 #21
0
        private void OnKeyCallback(SteamUser.LoginKeyCallback obj)
        {
            var test       = new SteamWeb();
            var IsLoggedIn = false;

            do
            {
                IsLoggedIn = test.Authenticate(obj.UniqueID.ToString(), _client, _userNonce);

                if (!IsLoggedIn)
                {
                    //Log.Warn("Authentication failed, retrying in 2s...");
                    Thread.Sleep(2000);
                }
            } while (!IsLoggedIn);

            var c**k   = test.VerifyCookies();
            var steamh = new SteamHandler(test);

            Token = steamh.GetNextTocken();

            _client.Disconnect();
        }
コード例 #22
0
        private async void OnLoginKeyReceived(SteamUser.LoginKeyCallback loginKeyCallback)
        {
            try
            {
                CookieManager.LoginKeyUniqueId = loginKeyCallback.UniqueID;
                CookieManager.CookiesExpired  += async(sender, args) =>
                {
                    try
                    {
                        var webApiUserNonceCallback = await _steamUser.RequestWebAPIUserNonce();

                        if (webApiUserNonceCallback.Result != EResult.OK)
                        {
                            _logger.Warn(
                                $"#{SequenceNumber} Invalid WebAPIUserNonceCallback result: {webApiUserNonceCallback.Result}");
                        }
                        CookieManager.WebApiUserNonce = webApiUserNonceCallback.Nonce;
                        await CookieManager.Refresh();
                    }
                    catch (TaskCanceledException)
                    {
                        _logger.Warn($"#{SequenceNumber} Request new WebAPIUserNonce timeout.");
                    }
                    catch (Exception e)
                    {
                        _logger.Fatal($"#{SequenceNumber} Request new WebAPIUserNonce unhandled exception.", e);
                    }
                };
                await CookieManager.Refresh();
            }
            catch (Exception e)
            {
                _logger.Fatal($"#{SequenceNumber} Fatal unhandled exception (OnLoginKeyReceived) : {e.Message}");
                Restart();
            }
        }
コード例 #23
0
 private void OnSteamLoginKey(SteamUser.LoginKeyCallback data)
 {
     SteamSentryManager.WriteLoginKey(data, Globals.AppState.LoginState.Username);
 }
コード例 #24
0
 private void OnKeyCallback(SteamUser.LoginKeyCallback obj)
 {
     _steamAccount.LoginKey = obj.LoginKey;
     _steamAccount.Save();
 }
コード例 #25
0
 public static void WriteLoginKey(SteamUser.LoginKeyCallback data, string username)
 {
     AccountSettingsStore.Instance.LoginKeys[username] = data.LoginKey;
     AccountSettingsStore.Save();
 }
コード例 #26
0
ファイル: Bot.cs プロジェクト: Steam-Chat-Bot/SteamChatBot
 private static void OnLoginKeyCallback(SteamUser.LoginKeyCallback callback)
 {
     steamFriends.SetPersonaState(EPersonaState.Online);
     steamFriends.SetPersonaName(displayName);
 }
コード例 #27
0
 private static void OnLoginKey(SteamUser.LoginKeyCallback obj)
 {
     user.AcceptNewLoginKey(obj);
     Console.WriteLine($"Your login key: {obj.LoginKey}");
     user.LogOff();
 }
コード例 #28
0
 private void onLoginKey(SteamUser.LoginKeyCallback callback)
 {
     Program.steam.isRunning = false;
     this.closeForm();
 }
コード例 #29
0
 private void OnLoginKey(SteamUser.LoginKeyCallback callback)
 {
     _authenticationProvider.SaveLoginKey(Credentials, callback.LoginKey);
     _steamUser.AcceptNewLoginKey(callback);
 }
コード例 #30
0
ファイル: Kraxbot.cs プロジェクト: kraxarn/dashe4
 public void AcceptNewLoginKey(SteamUser.LoginKeyCallback loginKey) => user.AcceptNewLoginKey(loginKey);