Exemplo n.º 1
0
        public void FinishBotting(TitanAccount acc = null)
        {
            if (acc != null)
            {
                if (acc.IsRunning)
                {
                    acc.Stop();
                }

                if (_taskDic.ContainsKey(acc))
                {
                    _taskDic.Remove(acc);
                }
            }
            else
            {
                foreach (var pair in _taskDic)
                {
                    if (pair.Key.IsRunning || !pair.Value.IsCompleted)
                    {
                        pair.Key.Stop();

                        _log.Warning("Forcefully finished botting of account {account}.",
                                     pair.Key.JsonAccount.Username);
                    }

                    _taskDic.Remove(pair.Key);
                }
            }
        }
Exemplo n.º 2
0
        public SharedSecret(TitanAccount account)
        {
            _log = LogCreator.Create("Shared Secret - " + account.JsonAccount.Username);

            _steamGuardAccount = new SteamGuardAccount
            {
                SharedSecret = account.JsonAccount.SharedSecret
            };
        }
Exemplo n.º 3
0
        public void FinishBotting(TitanAccount acc)
        {
            if (acc.IsRunning)
            {
                acc.Stop();
            }

            if (_taskDic.ContainsKey(acc))
            {
                _taskDic.Remove(acc);
            }
        }
Exemplo n.º 4
0
        public Sentry(TitanAccount account)
        {
            _log = LogCreator.Create("Sentry - " + account.JsonAccount.Username);

            var dir = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "sentries"));

            if (!dir.Exists)
            {
                dir.Create();
            }

            _file = new FileInfo(Path.Combine(dir.ToString(), account.JsonAccount.Username + ".sentry.bin"));
        }
Exemplo n.º 5
0
        public LoginKey(TitanAccount account)
        {
            _log = LogCreator.Create("Login Key - " + account.JsonAccount.Username);

            var dir = new DirectoryInfo(Path.Combine(Titan.Instance.Directory.ToString(), "loginkeys"));

            if (!dir.Exists)
            {
                dir.Create();
            }

            _file = new FileInfo(Path.Combine(dir.ToString(), account.JsonAccount.Username + ".key"));
        }
Exemplo n.º 6
0
        public bool TryGetAccount(string username, out TitanAccount output)
        {
            foreach (var keyPair in Accounts)
            {
                foreach (var account in keyPair.Value)
                {
                    if (account.JsonAccount.Username.Equals(username))
                    {
                        output = account;
                        return(true);
                    }
                }
            }

            output = default(TitanAccount);
            return(false);
        }
Exemplo n.º 7
0
        public void AddAccount(TitanAccount account)
        {
            if (!Accounts.ContainsKey(_lastIndex))
            {
                _lastIndex -= 1;
            }

            foreach (var keyPair in Accounts)
            {
                if (keyPair.Key == _lastIndex)
                {
                    if (keyPair.Value.Count < 11 && account.JsonAccount.Enabled)
                    {
                        keyPair.Value.Add(account);
                    }
                    else
                    {
                        _lastIndex += 1;
                    }
                }
            }

            if (!Accounts.ContainsKey(_lastIndex) && account.JsonAccount.Enabled)
            {
                var list = new List <TitanAccount>();

                Accounts.Add(_lastIndex, list);
            }

            if (account.JsonAccount.Enabled)
            {
                _allAccounts.Add(account);
                Accounts[-1] = _allAccounts;
            }

            if (!Titan.Instance.Options.Secure)
            {
                _log.Debug("Added account in index #{Index}: Username: {Username} / " +
                           "Password: {Password} / Sentry: {sentry} / Enabled: {Enabled}",
                           _lastIndex, account.JsonAccount.Username, account.JsonAccount.Password,
                           account.JsonAccount.Sentry, account.JsonAccount.Enabled);
            }
        }
Exemplo n.º 8
0
        public bool RemoveAccount(TitanAccount target)
        {
            _log.Information("Removing account {account}.", target.JsonAccount.Username);

            var success = false;

            foreach (var keyPair in Accounts)
            {
                if (keyPair.Value.Contains(target))
                {
                    keyPair.Value.Remove(target);
                    success = true;
                }
            }

            if (success)
            {
                _allAccounts.Remove(target);
            }

            return(success);
        }
