示例#1
0
        private void OnConnected(SteamClient.ConnectedCallback callback)
        {
            Console.WriteLine($"Connected to Steam! Logging in {_login}...");

            SteamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = _login,
                Password = _password
            });
        }
示例#2
0
        static void OnConnected(SteamClient.ConnectedCallback callback)
        {
            Console.WriteLine("Connected to Steam! Logging in '{0}'...", user);

            steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = user,
                Password = pass,
            });
        }
示例#3
0
        void OnConnected(SteamClient.ConnectedCallback callback)
        {
            Console.WriteLine($"Зашел в стим.\nЛогинюсь в {username}...");

            steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = username,
                Password = password
            });
        }
示例#4
0
    // called when the client successfully (or unsuccessfully) connects to steam
    void OnConnected(SteamClient.ConnectedCallback callback)
    {
        Console.WriteLine("Connected! Logging '{0}' into Steam...", userName);

        // we've successfully connected, so now attempt to logon
        user.LogOn(new SteamUser.LogOnDetails
        {
            Username = userName,
            Password = password,
        });
    }
示例#5
0
        ////////////////////////////////////////////////////
        // CALLBACKS
        ////////////////////////////////////////////////////

        public override void OnConnected(SteamClient.ConnectedCallback callback)
        {
            _log.Debug("Successfully connected to Steam. Logging in...");

            _steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = JsonAccount.Username,
                Password = JsonAccount.Password,
                LoginID  = RandomUtil.RandomUInt32()
            });
        }
 void OnConnected(SteamClient.ConnectedCallback pData)
 {
     Console.WriteLine("Connected to Steam! Logging in '{0}'...", GetConfigValue("username"));
     SteamUser.LogOnDetails details = new SteamUser.LogOnDetails
     {
         Username = GetConfigValue("username"),
         Password = GetConfigValue("password"),
     };
     m_SteamUser.LogOn(details);
     m_SteamID = m_SteamClient.SteamID;
 }
示例#7
0
        static void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback.ToString() != "SteamKit2.SteamClient+ConnectedCallback")
            {
                Console.WriteLine("[" + Program.BOTNAME + "] - Unable to connect to Steam: {0}", callback.ToString());

                isRunning = false;
                return;
            }
            //Sucess
            Console.WriteLine("[" + Program.BOTNAME + "] - Connected to Steam! Logging in '{0}'...", user);

            byte[] sentryHash = null;
            if (File.Exists(Program.SentryFolder + user + ".bin"))
            {
                byte[] sentryFile = File.ReadAllBytes(Program.SentryFolder + user + ".bin");
                sentryHash = CryptoHelper.SHAHash(sentryFile);
            }

            //Set LoginKey for user
            var list = JsonConvert.DeserializeObject <RootObject>(File.ReadAllText(Program.AccountsJsonFile));

            foreach (var a in list.Accounts)
            {
                if (a.username == user)
                {
                    if (string.IsNullOrEmpty(a.LoginKey) || a.LoginKey.ToString() == "undefined")// redo
                    {
                    }
                    else
                    {
                        NewloginKey = a.LoginKey;
                        myUniqueId  = a.LoginKey;
                        File.WriteAllText(Program.AccountsJsonFile, JsonConvert.SerializeObject(list, Formatting.Indented)); // update login key
                    }
                }
            }


            steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = user,
                Password = pass,
                //
                AuthCode       = authCode,
                TwoFactorCode  = twoFactorAuth,
                SentryFileHash = sentryHash,
                //
                LoginID = 1337,
                ShouldRememberPassword = true,
                LoginKey = NewloginKey
            });
        }
示例#8
0
 public static void LogOn()
 {
     Log.Instance.Verbose("Logging in...");
     steamUser.LogOn(new SteamUser.LogOnDetails
     {
         Username       = username,
         Password       = password,
         AuthCode       = authCode,
         TwoFactorCode  = twoFactorAuth,
         SentryFileHash = sentryHash
     });
 }
示例#9
0
        private void onConnected(SteamClient.ConnectedCallback callback)
        {
            log.DebugFormat("Connection callback from Steam, eresult: {0}", callback.Result);
            if (callback.Result != EResult.OK)
            {
                State = BotState.Failed;
                return;
            }

            State = BotState.LoggingIn;
            User.LogOn(Logon);
        }
