Exemple #1
0
        public static void Init()
        {
            Version version = Assembly.GetEntryAssembly().GetName().Version;

            object[] objArray1 = new object[] { "v", version.Major, ".", version.Revision };
            VERSION   = string.Concat(objArray1);
            HddSerial = EveAIO.Helpers.GetHardDiskSerialNo();
            if (HddSerial.Length > 0x10)
            {
                HddSerial = HddSerial.Substring(0, 0x10);
            }
            while (HddSerial.Length < 0x10)
            {
                HddSerial = HddSerial + "A";
            }
            EncryptorAes.Key = HddSerial;
            Machine_name     = Environment.UserName;
            EveAIO.Helpers.LoadSettings();
            ViewDashboard     = new DashboardView();
            ViewProfiles      = new ProfilesView();
            ViewLog           = new LogView();
            ViewCaptcha       = new CaptchaView();
            ViewSuccess       = new SuccessView();
            ViewProxy         = new ProxyView();
            ViewNotifications = new NotificationsView();
            ViewSettings      = new SettingsView();
            ViewTools         = new ToolsView();
            CAPTCHA_QUEUE.CollectionChanged += new NotifyCollectionChangedEventHandler(Global.CAPTCHA_QUEUE_CollectionChanged);
            CLIENT = new Client(null, null, false);
            CLIENT.SetDesktopAgent();
            CLIENT.Session.DefaultRequestHeaders.TryAddWithoutValidation("Upgrade-Insecure-Requests", "1");
            CLIENT.Session.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Language", "en-GB, en-US; q=0.9, en; q=0.8");
            CLIENT.Session.DefaultRequestHeaders.TryAddWithoutValidation("Connection", "keep-alive");
        }
Exemple #2
0
        private async Task <string> GetTokenFromWebView()
        {
            // Discord doesn't allow access to localStorage so create an iframe to bypass this.
            string token = await CaptchaView.InvokeScriptAsync(
                "eval",
                new[]
            {
                @"
                    iframe = document.createElement('iframe');
                    document.body.appendChild(iframe);
                    iframe.contentWindow.localStorage.getItem('token');
                    //'<<token>>'",
            });

            AnalyticsService.Log(Constants.Analytics.Events.TokenIntercepted);

            return(string.IsNullOrEmpty(token) ? string.Empty : token.Trim('"'));
        }
