Exemple #1
0
        private async Task <bool> SolvingCaptcha(string url)
        {
            bool result = false;

            string k = GetReCaptchaKey();

            if (String.IsNullOrEmpty(k))
            {
                return(result);
            }

            if (!ShowReCaptchaResponseField())
            {
                return(result);
            }

            ReCaptchaArgs args  = new ReCaptchaArgs(k, url);
            string        token = await CaptchaSolver?.GetResult(args);

            if (String.IsNullOrEmpty(token))
            {
                return(result);
            }

            result = FillReCaptchaToken(token);

            return(result);
        }
Exemple #2
0
        public Game()
        {
            _username        = null;
            _password        = null;
            _trainerId       = 0;
            _roster          = new Pokemon[6];
            _money           = 0;
            _teamPoints      = 0;
            _banned          = false;
            _refLink         = "http://www.tppcrpg.net/stats.php";
            _running         = false;
            _stats           = new Statistic();
            _catpcha         = new CaptchaSolver(Properties.Resources.Captcha);
            _random          = new Random();
            _monitor         = new AutoResetEvent(false);
            _finished        = new AutoResetEvent(false);
            _host            = new KeyValuePair <string, string>("Host", "www.tppcrpg.net");
            _origin          = new KeyValuePair <string, string>("Origin", "http://www.tppcrpg.net");
            _ajax            = new KeyValuePair <string, string>("X-Requested-With", "XMLHttpRequest");
            _acceptAjax      = new KeyValuePair <string, string>("Accept", "*/*");
            _acceptLanguage  = new KeyValuePair <string, string>("Accept-Language", "en-US,en;q=0.8");
            _cacheControl    = new KeyValuePair <string, string>("Cache-Control", "max-age=0");
            _upgradeRequests = new KeyValuePair <string, string>("Upgrade-Insecure-Requests", "1");
            _imageHost       = new KeyValuePair <string, string>("Host", "graphics.tppcrpg.net");

            Accept                 = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            AcceptImage            = "image/webp,image/*,*/*;q=0.8";
            AutomaticDecompression = System.Net.DecompressionMethods.GZip;
        }
Exemple #3
0
 /// <summary>
 /// Ensures the Captcha is filled in correctly.
 /// </summary>
 public static void Captcha(IRequest request, IResponse response, ICaptchaRequest dtoRequest)
 {
     if (!CaptchaSolver.Solve(request.RemoteIp, dtoRequest.Captcha))
     {
         throw new ArgumentException("Spamschutz wurde falsch ausgefüllt! Versuchs nocheinmal oder wende dich direkt per Mail an uns!");
     }
 }
Exemple #4
0
        public bool Register(string EMail, CaptchaSolver captchaSolver, string friendId = "", string friendHash = "")
        {
            EMail = EMail.Replace("+", "%2B");
            string response = network.DownloadString(url + string.Format("?action=newPlayer&function=createAvatar&fh={0}&friendId={3}&list=0&kid=&gclid=&password={1}&email={2}&agb=on", friendHash, password, EMail, friendId));

            while (response.Replace(" ", "").Contains("captchaForm"))
            {
                byte[] captchaData = network.DownloadData(url + "?action=NoUser&function=createCaptcha&rand=" + random.Next(0, 99999).ToString());
                captchaSolver.image = captchaData;

                string captchaID;
                bool   success;
                string captchaValue = captchaSolver.SendCaptcha(out captchaID, out success);
                if (success && captchaValue != null)
                {
                    response = network.DownloadString(url + string.Format("?registrationCaptcha={0}&action=newPlayer&function=createAvatar&friend=0&checksum&password={1}&name={2}&email={3}&agb=on&kid&friendId={4}&list=0&ssoMode=0&oiUrl&fh={5}&state&altNames&errors[0]=39", captchaValue, password, userName, EMail, friendId, friendHash));
                    captchaSolver.CaptchaWorked(captchaID, !response.Replace(" ", "").Contains("captchaForm"));
                }
            }

            network = new Network(connection, url);
            bool result = Login(EMail);

            if (result)
            {
                response = network.AjaxHandlerRequest(string.Format("action=TutorialOperations&function=updateTutorialData&disableTutorial=false&avatarName={0}&email={1}&agb=on&cityId={2}&signUp=1&backgroundView=city&currentCityId={2}&ajax=1", userName, EMail, currentCity.ID), Relogin);
            }
            return(result);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            LOGGER.Info("Starting...");
            CaptchaSolver solver = new CaptchaSolver();

            solver.Run();
        }
