Exemple #1
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);
                }
            }));
        }
Exemple #2
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);
                }
            }));
        }
Exemple #3
0
        private int _count; // Amount of accounts that successfully reported or commended

        public void StartReport(TitanAccount account, ReportInfo info)
        {
            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++;
                        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.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);
                }
            }));
        }