Exemple #3
0
        private async Task<string> GetTokenFromWebView()
        {
            // Discord doesn't allow access to localStorage so create an iframe to bypass this.
            string token = await CaptchaView.InvokeScriptAsync(
                "eval",
                new[]
                {
                    @"
                    iframe = document.createElement('iframe');
                    document.body.appendChild(iframe);
                    iframe.contentWindow.localStorage.getItem('token');
                    //'<<token>>'",
                });

            // Delete token for future
            await CaptchaView.InvokeScriptAsync(
                "eval",
                new[]
                {
                    @"iframe.contentWindow.localStorage.removeItem('token')"
                });

            return string.IsNullOrEmpty(token) ? string.Empty : token.Trim('"');
        }
        private async void LogIn(object sender, RoutedEventArgs e)
        {
            loginButton.IsEnabled   = false;
            ProgressRing.Visibility = Visibility.Visible;
            ProgressRing.IsActive   = true;
            LoginText.Visibility    = Visibility.Collapsed;

            if (NormalAuth.Visibility == Visibility.Visible)
            {
                //NORMAL AUTHENTICATION
                LoginResult result   = new LoginResult();
                var         username = Username.Text;
                var         password = Password.Password;
                await Task.Run(async() =>
                {
                    result = await RESTCalls.Login(username, password);
                    if (result.exception != null)
                    {
                        LoginResult cache = result;
                        result            = JsonConvert.DeserializeObject <LoginResult>(((ApiException)result.exception).Content);
                        result.exception  = cache.exception;
                    }
                });

                if (result.CaptchaKey != null)
                {
                    CaptchaView.Visibility = Visibility.Visible;
                    CaptchaView.Navigate(new Uri("https://discordapp.com/login"));
                    cusername = username;
                    cpassword = password;
                    MessageDialog md = new MessageDialog("Login in Failed, try again here", "Discord thinks you're a bot!");
                    await md.ShowAsync();
                }
                else if (result.Email != null || result.Password != null)
                {
                    if (result.Email != null)
                    {
                        EmailErrorText.Text = "";
                        for (int i = 0; i < result.Email.Count; i++)
                        {
                            EmailErrorText.Text += result.Email[i];
                            if (i != result.Email.Count - 1)
                            {
                                EmailErrorText.Text += Environment.NewLine;
                            }
                        }

                        EmailErrorText.Visibility = Visibility.Visible;
                    }
                    if (result.Password != null)
                    {
                        PasswordErrorText.Text = "";
                        for (int i = 0; i < result.Password.Count; i++)
                        {
                            PasswordErrorText.Text += result.Password[i];
                            if (i != result.Password.Count - 1)
                            {
                                PasswordErrorText.Text += Environment.NewLine;
                            }
                        }

                        PasswordErrorText.Visibility = Visibility.Visible;
                    }
                }
                else if (result.exception != null)
                {
                    string ermsg = "";
                    switch (result.exception.Message)
                    {
                    case "Response status code does not indicate success: 400 ().":
                    case "Response status code does not indicate success: 400().":
                        ermsg = "Response code (from Discord Servers) indicates failure (400), please check your email for an email from Discord to verify your IP";
                        break;

                    case "TBD":
                        ermsg = "A bug in the code is preventing log in, some imported code (refit) isn't working, trying again later may work";
                        break;

                    case "ILoginService doesn't look like a Refit interface. Make sure it has at least one method with a Refit HTTP method attribute and Refit is installed in the project.":
                        ermsg = "A bug in the code is preventing log in. Some imported code (Refit) isn't working as expected";
                        break;

                    default:
                        ermsg = "Unknown error, maybe try again later";
                        break;
                    }
                    MessageDialog msg = new MessageDialog(ermsg);
                    await msg.ShowAsync();
                }

                else if (result.MFA == true)
                {
                    mfaTicket               = result.Ticket;
                    NormalAuth.Visibility   = Visibility.Collapsed;
                    MFAuth.Visibility       = Visibility.Visible;
                    loginButton.IsEnabled   = true;
                    ProgressRing.Visibility = Visibility.Collapsed;
                    ProgressRing.IsActive   = false;
                    LoginText.Visibility    = Visibility.Visible;
                    if (result.SmsSupported)
                    {
                        MFAsms.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        MFAsms.Visibility = Visibility.Collapsed;
                    }
                }
                else if (result.Token != null)
                {
                    App.LogIn();
                    App.SubpageClosed();
                }
            }
            else if (MFAuth.Visibility == Visibility.Visible)
            {
                //2FA AUTHENTICATION
                API.Login.Models.LoginResult result = new API.Login.Models.LoginResult();
                var mfapass = MFAPassword.Password;
                await Task.Run(async() =>
                {
                    if (sms)
                    {
                        result = await RESTCalls.LoginSMS(mfapass, mfaTicket);
                    }
                    else
                    {
                        result = await RESTCalls.LoginMFA(mfapass, mfaTicket);
                    }
                });

                if (result.exception != null)
                {
                    string ermsg = "";
                    switch (result.exception.Message)
                    {
                    case "Response status code does not indicate success: 400().":
                        ermsg = "Response code (from Discord Servers) indicates failure (400), please check your email and password";
                        break;

                    case "TBD":
                        ermsg = "A bug in the code is preventing log in, some imported code (refit) isn't working, trying again later may work";
                        break;

                    case "ILoginService doesn't look like a Refit interface. Make sure it has at least one method with a Refit HTTP method attribute and Refit is installed in the project.":
                        ermsg = "A bug in the code is preventing log in. Some imported code (Refit) isn't working as expected";
                        break;

                    default:
                        ermsg = "Unknown error, maybe try again later";
                        break;
                    }
                    MessageDialog msg = new MessageDialog(ermsg);
                    await msg.ShowAsync();
                }
                else if (result.Token != null)
                {
                    App.LogIn();
                    App.SubpageClosed();
                }
            }
            else if (TokenAuth.Visibility == Visibility.Visible)
            {
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(Token.Password);
                    var resp = await client.GetAsync("https://discordapp.com/api/v6/users/@me");

                    if (resp.IsSuccessStatusCode)
                    {
                        PasswordCredential credentials = new PasswordCredential("Token", "logintoken", Token.Password);
                        Storage.PasswordVault.Add(credentials);
                        App.LogIn();
                        App.SubpageClosed();
                    }
                    else
                    {
                        MessageDialog md = new MessageDialog("Sorry, but that token didn't work. Are you sure it was valid?", "Login failed");
                        await md.ShowAsync();
                    }
                }
            }
            loginButton.IsEnabled   = true;
            ProgressRing.Visibility = Visibility.Collapsed;
            ProgressRing.IsActive   = false;
            LoginText.Visibility    = Visibility.Visible;
        }
Exemple #5
0
 private void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     MainContent.Visibility = Visibility.Collapsed;
     CaptchaView.Visibility = Visibility.Visible;
     CaptchaView.Navigate(new Uri("https://discord.com/app"));
 }