Exemple #6
0
        public void SolveCaptchaPartTwoTest()
        {
            CaptchaSolver solver   = new CaptchaSolver("12131415");
            int           solution = solver.SolveCaptcha(4);

            Assert.AreEqual(4, solution);
        }
Exemple #7
0
        public void PirateMission(string missionLevel, CaptchaSolver captchaSolver)
        {
            string response = network.AjaxHandlerRequest(string.Format("action=PiracyScreen&function=capture&buildingLevel={1}&view=pirateFortress&cityId={0}&position=17&activeTab=tabBootyQuest&backgroundView=city&currentCityId={0}&templateView=pirateFortress", currentCity.ID, missionLevel), Relogin);

            if (response.Contains("captchaNeeded=1"))
            {
                byte[] captchaData = null;
                try
                {
                    captchaData = network.DownloadData(url + "?action=Options&function=createCaptcha&rand=" + random.Next(0, 99999).ToString());
                }
                catch (Exception exc) { }

                //Captcha solve
                captchaSolver.image = captchaData;

                string captchaID;
                bool   success;
                string captchaValue = captchaSolver.SendCaptcha(out captchaID, out success);
                if (!success)
                {
                    captchaValue = "None";
                }

                network.AjaxHandlerRequest(string.Format("action=PiracyScreen&function=capture&cityId={0}&position=17&captchaNeeded=1&activeTab=tabBootyQuest&backgroundView=city&templateView=pirateFortress&currentCityId={0}&buildingLevel={1}&ajax=1&captcha={2}", currentCity.ID, missionLevel, captchaValue), Relogin);

                if (success)
                {
                    captchaSolver.CaptchaWorked(captchaID, !response.Contains("captchaNeeded=1"));
                }
            }
        }
Exemple #8
0
        public void SolveCaptchaPartOneTest()
        {
            CaptchaSolver solver   = new CaptchaSolver("91212129");
            int           solution = solver.SolveCaptcha(1);

            Assert.AreEqual(9, solution);
        }
Exemple #9
0
        public void CaptchaSolver_Returns_digit_value_for_1_digit_captcha()
        {
            var captchaSolver = new CaptchaSolver();

            var result = captchaSolver.Solve("2");

            Assert.AreEqual(2, result);
        }
Exemple #10
0
        public void CaptchaSolver_Returns_the_only_matching_value()
        {
            var captchaSolver = new CaptchaSolver();

            var result = captchaSolver.Solve("212");

            Assert.AreEqual(2, result);
        }
Exemple #11
0
        public void CaptchaSolver_solves_first_day_challenge()
        {
            var captchaSolver = new CaptchaSolver();

            var result = captchaSolver.Solve("31813174349235972159811869755166343882958376474278437681632495222499211488649543755655138842553867246131245462881756862736922925752647341673342756514856663979496747158241792857625471323535183222497949751644488277317173496124473893452425118133645984488759128897146498831373795721661696492622276282881218371273973538163779782435211491196616375135472517935481964439956844536136823757764494967297251545389464472794474447941564778733926532741752757865243946976266426548341889873514383464142659425122786667399143335772174973128383869893325977319651839516694295534146668728822393452626321892357192574444856264721585365164945647254645264693957898373214897848424966266582991272496771159583715456714645585576641458358326521858518319315233857473695712238323787254556597566461188452279853766184333696344395818615215846348586541164194624371353556812548945447432787795489443312941687221314432694115847863129826532628228386894683392352799514942665396273726821936346663485499159141368443782475714679953213388375939519711591262489869326145476958378464652451441434846382474578535468433514121336844727988128998543975147649823215332929623574231738442281161294838499441799996857746549441142859199799125595761724782225452394593514388571187279266291364278184761833324476838939898258225748562345853633364314923186685534864178665214135631494876474186833392929124337161222959459117554238429216916532175247326391321525832362274683763488347654497889261543959591212539851835354335598844669618391876623638137926893582131945361264841733341247646125278489995838369127582438419889922365596554237153412394494932582424222479798382932335239274297663365164912953364777876187522324991837775492621675953397843833247525599771974555545348388871578347332456586949283657613841414576976542343934911424716613479249893113961925713317644349946444271959375981158445151659431844142242547191181944395897963146947935463718145169266129118413523541222444997678726644615185324461293228124456118853885552279849917342474792984425629248492847827653133583215539325866881662159421987315186914769478947389188382383546881622246793781846254253759714573354544997853153798862436887889318646643359555663135476261863");

            Assert.AreEqual(1203, result);
        }