示例#10
0
        public void LogOn(string userName, string userPassword)
        {
            SteamUser.LogOnDetails userDetails = new SteamUser.LogOnDetails();
            userDetails.Username = userName;
            userDetails.Password = userPassword;
            user.LogOn(userDetails);

            while (!loggedOn)
            {
                manager.RunWaitCallbacks(TimeSpan.FromMilliseconds(100));
            }
        }
示例#11
0
        private void OnConnected(SteamKit2.SteamClient.ConnectedCallback callback)
        {
            ConsoleSystem.Log("Connected to Steam! Logging in '{0}'...", _user);

            _steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = _user,
                Password = _password,

                AuthCode      = _authCode,
                TwoFactorCode = _twoFactorAuth
            });
        }
示例#12
0
        static void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback.Result != EResult.OK)
            {
                Console.WriteLine("Unable to connect to Steam: {0}", callback.Result);
                System.Threading.Thread.Sleep(5000);
                steamClient.Connect();
                return;
            }

            Console.WriteLine("Connected to Steam! Logging in '{0}'...", username);

            byte[] sentryHash = null;
            if (File.Exists("sentry.bin"))
            {
                // if we have a saved sentry file, read and sha-1 hash it
                byte[] sentryFile = File.ReadAllBytes("sentry.bin");
                sentryHash = CryptoHelper.SHAHash(sentryFile);
            }

            steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = username,
                Password = password,

                // in this sample, we pass in an additional authcode
                // this value will be null (which is the default) for our first logon attempt
                AuthCode = authCode,

                // if the account is using 2-factor auth, we'll provide the two factor code instead
                // this will also be null on our first logon attempt
                TwoFactorCode = twoFactorAuth,

                // our subsequent logons use the hash of the sentry file as proof of ownership of the file
                // this will also be null for our first (no authcode) and second (authcode only) logon attempts
                SentryFileHash = sentryHash,
            });
        }
示例#13
0
        ///// <summary>
        ///// Link a mobile authenticator to bot account
        ///// Called from bot manager console. Usage: "exec [index] linkauth"
        ///// If successful, 2FA will be required upon the next login.
        ///// Use "exec [index] getauth" if you need to get a Steam Guard code for the account.
        ///// To deactivate the authenticator, use "exec [index] unlinkauth".
        ///// </summary>
        //void LinkMobileAuth()
        //{
        //    new Thread(() =>
        //    {
        //        var login = new SteamAuth.UserLogin(logOnDetails.Username, logOnDetails.Password);
        //        var loginResult = login.DoLogin();
        //        if (loginResult == SteamAuth.LoginResult.NeedEmail)
        //        {
        //            while (loginResult == SteamAuth.LoginResult.NeedEmail)
        //            {
        //                Log.Interface("Enter Steam Guard code from email (type \"input [index] [code]\"):");
        //                var emailCode = WaitForInput();
        //                login.EmailCode = emailCode;
        //                loginResult = login.DoLogin();
        //            }
        //        }
        //        if (loginResult == SteamAuth.LoginResult.LoginOkay)
        //        {
        //            Log.Info("Linking mobile authenticator...");
        //            var authLinker = new SteamAuth.AuthenticatorLinker(login.Session);
        //            var addAuthResult = authLinker.AddAuthenticator();
        //            if (addAuthResult == SteamAuth.AuthenticatorLinker.LinkResult.MustProvidePhoneNumber)
        //            {
        //                while (addAuthResult == SteamAuth.AuthenticatorLinker.LinkResult.MustProvidePhoneNumber)
        //                {
        //                    Log.Interface("Enter phone number with country code, e.g. +1XXXXXXXXXXX (type \"input [index] [number]\"):");
        //                    var phoneNumber = WaitForInput();
        //                    authLinker.PhoneNumber = phoneNumber;
        //                    addAuthResult = authLinker.AddAuthenticator();
        //                }
        //            }
        //            if (addAuthResult == SteamAuth.AuthenticatorLinker.LinkResult.AwaitingFinalization)
        //            {
        //                SteamGuardAccount = authLinker.LinkedAccount;
        //                try
        //                {
        //                    var authFile = Path.Combine("authfiles", String.Format("{0}.auth", logOnDetails.Username));
        //                    Directory.CreateDirectory(Path.Combine(System.Windows.Forms.Application.StartupPath, "authfiles"));
        //                    File.WriteAllText(authFile, Newtonsoft.Json.JsonConvert.SerializeObject(SteamGuardAccount));
        //                    Log.Interface("Enter SMS code (type \"input [index] [code]\"):");
        //                    var smsCode = WaitForInput();
        //                    var authResult = authLinker.FinalizeAddAuthenticator(smsCode);
        //                    if (authResult == SteamAuth.AuthenticatorLinker.FinalizeResult.Success)
        //                    {
        //                        Log.Success("Linked authenticator.");
        //                    }
        //                    else
        //                    {
        //                        Log.Error("Error linking authenticator: " + authResult);
        //                    }
        //                }
        //                catch (IOException)
        //                {
        //                    Log.Error("Failed to save auth file. Aborting authentication.");
        //                }
        //            }
        //            else
        //            {
        //                Log.Error("Error adding authenticator: " + addAuthResult);
        //            }
        //        }
        //        else
        //        {
        //            if (loginResult == SteamAuth.LoginResult.Need2FA)
        //            {
        //                Log.Error("Mobile authenticator has already been linked!");
        //            }
        //            else
        //            {
        //                Log.Error("Error performing mobile login: "******"sentryfiles"));
            //FileInfo fi = new FileInfo(System.IO.Path.Combine("sentryfiles", String.Format("{0}.sentryfile", logOnDetails.Username)));

            //if (fi.Exists && fi.Length > 0)
            //    logOnDetails.SentryFileHash = SHAHash(File.ReadAllBytes(fi.FullName));
            //else
            //    logOnDetails.SentryFileHash = null;

            SteamUser.LogOn(logOnDetails);
        }