Exemplo n.º 9
0
        public void StartMatchResolving(TitanAccount account, LiveGameInfo info)
        {
            if (_taskDic.ContainsKey(account))
            {
                _log.Warning("Account is already reporting / commending. Aborting forcefully!");

                FinishBotting(account);
            }

            account.FeedLiveGameInfo(info);

            _successCount = 0;
            _failCount    = 0;
            _count        = 0;

            Titan.Instance.IsBotting = true;

            _log.Debug("Starting Match ID resolving thread for {Target} using account {Account}.",
                       info.SteamID, account.JsonAccount.Username);

            _taskDic.Add(account, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    account.StartEpoch = DateTime.Now.ToEpochTime();

                    // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec.
                    var origin = Task.Run(() => account.Start());
                    var result = origin.RunUntil(account.JsonAccount.Sentry
                        ? TimeSpan.FromMinutes(3)
                        : TimeSpan.FromSeconds(60));

                    switch (result.Result)
                    {
                    case Result.Success:
                        _successCount++;
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not resolve Match ID with account {Account}. The account is " +
                                   "already logged in somewhere else.", account.JsonAccount.Username);
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        break;

                    case Result.Code2FAWrong:
                        _log.Error("The provided SteamGuard code was wrong. Please retry.");
                        break;
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = DateTime.Now.Subtract(account.StartEpoch.ToDateTime());

                    _log.Error("Connection to account {Account} timed out. It was not possible to resolve the Match " +
                               "ID for the target after {Timespan} seconds.", account.JsonAccount.Username,
                               timeSpent.Seconds);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        account.Stop();
                    }

                    _taskDic.Remove(account);
                }
            }));

            _successCount = 0;
        }
Exemplo n.º 10
0
        private int _count;        // Amount of accounts that started reporting / commending

        public void StartReport(TitanAccount account, ReportInfo info)
        {
            if (_taskDic.ContainsKey(account))
            {
                _log.Warning("Account is already reporting / commending. Aborting forcefully!");

                FinishBotting(account);
            }

            account.FeedReportInfo(info);

            _successCount = 0;
            _failCount    = 0;
            _count        = 0;

            Titan.Instance.IsBotting = true;

            _log.Debug("Starting reporting thread for {Target} in {Match} using account {Account}.",
                       info.SteamID, info.MatchID, account.JsonAccount.Username);

            _taskDic.Add(account, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    account.StartEpoch = DateTime.Now.ToEpochTime();

                    // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec.
                    var origin = Task.Run(() => account.Start());
                    var result = origin.RunUntil(account.JsonAccount.Sentry
                        ? TimeSpan.FromMinutes(3)
                        : TimeSpan.FromSeconds(60));
                    _count++;

                    switch (result.Result)
                    {
                    case Result.Success:
                        _successCount++;
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not report with account {Account}. The account is " +
                                   "already logged in somewhere else.", account.JsonAccount.Username);
                        _failCount++;
                        break;

                    case Result.AccountBanned:
                        _log.Error("Account {Account} has a cooldown on record. The report has been aborted.",
                                   account.JsonAccount.Username);
                        _failCount++;
                        break;

                    case Result.NoMatches:
                        _log.Error("Could not receive match information for {Account}: User is not in live match.",
                                   account._liveGameInfo.SteamID.ConvertToUInt64());
                        _failCount++;
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        _failCount++;
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        _failCount++;
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        _failCount++;
                        break;

                    case Result.Code2FAWrong:
                        _log.Error("The provided SteamGuard code was wrong. Please retry.");
                        _failCount++;
                        break;

                    default:
                        _failCount++;
                        break;
                    }

                    if (_count - _successCount - _failCount == 0)
                    {
                        if (_successCount == 0)
                        {
                            _log.Error("FAIL! Titan was not able to report target {Target}.",
                                       info.SteamID.ConvertToUInt64());

                            Titan.Instance.UIManager.SendNotification(
                                "Titan", "Titan was not able to report your target."
                                );

                            if (Titan.Instance.ParsedObject != null)
                            {
                                Titan.Instance.IsBotting = false;
                            }
                        }
                        else
                        {
                            _log.Information(
                                "SUCCESS! Titan has successfully sent {Amount} out of {Fail} reports to target {Target}.",
                                _successCount, _count, info.SteamID.ConvertToUInt64());

                            Titan.Instance.UIManager.SendNotification(
                                "Titan", _successCount + " reports have been successfully sent!"
                                );

                            if (Titan.Instance.ParsedObject != null)
                            {
                                Titan.Instance.IsBotting = false;
                            }
                        }
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = DateTime.Now.Subtract(account.StartEpoch.ToDateTime());

                    _log.Error("Connection to account {Account} timed out. It was not possible to " +
                               "report the target after {Timespan} seconds.", account.JsonAccount.Username,
                               timeSpent.Seconds);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        account.Stop();
                    }

                    _taskDic.Remove(account);
                }
            }));
        }