Exemple #12
0
        public void CaptchaSolver_Returns_sum_if_3_consecutive_digits_match()
        {
            var captchaSolver = new CaptchaSolver();

            var result = captchaSolver.Solve("222");

            Assert.AreEqual(6, result);
        }
 public TruantPropertyTaxRecord(RemoteWebDriver driver, string ParcelNumber) :
     base(driver)
 {
     _searchFramework = new SearchFramework(_driver);
     _accountParcelSummaryFramework = new AccountParcelSummaryFramework(_driver);
     _parcelNumber   = ParcelNumber;
     _captchaSolver  = new CaptchaSolver(_userName, _password);
     _captchaBalance = _captchaSolver.Balance;
 }
Exemple #14
0
        public void TestCaptcha(string captcha, string result, bool isPt2)
        {
            //arrange
            var captchaSolver = new CaptchaSolver();
            //act
            var captchaResult = captchaSolver.SolveCatpcha(captcha, isPt2);

            //assert
            Assert.AreEqual(result, captchaResult);
        }
Exemple #15
0
 private void btnImageTypersBalance_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(this.txtImageTypersUsername.Text) && !string.IsNullOrEmpty(this.txtImageTypersPassword.Text))
     {
         TaskScheduler current;
         this.txtImageTypersUsername.Background = (Brush)Application.Current.FindResource("ButtonBackground");
         this.txtImageTypersPassword.Background = (Brush)Application.Current.FindResource("ButtonBackground");
         if (SynchronizationContext.Current != null)
         {
             current = TaskScheduler.FromCurrentSynchronizationContext();
         }
         else
         {
             current = TaskScheduler.Current;
         }
         this.btnImageTypersBalance.IsEnabled = false;
         this.btnImageTypersBalance.Opacity   = 0.6;
         this.progBarImageTypers.Visibility   = Visibility.Visible;
         this.progBarImageTypers.IsEnabled    = true;
         double balance = -1.0;
         Task.Factory.StartNew(() => balance = CaptchaSolver.ImageTypersGetBalance()).ContinueWith(delegate(Task t) {
             if (balance == -1.0)
             {
                 this.lblImageTypersBalance.Text = "error";
             }
             else
             {
                 this.lblImageTypersBalance.Text = "$" + balance.ToString();
             }
             this.btnImageTypersBalance.IsEnabled = true;
             this.btnImageTypersBalance.Opacity   = 1.0;
             this.progBarImageTypers.Visibility   = Visibility.Hidden;
             this.progBarImageTypers.IsEnabled    = false;
         }, current);
     }
     else
     {
         if (string.IsNullOrEmpty(this.txtImageTypersUsername.Text))
         {
             this.txtImageTypersUsername.Background = (Brush)Application.Current.FindResource("MissingFieldBackground");
         }
         else
         {
             this.txtImageTypersUsername.Background = (Brush)Application.Current.FindResource("ButtonBackground");
         }
         if (string.IsNullOrEmpty(this.txtImageTypersPassword.Text))
         {
             this.txtImageTypersPassword.Background = (Brush)Application.Current.FindResource("MissingFieldBackground");
         }
         else
         {
             this.txtImageTypersPassword.Background = (Brush)Application.Current.FindResource("ButtonBackground");
         }
     }
 }