示例#14
0
        private void ConnectedCallback(SteamClient.ConnectedCallback connected)
        {
            DebugLog.WriteLine("Steam3Session", " Done!");
            bConnecting = false;
            bConnected  = true;

            if (authenticatedUser)
            {
                DebugLog.WriteLine("Steam3Session", "Logging '" + logonDetails.Username + "' into Steam3...");
                steamUser.LogOn(logonDetails);
            }

            onConnected?.Invoke();
        }
示例#15
0
        public void Login(string username, string password, string authCode)
        {
            client.Connect();
            var callback = client.WaitForCallback();
            var connect  = callback as ConnectCallback;

            if (connect == null || connect.Result != EResult.OK)
            {
                Fatal("Connection failed");
                return;
            }

            var credentials = new SteamUser.LogOnDetails {
                Username = username,
                Password = password,
                AuthCode = authCode,
            };

            user.LogOn(credentials);
            callback = client.WaitForCallback();
            LogOnCallback login = callback as LogOnCallback;

            if (login == null)
            {
                Fatal("Login failed");
                return;
            }
            else
            {
                switch (login.Result)
                {
                case EResult.OK: break;

                case EResult.AccountLogonDenied:
                case EResult.AccountLogonDeniedNoMailSent:
                    Fatal("Steam guard authentication needed");
                    return;

                default:
                    Fatal("Login failed");
                    return;
                }
            }

            foreach (var friend in friends.GetFriends())
            {
                NotifyAddedBuddy(friend);
            }
        }
示例#16
0
        static void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback.Result != EResult.OK)
            {
                // Connection failure.
                Console.WriteLine(":: Unable to connect to Steam! ({0})", callback.Result);
                isRunning = false;
                return;
            }

            Console.WriteLine(":: Connected to Steam! Logging in as '{0}'..", Username);
            steamUser.LogOn(new SteamUser.LogOnDetails {
                Username = Username, Password = Password
            });
        }
示例#17
0
        void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            form.AddLog(String.Format("Connected to Steam servers! Logging '{0}' into Steam...", accountUsername));

            steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = accountUsername,
                Password = accountPassword
            });
        }