Exemplo n.º 11
0
        public void StartIdling(TitanAccount account, IdleInfo info)
        {
            if (_taskDic.ContainsKey(account))
            {
                _log.Warning("Account is already reporting / commending / idling. Aborting forcefully!");

                FinishBotting(account);
            }

            account.FeedIdleInfo(info);

            _count = 0;

            _log.Debug("Starting idling thread in games {@Games} using account {Account}.",
                       info.GameID, account.JsonAccount.Username);

            _taskDic.Add(account, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    account.StartTick = DateTime.Now.Ticks;

                    var result = WaitFor <Result> .Run(TimeSpan.FromMinutes(info.Minutes + 2), account.Start);

                    switch (result)
                    {
                    case Result.Success:
                        _count++;

                        if (account.IsLast)
                        {
                            _log.Information("SUCCESS! Titan has successfully idled {Amount} times in {Games}.",
                                             _count, account._idleInfo.GameID.ToString());

                            Titan.Instance.UIManager.SendNotification(
                                "Titan", _count + "x was idled in " + account._idleInfo.GameID + " games!"
                                );

                            account.IsLast = false;
                        }
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not idle with account {Account}. The account is " +
                                   "already logged in somewhere else.", account.JsonAccount.Username);
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        break;

                    case Result.NoMatches:
                        _log.Error("Could not find a live match for target.");
                        break;
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick));

                    _log.Error("Connection to account {Account} timed out. It was not possible to " +
                               "stop idle in the games after {Timespan} seconds.",
                               account.JsonAccount.Username, timeSpent.Seconds);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        account.Stop();
                    }

                    _taskDic.Remove(account);
                }
            }));
        }
Exemplo n.º 12
0
        private int _count; // Amount of accounts that successfully reported or commended

        public void StartReport(TitanAccount account, ReportInfo info)
        {
            if (_taskDic.ContainsKey(account))
            {
                _log.Warning("Account is already reporting / commending / idling. Aborting forcefully!");

                FinishBotting(account);
            }

            account.FeedReportInfo(info);

            _count = 0;

            _log.Debug("Starting reporting thread for {Target} in {Match} using account {Account}.",
                       info.SteamID, info.MatchID, account.JsonAccount.Username);

            _taskDic.Add(account, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    account.StartTick = DateTime.Now.Ticks;

                    // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec.
                    var result = WaitFor <Result> .Run(account.JsonAccount.Sentry ?
                                                       TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60), account.Start);

                    switch (result)
                    {
                    case Result.Success:
                        _count++;

                        if (account.IsLast)
                        {
                            _log.Information("SUCCESS! Titan has successfully sent {Amount} reports to {Target}.",
                                             _count, account._reportInfo.SteamID.ConvertToUInt64());

                            Titan.Instance.UIManager.SendNotification(
                                "Titan", _count + " reports have been successfully sent!"
                                );

                            account.IsLast = false;
                        }
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not report with account {Account}. The account is " +
                                   "already logged in somewhere else.", account.JsonAccount.Username);
                        break;

                    case Result.AccountBanned:
                        _log.Warning("Account {Account} has VAC or game bans on record. The report may " +
                                     "have not been submitted.");
                        _count++;
                        break;

                    case Result.NoMatches:
                        _log.Error("Could not receive match information for {Account}: User is not in live match.",
                                   account._liveGameInfo.SteamID.ConvertToUInt64());
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        break;
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick));

                    _log.Error("Connection to account {Account} timed out. It was not possible to " +
                               "report the target after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        account.Stop();
                    }

                    _taskDic.Remove(account);
                }
            }));
        }