Exemple #16
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (disposing)
         {
             Clear();
             watchers = null;
             CaptchaSolver?.Dispose();
             CaptchaSolver = null;
             WriteLog(" ***** Destroyed ***** ");
         }
         disposedValue = true;
     }
 }
Exemple #17
0
        public void Register()
        {
            new Thread(delegate()
            {
                if (register.InvokeRequired)
                {
                    Invoke(new Action(() => { register.Enabled = false; }));
                }
                else
                {
                    register.Enabled = false;
                }

                //Register
                string friendId = user.GetFriendId(inviteURL);
                if (!friendId.Equals(""))
                {
                    AddToLog(lang.Get("Misc", "FriendID") + ": " + friendId);
                }

                CaptchaSolver captchaSolver = CaptchaFactory.Captcha(
                    Settings.Instance.Get("CaptchaProvider", "Manual"),
                    Settings.Instance.Get("CaptchaUsername", ""),
                    Settings.Instance.Get("CaptchaPassword", "")
                    );

                bool open = false;
                for (int i = 0; i < 1; i++)
                {
                    open = user.Register(EMail, captchaSolver, friendId, Ikariam.User.GetFriendHash(inviteURL));
                    if (open)
                    {
                        break;
                    }
                }

                if (!open)
                {
                    AddToLog(lang.Get("Misc", "Error") + ": " + lang.Get("WebView", "Registered"));
                    return;
                }

                AddToLog(lang.Get("WebView", "Registered") + " (" + server_address + ") " + user.GetCurrentCity().Cords);

                AddToLog(lang.Get("Piracy", "CityID") + ": " + user.GetCurrentCity().ID);

                if (IS_SPAM_BOT)
                {
                    while (!user.IsEMailVerified())
                    {
                        AddToLog("Email is not verified, retring in 1 minute");
                        Thread.Sleep(ONE_MINUTE + RandomInteger(10000, 20000));
                    }
                    AddToLog("EMail is verified");
                    //Highscore table
                    int countMessgaes = 0;
                    for (int page = offset; page < pages + offset; page++)
                    {
                        List <string> users = user.GetHighScoreTable(page);

                        foreach (string player in users)
                        {
                            if (0 != countMessgaes && 0 == countMessgaes % 5)
                            {
                                Thread.Sleep(FIVE_MINUTES + RandomInteger(20000, 30000));
                            }
                            AddToLog("Spamming " + player.ToString() + " (" + (countMessgaes + 1).ToString() + " / " + (pages * 50).ToString() + ")");
                            //string message = Config.PROGRAM_NAME + "\n-------\nCheck " + Config.PROGRAM_NAME + "! I can do up to 1,000,000 capture points per day(even more), search in all the world in minutes, open new users and do the tutorial and much more!\nFirst 3 days are free!\nhttp://testsql3s.altervista.org/buy.php";
                            string message = Config.PROGRAM_NAME + " is a program that can do every hack on any official Ikariam server! Pirate clicker, captcha solver, auto raid and much more!\nCheck " + Config.PROGRAM_NAME + " now for free!\nhttps://github.com/Smoxer/";
                            user.SendPM(player.ToString(), message);
                            countMessgaes++;
                        }
                    }
                    AddToLog("Finished spamming this world");
                    Application.Exit();
                }
                else
                {
                    user.DoTutorial(AddToLog);
                    MessageBox.Show(userName + " - " + lang.Get("WebView", "FinishedTutorial"), lang.Get("Misc", "Alert"));
                }
            }).Start();
        }
Exemple #18
0
        public async Task <string> Post([FromBody] string value)
        {
            var captchaSolver = new CaptchaSolver();

            return(await captchaSolver.Solve(value));
        }
Exemple #19
0
 public void PirateMission(int missionLevel, CaptchaSolver captchaSolver)
 {
     PirateMission(missionLevel.ToString(), captchaSolver);
 }