示例#18
0
 private void ConnectedCallback(SteamClient.ConnectedCallback connected)
 {
     Console.WriteLine(" Done!");
     bConnected = true;
     if (!authenticatedUser)
     {
         Console.Write("Logging anonymously into Steam3...");
         steamUser.LogOnAnonymous();
     }
     else
     {
         Console.Write("Logging '{0}' into Steam3...", logonDetails.Username);
         steamUser.LogOn(logonDetails);
     }
 }
示例#19
0
 private static void OnConnected(SteamClient.ConnectedCallback obj)
 {
     options.WithParsed(opt =>
     {
         user.LogOn(new SteamUser.LogOnDetails()
         {
             Username = opt.Username,
             Password = opt.Password,
             LoginID  = opt.LoginId,
             ShouldRememberPassword = true,
             TwoFactorCode          = twoFactorAuth,
             AuthCode = authCode
         });
     });
 }
示例#20
0
 private void OnConnected(SteamClient.ConnectedCallback callback)
 {
     Trace.WriteLine("Connected to Steam! Logging in ...", "Steam");
     byte[] sentryHash = null;
     if (System.IO.File.Exists("sentry.bin"))
     {
         sentryHash = CryptoHelper.SHAHash(System.IO.File.ReadAllBytes("sentry.bin"));
     }
     SteamUser.LogOn(new SteamUser.LogOnDetails {
         Username       = User,
         Password       = Pass,
         AuthCode       = SteamGuardCode,
         SentryFileHash = sentryHash,
     });
 }
示例#21
0
 private void OnConnected(SteamClient.ConnectedCallback callback)
 {
     if (callback.Result != EResult.OK)
     {
         _exception = new ConnectionException("Unable to connect to Steam: " + callback.Result.ToString());
         return;
     }
     //Connected to Steam! Logging in
     _isRunning = SteamManagerStatus.LoggingIn;
     _steamUser.LogOn(new SteamUser.LogOnDetails
     {
         Username = _user,
         Password = _pass,
     });
 }
示例#22
0
 private void OnConnected(SteamClient.ConnectedCallback callback)
 {
     Log.Info("Connected to Steam! Logging in '{0}'...", Username);
     if (Username == "anonymous")
     {
         steamUser.LogOnAnonymous();
     }
     else
     {
         steamUser.LogOn(new SteamUser.LogOnDetails
         {
             Username = Username,
             Password = password
         });
     }
 }
示例#23
0
        static void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback.Result != EResult.OK)
            {
                Console.WriteLine("Unable to connect to Steam: {0}", callback.Result);
                isRunning = false;
                return;
            }

            Console.WriteLine("Connected to Steam! Logging in '{0}'...", user);
            steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = user,
                Password = pass,
            });
        }
示例#24
0
        void UserLogOn()
        {
            // get sentry file which has the machine hw info saved
            // from when a steam guard code was entered
            FileInfo fi = new FileInfo(String.Format("{0}.sentryfile", logOnDetails.Username));

            if (fi.Exists && fi.Length > 0)
            {
                logOnDetails.SentryFileHash = SHAHash(File.ReadAllBytes(fi.FullName));
            }
            else
            {
                logOnDetails.SentryFileHash = null;
            }

            SteamUser.LogOn(logOnDetails);
        }
示例#25
0
 private void ConnectedCallback(SteamClient.ConnectedCallback connected)
 {
     Log.Info(" Done!");
     bConnecting = false;
     bConnected  = true;
     if (!authenticatedUser)
     {
         Log.Info("Logging anonymously into Steam3...");
         steamUser.LogOnAnonymous();
     }
     else
     {
         Log.Info("Logging '{0}' into Steam3...", logonDetails.Username);
         steamUser.LogOn(logonDetails);
         LoginSuccessHandlers?.Invoke();
     }
 }
示例#26
0
        ////////////////////////////////////////////////////
        // CALLBACKS
        ////////////////////////////////////////////////////

        public override void OnConnected(SteamClient.ConnectedCallback callback)
        {
            _log.Debug("Sentry has been activated for this account. Checking if a sentry file " +
                       "exists and hashing it...");

            var hash = _sentry.Hash();

            _steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username       = JsonAccount.Username,
                Password       = JsonAccount.Password,
                AuthCode       = _authCode,
                TwoFactorCode  = _2FactorCode,
                SentryFileHash = hash.Length > 0 ? hash : null,
                LoginID        = RandomUtil.RandomUInt32()
            });
        }