Exemplo n.º 13
0
        public void StartCommend(TitanAccount account, CommendInfo info)
        {
            account.FeedCommendInfo(info);

            _count = 0;

            _log.Debug("Starting commending thread for {Target} using account {Account}.",
                       info.SteamID, account.JsonAccount.Username);

            _taskDic.Add(account, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    account.StartTick = DateTime.Now.Ticks;

                    // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec.
                    var result = WaitFor <Result> .Run(account.JsonAccount.Sentry ?
                                                       TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60), account.Start);

                    switch (result)
                    {
                    case Result.Success:
                        _count++;
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not commend with account {Account}. The account is " +
                                   "already logged in somewhere else.", account.JsonAccount.Username);
                        break;

                    case Result.AccountBanned:
                        _log.Warning("Account {Account} has VAC or game bans on record. The report may " +
                                     "have not been submitted.");
                        _count++;
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        break;
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick));

                    _log.Error("Connection to account {Account} timed out. It was not possible to " +
                               "commend the target after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        account.Stop();
                    }

                    _taskDic.Remove(account);
                }
            }));
        }
Exemplo n.º 14
0
        public void StartIdling(TitanAccount account, IdleInfo info)
        {
            account.FeedIdleInfo(info);

            _count = 0;

            _log.Debug("Starting idling thread in games {@Games} using account {Account}.",
                       info.GameID, account.JsonAccount.Username);

            _taskDic.Add(account, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    account.StartTick = DateTime.Now.Ticks;

                    var result = WaitFor <Result> .Run(TimeSpan.FromMinutes(info.Minutes + 2), account.Start);

                    switch (result)
                    {
                    case Result.Success:
                        _count++;
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not idle with account {Account}. The account is " +
                                   "already logged in somewhere else.", account.JsonAccount.Username);
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        break;
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick));

                    _log.Error("Connection to account {Account} timed out. It was not possible to " +
                               "stop idle in the games after {Timespan} seconds.",
                               account.JsonAccount.Username, timeSpent.Seconds);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        account.Stop();
                    }

                    _taskDic.Remove(account);
                }
            }));
        }
Exemplo n.º 15
0
        private int _count; // Amount of accounts that successfully reported or commended

        public void Start(BotMode mode, TitanAccount acc, uint target, ulong matchId)
        {
            acc.Feed(new Info
            {
                Mode    = mode,
                Target  = target,
                MatchID = matchId
            });

            _count = 0;

            _log.Debug("Starting {Mode} thread for {Target} in match {MatchId} " +
                       "using account {Account}.", mode.ToString().ToLower() + "ing", target, matchId, acc.JsonAccount.Username);

            _taskDic.Add(acc, Task.Run(() =>
            {
                var timedOut = false;

                try
                {
                    acc.StartTick = DateTime.Now.Ticks;

                    // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec.
                    var result = WaitFor <Result> .Run(acc.JsonAccount.Sentry ?
                                                       TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60), acc.Start);

                    switch (result)
                    {
                    case Result.Success:
                        _count++;
                        break;

                    case Result.AlreadyLoggedInSomewhereElse:
                        _log.Error("Could not report with account {Account}. The account is " +
                                   "already logged in somewhere else.", acc.JsonAccount.Username);
                        break;

                    case Result.AccountBanned:
                        _log.Warning("Account {Account} has VAC or game bans on record. The report may " +
                                     "have not been submitted.");
                        _count++;
                        break;

                    case Result.TimedOut:
                        _log.Error("Processing thread for {Account} has timed out.");
                        break;

                    case Result.SentryRequired:
                        _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " +
                                   "in the accounts.json file.", "sentry", true);
                        break;

                    case Result.RateLimit:
                        _log.Error("The Steam Rate Limit has been reached. Please try again in a " +
                                   "few minutes.");
                        break;
                    }
                }
                catch (TimeoutException)
                {
                    var timeSpent = new DateTime(DateTime.Now.Ticks - acc.StartTick);

                    _log.Error("Connection to account {Account} timed out. It was not possible to " +
                               "report the target after {Timespan} seconds.", acc.JsonAccount.Username, timeSpent.Second);
                    timedOut = true;
                }
                finally
                {
                    if (timedOut)
                    {
                        acc.Stop();
                    }

                    _taskDic.Remove(acc);
                }
            }));
        }