Exemple #20
0
        public async Task <LoginResponse> PerformRequestAsync()
        {
            try
            {
                var resp = new LoginResponse();
                if (_mailClient == null && String.IsNullOrEmpty(FUTAccount.BackupCode1) && String.IsNullOrEmpty(FUTAccount.BackupCode2) && String.IsNullOrEmpty(FUTAccount.BackupCode3) && String.IsNullOrEmpty(FUTAccount.GoogleAuthCode))
                {
                    resp.Code    = FUTErrorCode.UnknownEMailProvider;
                    resp.Message = "Unknown EMailprovider";
                    return(resp);
                }
                HttpClient.RemoveRequestHeader(NonStandardHttpHeaders.PhishingToken);
                HttpClient.RemoveRequestHeader(NonStandardHttpHeaders.SessionId);
                UpdateStatistic("Loading Cookies and Enviromentvariables...");
                HttpClient.SetCookieContainer(CookieManager.GetCookieContainer(FUTAccount, false));
                UpdateStatistic("Grabbing Loginpage...");
                var loggedIn = await GetLoginPageAsync().ConfigureAwait(false);

                var loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);

                if (!loggedIn.RequestMessage.RequestUri.AbsoluteUri.Contains("companion/auth.html"))
                {
                    await Task.Delay(2000).ConfigureAwait(false);

                    UpdateStatistic("Loging in to Origin...");
                    loggedIn = await LoginAsync(loggedIn.RequestMessage.RequestUri.AbsoluteUri).ConfigureAwait(false);

                    loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                }


                var codeSentTimestamp = DateTime.Now.Subtract(new TimeSpan(0, 2, 0));
                if (loggedInString.Contains("var redirectUri = 'https://signin.ea.com:443/p/web2/login?execution="))
                {
                    var redirect = Regex.Match(loggedInString, "'(.*?)';").Groups[1].Value;
                    var red2     = Regex.Match(loggedInString, "redirectUri \\+ \"(.*?)\";").Groups[1].Value;
                    loggedIn = await HttpClient.GetAsync(redirect + red2).ConfigureAwait(false);

                    loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                }
                if (loggedInString.Contains("general-error") && !loggedInString.Contains("panel-profile-upgrade"))
                {
                    resp.Code = Models.FUTErrorCode.WrongLoginData;
                    return(resp);
                }

                if (loggedInString.Contains("panel-forewordMessage") && loggedInString.Contains("btn-continue"))
                {
                    UpdateStatistic("Accepting TFACreation...");
                    loggedIn = await AcceptTwoFactorAsync(loggedIn.RequestMessage.RequestUri.AbsoluteUri);

                    loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                }
                if (loggedInString.Contains("btnTFACreate") && loggedInString.Contains("tfa_type") && loggedInString.Contains("EMAIL"))
                {
                    UpdateStatistic("Create EMail TFA...");
                    loggedIn = await CreateEMailTwoFactorAsync(loggedIn.RequestMessage.RequestUri.AbsoluteUri);

                    loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                }

                if (loggedInString.Contains("tfa-login-link") && loggedInString.Contains("btnSendCode"))
                {
                    if (!String.IsNullOrEmpty(FUTAccount.GoogleAuthCode))
                    {
                        loggedIn = await SelectGoogleAuthenticatorAsync(loggedIn.RequestMessage.RequestUri.AbsoluteUri).ConfigureAwait(false);

                        loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                    }
                    else
                    {
                        loggedIn = await SelectEMailTwoFactorAsync(loggedIn.RequestMessage.RequestUri.AbsoluteUri).ConfigureAwait(false);

                        loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                    }
                }
                var twoFactorCode = "";
                if (loggedInString.Contains("oneTimeCode"))
                {
                    if (!String.IsNullOrEmpty(FUTAccount.BackupCode1))
                    {
                        twoFactorCode          = FUTAccount.BackupCode1;
                        FUTAccount.BackupCode1 = "";
                        FUTAccount.SaveChanges();
                    }
                    else if (!String.IsNullOrEmpty(FUTAccount.BackupCode2))
                    {
                        twoFactorCode          = FUTAccount.BackupCode2;
                        FUTAccount.BackupCode2 = "";
                        FUTAccount.SaveChanges();
                    }
                    else if (!String.IsNullOrEmpty(FUTAccount.BackupCode2))
                    {
                        twoFactorCode          = FUTAccount.BackupCode2;
                        FUTAccount.BackupCode3 = "";
                        FUTAccount.SaveChanges();
                    }
                    else if (!string.IsNullOrEmpty(FUTAccount.GoogleAuthCode))
                    {
                        twoFactorCode = QuickEAAuthenticator.GenerateAuthCode(FUTAccount.GoogleAuthCode);
                    }
                    else
                    {
                        var resendUri  = loggedIn.RequestMessage.RequestUri.AbsoluteUri + "&_eventId=resend";
                        var resendUri2 = "https://signin.ea.com" + loggedInString.GetRegexBetween(" < a id=\"resend_code_link\" href=\"", "\"");
                        UpdateStatistic("Waiting for TwoFactor Code...");
                        twoFactorCode = await WaitForTwoFactorCode(codeSentTimestamp, resendUri).ConfigureAwait(false);
                    }
                    if (twoFactorCode == "WrongUserPassword")
                    {
                        resp.Code = Models.FUTErrorCode.WrongEMailPassword;
                        return(resp);
                    }
                    if (twoFactorCode == "GMXBlocked")
                    {
                        resp.Code = Models.FUTErrorCode.GMXBlocked;
                        return(resp);
                    }
                    if (twoFactorCode.StartsWith("EXC"))
                    {
                        resp.Code    = Models.FUTErrorCode.TwoFactorFailed;
                        resp.Message = twoFactorCode.Remove(0, 3);
                        return(resp);
                    }
                    if (twoFactorCode == "000000" || twoFactorCode == "")
                    {
                        resp.Code    = Models.FUTErrorCode.TwoFactorFailed;
                        resp.Message = "Couldn't get twoFactorCode";
                        return(resp);
                    }
                    await Task.Delay(2000).ConfigureAwait(false);

                    loggedIn = await FillInTwoFactorAsync(loggedIn.RequestMessage.RequestUri.AbsoluteUri, twoFactorCode).ConfigureAwait(false);

                    loggedInString = await loggedIn.Content.ReadAsStringAsync().ConfigureAwait(false);
                }
                if (loggedInString.Contains("Eingegebener Code nicht korrekt"))
                {
                    resp.Code    = FUTErrorCode.WrongEMailCode;
                    resp.Message = "Wrong email code!";
                    return(resp);
                }
                if (!loggedIn.RequestMessage.RequestUri.AbsoluteUri.Contains("auth.html"))
                {
                    resp.Code    = Models.FUTErrorCode.NoRedirectToWebApp;
                    resp.Message = "No redirect to mobile-app";
                    return(resp);
                }
                UpdateStatistic("Grabbing EASW ID...");

                var authCode  = loggedIn.RequestMessage.RequestUri.Query.Remove(0, 6);
                var tmpBearer = await GetBearerAuthCodeAsync(authCode);

                var bearer = Regex.Match(tmpBearer, "\"access_token\" : \"(.*?)\",").Groups[1].Value;
                var easw   = await GetEaswAsync(bearer);

                var easwID = easw.pid.pidId.ToString();
                if (string.IsNullOrEmpty(easwID))
                {
                    CookieManager.DeleteCookieContainer(FUTAccount, false);
                    resp.Code    = Models.FUTErrorCode.NoEaswID;
                    resp.Message = "No easwID";
                    return(resp);
                }
                resp.NucleusID = easwID;

                HttpClient.AddRequestHeader(NonStandardHttpHeaders.NucleusId, easwID);
                HttpClient.AddRequestHeader(NonStandardHttpHeaders.EmbedError, "true");
                UpdateStatistic("Grabbing Shards...");
                var shards = await IsServerOnline();

                if (!shards)
                {
                    resp.Code    = Models.FUTErrorCode.ServerMaintenance;;
                    resp.Message = "Server offline";
                    return(resp);
                }

                HttpClient.AddRequestHeader(NonStandardHttpHeaders.SessionId, "");
                UpdateStatistic("Grabbing UserAccounts...");
                var userAccounts = await BruteforcePlatformAsync().ConfigureAwait(false);

                if (userAccounts == null || userAccounts.userAccountInfo == null || userAccounts.userAccountInfo.personas == null || userAccounts.userAccountInfo.personas.FirstOrDefault() == null)
                {
                    resp.Code    = Models.FUTErrorCode.NoUserAccounts;
                    resp.Message = "No userAccounts";
                    return(resp);
                }
                var nucleusName = userAccounts.userAccountInfo.personas.FirstOrDefault().personaName;
                var personaID   = userAccounts.userAccountInfo.personas.FirstOrDefault().personaId.ToString();
                resp.NucleusName = nucleusName;
                resp.PersonaID   = personaID;

                authCode = await GetAuthCodeAsync(bearer);

                authCode = Regex.Match(authCode, "{\"code\":\"(.*?)\"}").Groups[1].Value;
                if (string.IsNullOrEmpty(authCode))
                {
                    resp.Code    = Models.FUTErrorCode.NoSessionID;
                    resp.Message = "No authCode";
                    return(resp);
                }
                UpdateStatistic("Authing on Utas...");
                var authed = await AuthAsync(authCode, personaID).ConfigureAwait(false);

                if (authed == null || string.IsNullOrEmpty(authed.sid))
                {
                    resp.Code    = Models.FUTErrorCode.NoSessionID;
                    resp.Message = "No sid";
                    return(resp);
                }
                resp.SessionID = authed.sid;
                HttpClient.AddRequestHeader(NonStandardHttpHeaders.SessionId, authed.sid);
                await Task.Delay(3000).ConfigureAwait(false);

                UpdateStatistic("Grabbing SecurityQuestion...");
                var question = await QuestionAsync().ConfigureAwait(false);

                if (question.Code == FUTErrorCode.CaptchaTriggered || question.Code == FUTErrorCode.CaptchaTriggered2)
                {
                    var futproxy = FUTAccount.GetFUTProxy();
                    var solver   = new CaptchaSolver(futproxy);
                    var result   = await solver.DoAntiCaptcha();

                    if (result.errorId == 0)
                    {
                        await SolveCaptchaAsync(result.solution.token);

                        question = await QuestionAsync().ConfigureAwait(false);
                    }
                    else
                    {
                        resp.Code    = Models.FUTErrorCode.CaptchaException;
                        resp.Message = "Captcha failed! " + result.errorDescription;
                        return(resp);
                    }
                }
                if (!string.IsNullOrEmpty(question.token))
                {
                    HttpClient.AddRequestHeader(NonStandardHttpHeaders.PhishingToken, question.token);
                    resp.PhishingToken = question.token;

                    HttpClient.RemoveRequestHeader(NonStandardHttpHeaders.NucleusId);
                    HttpClient.RemoveRequestHeader(NonStandardHttpHeaders.Route);
                    CollectAllCookies();
                    return(resp);
                }
                UpdateStatistic("Validating SecurityQuestion...");
                var validate = await ValidateAsync().ConfigureAwait(false);

                if (string.IsNullOrEmpty(validate?.token))
                {
                    if (validate.code == "461")
                    {
                        resp.Code    = Models.FUTErrorCode.WrongSecurityAnswer;
                        resp.Message = "Wrong SecurityAnswer";
                        return(resp);
                    }
                    resp.Code    = Models.FUTErrorCode.NoPhishingToken;
                    resp.Message = "No phishingtoken";
                    return(resp);
                }
                //await QuestionAsync().ConfigureAwait(false);

                UpdateStatistic("Login success...");
                HttpClient.AddRequestHeader(NonStandardHttpHeaders.PhishingToken, validate.token);
                resp.PhishingToken = validate.token;

                HttpClient.RemoveRequestHeader(NonStandardHttpHeaders.Route);
                CollectAllCookies();
                return(resp);
            }
            catch (Exception e)
            {
                var resp = new LoginResponse();
                resp.Message = e.ToString();
                resp.Code    = FUTErrorCode.BadRequest;
                return(resp);
            }
        }
 public void Start()
 {
     captchaSolver = new CaptchaSolver();
 }