示例#27
0
        private void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            if (callback.Result != EResult.OK)
            {
                Logging.LogGenericError(BotName, "Unable to connect to Steam: " + callback.Result);
                return;
            }

            Logging.LogGenericInfo(BotName, "Connected to Steam!");

            byte[] sentryHash = null;
            if (File.Exists(SentryFile))
            {
                byte[] sentryFileContent = File.ReadAllBytes(SentryFile);
                sentryHash = CryptoHelper.SHAHash(sentryFileContent);
            }

            string steamLogin = SteamLogin;

            if (string.IsNullOrEmpty(steamLogin) || steamLogin.Equals("null"))
            {
                steamLogin           = Program.GetUserInput(BotName, Program.EUserInputType.Login);
                Config["SteamLogin"] = steamLogin;
            }

            string steamPassword = SteamPassword;

            if (string.IsNullOrEmpty(steamPassword) || steamPassword.Equals("null"))
            {
                steamPassword           = Program.GetUserInput(BotName, Program.EUserInputType.Password);
                Config["SteamPassword"] = steamPassword;
            }

            SteamUser.LogOn(new SteamUser.LogOnDetails {
                Username       = steamLogin,
                Password       = steamPassword,
                AuthCode       = AuthCode,
                TwoFactorCode  = TwoFactorAuth,
                SentryFileHash = sentryHash
            });
        }
示例#28
0
        static public void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback == null)
            {
                return;
            }
            informationsteam = (String.Format("Покдючен к стиму!"));

            byte[] sentryHash = null;

            if (File.Exists(SentryFileName))
            {
                byte[] sentryFileContent = File.ReadAllBytes(SentryFileName);
                sentryHash = CryptoHelper.SHAHash(sentryFileContent);
            }

            string loginKey = null;

            if (File.Exists(LoginKeyFileName))
            {
                loginKey = File.ReadAllText(LoginKeyFileName);
            }
            if (TwoFactorCode == null && Config.SteamLoginToken != null)
            {
                SteamGuardAccount account = new SteamGuardAccount();
                account.SharedSecret = Config.SteamLoginToken;
                TwoFactorCode        = account.GenerateSteamGuardCode();
            }


            informationsteam = (String.Format("Вхожу в аккаунт..."));
            startedAt        = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

            SteamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username               = Config.SteamLogin,
                Password               = loginKey == null ? Config.SteamPassword : null,
                AuthCode               = loginKey == null ? AuthCode : null,
                LoginID                = MsgClientLogon.ObfuscationMask,
                LoginKey               = loginKey,
                TwoFactorCode          = loginKey == null ? TwoFactorCode : null,
                SentryFileHash         = sentryHash,
                ShouldRememberPassword = true
            });
        }
示例#29
0
        ////////////////////////////////////////////////////
        // CALLBACKS
        ////////////////////////////////////////////////////

        public override void OnConnected(SteamClient.ConnectedCallback callback)
        {
            _log.Debug("Successfully connected to Steam. Logging in...");

            var loginID = RandomUtil.RandomUInt32();

            if (!Titan.Instance.Options.Secure)
            {
                _log.Debug("Logging in with Login ID: {id}", loginID);
            }

            _steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username = JsonAccount.Username,
                Password = JsonAccount.Password,
                LoginID  = loginID
            });
        }
示例#30
0
 private void OnConnected(SteamClient.ConnectedCallback connectedCallback)
 {
     try
     {
         if (connectedCallback.Result != EResult.OK)
         {
             _logger.Fatal($"#{SequenceNumber} Connected callback invalid result: {connectedCallback.Result}");
             return;
         }
         _logger.Info($"#{SequenceNumber} Connected.");
         _steamUser.LogOn(LogOnDetails);
     }
     catch (Exception e)
     {
         _logger.Fatal($"#{SequenceNumber} Fatal unhandled exception (OnConnected) : {e.Message}");
         Restart();
     }
 }