Esempio n. 1
0
        public static bool Register(string username, string password, string email, string license)
        {
            if (!Constants.Initialized)
            {
                MessageBox.Show("Please initialize your application first!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                Security.End();
                Process.GetCurrentProcess().Kill();
            }
            if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(license))
            {
                MessageBox.Show("Invalid registrar information!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                Process.GetCurrentProcess().Kill();
            }
            string[] response = new string[] { };
            using (WebClient wc = new WebClient())
            {
                try
                {
                    Security.Start();
                    wc.Proxy = null;

                    response = Encryption.DecryptService(Encoding.Default.GetString(wc.UploadValues(Constants.ApiUrl, new NameValueCollection
                    {
                        ["token"]       = Encryption.EncryptService(Constants.Token),
                        ["timestamp"]   = Encryption.EncryptService(DateTime.Now.ToString()),
                        ["aid"]         = Encryption.APIService(OnProgramStart.AID),
                        ["session_id"]  = Constants.IV,
                        ["api_id"]      = Constants.APIENCRYPTSALT,
                        ["api_key"]     = Constants.APIENCRYPTKEY,
                        ["session_key"] = Constants.Key,
                        ["secret"]      = Encryption.APIService(OnProgramStart.Secret),
                        ["type"]        = Encryption.APIService("register"),
                        ["username"]    = Encryption.APIService(username),
                        ["password"]    = Encryption.APIService(password),
                        ["email"]       = Encryption.APIService(email),
                        ["license"]     = Encryption.APIService(license),
                        ["hwid"]        = Encryption.APIService(Constants.HWID()),
                    }))).Split("|".ToCharArray());
                    if (response[0] != Constants.Token)
                    {
                        MessageBox.Show("Security error has been triggered!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                    }
                    if (Security.MaliciousCheck(response[1]))
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
                        Process.GetCurrentProcess().Kill();
                    }
                    if (Constants.Breached)
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
                        Process.GetCurrentProcess().Kill();
                    }
                    switch (response[2])
                    {
                    case "success":
                        Security.End();
                        return(true);

                    case "invalid_license":
                        MessageBox.Show("License does not exist!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);

                    case "email_used":
                        MessageBox.Show("Email has already been used!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);

                    case "invalid_username":
                        MessageBox.Show("You entered an invalid/used username!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                    Process.GetCurrentProcess().Kill();
                }
                return(false);
            }
        }
Esempio n. 2
0
        public static bool Login(string username, string password)
        {
            if (!Constants.Initialized)
            {
                MessageBox.Show("Please initialize your application first!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                Process.GetCurrentProcess().Kill();
            }
            if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
            {
                MessageBox.Show("Missing user login information!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                Process.GetCurrentProcess().Kill();
            }
            string[] response = new string[] { };
            using (WebClient wc = new WebClient())
            {
                try
                {
                    Security.Start();
                    wc.Proxy = null;
                    response = (Encryption.DecryptService(Encoding.Default.GetString(wc.UploadValues(Constants.ApiUrl, new NameValueCollection
                    {
                        ["token"] = Encryption.EncryptService(Constants.Token),
                        ["timestamp"] = Encryption.EncryptService(DateTime.Now.ToString()),
                        ["aid"] = Encryption.APIService(OnProgramStart.AID),
                        ["session_id"] = Constants.IV,
                        ["api_id"] = Constants.APIENCRYPTSALT,
                        ["api_key"] = Constants.APIENCRYPTKEY,
                        ["username"] = Encryption.APIService(username),
                        ["password"] = Encryption.APIService(password),
                        ["hwid"] = Encryption.APIService(Constants.HWID()),
                        ["session_key"] = Constants.Key,
                        ["secret"] = Encryption.APIService(OnProgramStart.Secret),
                        ["type"] = Encryption.APIService("login")
                    }))).Split("|".ToCharArray()));
                    if (response[0] != Constants.Token)
                    {
                        MessageBox.Show("Security error has been triggered!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Process.GetCurrentProcess().Kill();
                    }
                    if (Security.MaliciousCheck(response[1]))
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
                        Process.GetCurrentProcess().Kill();
                    }
                    if (Constants.Breached)
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
                        Process.GetCurrentProcess().Kill();
                    }
                    switch (response[2])
                    {
                    case "success":
                        User.ID           = response[3];
                        User.Username     = response[4];
                        User.Password     = response[5];
                        User.Email        = response[6];
                        User.HWID         = response[7];
                        User.UserVariable = response[8];
                        User.Rank         = response[9];
                        User.IP           = response[10];
                        User.Expiry       = response[11];
                        User.LastLogin    = response[12];
                        User.RegisterDate = response[13];
                        string Variables = response[14];
                        foreach (string var in Variables.Split('~'))
                        {
                            string[] items = var.Split('^');
                            try
                            {
                                App.Variables.Add(items[0], items[1]);
                            }
                            catch
                            {
                                //If some are null or not loaded, just ignore.
                                //Error will be shown when loading the variable anyways
                            }
                        }
                        Security.End();
                        return(true);

                    case "invalid_details":
                        MessageBox.Show("Sorry, your username/password does not match!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);

                    case "time_expired":
                        MessageBox.Show("Your subscription has expired!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);

                    case "hwid_updated":
                        MessageBox.Show("New machine has been binded, re-open the application!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Information);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);

                    case "invalid_hwid":
                        MessageBox.Show("This user is binded to another computer, please contact support!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                    Security.End();
                    Process.GetCurrentProcess().Kill();
                }
                return(false);
            }
        }
Esempio n. 3
0
        // Token: 0x06000134 RID: 308 RVA: 0x0000E7AC File Offset: 0x0000C9AC
        public static bool AIOLogin(string AIO)
        {
            bool flag = !Constants.Initialized;

            if (flag)
            {
                MessageBox.Show("Please initialize your application first!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                Process.GetCurrentProcess().Kill();
            }
            bool flag2 = string.IsNullOrWhiteSpace(AIO);

            if (flag2)
            {
                MessageBox.Show("Missing user login information!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                Process.GetCurrentProcess().Kill();
            }
            string[] array = new string[0];
            bool     result;

            using (WebClient webClient = new WebClient())
            {
                try
                {
                    Security.Start();
                    webClient.Proxy = null;
                    Encoding            @default            = Encoding.Default;
                    WebClient           webClient2          = webClient;
                    string              apiUrl              = Constants.ApiUrl;
                    NameValueCollection nameValueCollection = new NameValueCollection();
                    nameValueCollection["token"]       = Encryption.EncryptService(Constants.Token);
                    nameValueCollection["timestamp"]   = Encryption.EncryptService(DateTime.Now.ToString());
                    nameValueCollection["aid"]         = Encryption.APIService(OnProgramStart.AID);
                    nameValueCollection["session_id"]  = Constants.IV;
                    nameValueCollection["api_id"]      = Constants.APIENCRYPTSALT;
                    nameValueCollection["api_key"]     = Constants.APIENCRYPTKEY;
                    nameValueCollection["username"]    = Encryption.APIService(AIO);
                    nameValueCollection["password"]    = Encryption.APIService(AIO);
                    nameValueCollection["hwid"]        = Encryption.APIService(Constants.HWID());
                    nameValueCollection["session_key"] = Constants.Key;
                    nameValueCollection["secret"]      = Encryption.APIService(OnProgramStart.Secret);
                    nameValueCollection["type"]        = Encryption.APIService("login");
                    array = Encryption.DecryptService(@default.GetString(webClient2.UploadValues(apiUrl, nameValueCollection))).Split("|".ToCharArray());
                    bool flag3 = array[0] != Constants.Token;
                    if (flag3)
                    {
                        MessageBox.Show("Security error has been triggered!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                        Process.GetCurrentProcess().Kill();
                    }
                    bool flag4 = Security.MaliciousCheck(array[1]);
                    if (flag4)
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        Process.GetCurrentProcess().Kill();
                    }
                    bool breached = Constants.Breached;
                    if (breached)
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        Process.GetCurrentProcess().Kill();
                    }
                    string text  = array[2];
                    string text2 = text;
                    if (text2 != null)
                    {
                        if (text2 == "success")
                        {
                            Security.End();
                            User.ID           = array[3];
                            User.Username     = array[4];
                            User.Password     = array[5];
                            User.Email        = array[6];
                            User.HWID         = array[7];
                            User.UserVariable = array[8];
                            User.Rank         = array[9];
                            User.IP           = array[10];
                            User.Expiry       = array[11];
                            User.LastLogin    = array[12];
                            User.RegisterDate = array[13];
                            string text3 = array[14];
                            foreach (string text4 in text3.Split(new char[]
                            {
                                '~'
                            }))
                            {
                                string[] array3 = text4.Split(new char[]
                                {
                                    '^'
                                });
                                try
                                {
                                    App.Variables.Add(array3[0], array3[1]);
                                }
                                catch
                                {
                                }
                            }
                            return(true);
                        }
                        if (text2 == "invalid_details")
                        {
                            Security.End();
                            return(false);
                        }
                        if (text2 == "time_expired")
                        {
                            MessageBox.Show("Your subscription has expired!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                            Security.End();
                            Process.GetCurrentProcess().Kill();
                            return(false);
                        }
                        if (text2 == "hwid_updated")
                        {
                            MessageBox.Show("New machine has been binded, re-open the application!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Asterisk);
                            Security.End();
                            Process.GetCurrentProcess().Kill();
                            return(false);
                        }
                        if (text2 == "invalid_hwid")
                        {
                            MessageBox.Show("This user is binded to another computer, please contact support!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                            Security.End();
                            Process.GetCurrentProcess().Kill();
                            return(false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                    Security.End();
                    Process.GetCurrentProcess().Kill();
                }
                result = false;
            }
            return(result);
        }
Esempio n. 4
0
        public static bool AIORegister(string AIO)
        {
            if (!Constants.Initialized)
            {
                Console.WriteLine("Please initialize your application first!", OnProgramStart.Name);
                Security.End();
                Process.GetCurrentProcess().Kill();
            }
            if (string.IsNullOrWhiteSpace(AIO))
            {
                Console.WriteLine("Invalid registrar information!", ApplicationSettings.Name);
                Process.GetCurrentProcess().Kill();
            }
            string[] response = new string[] { };
            using (WebClient wc = new WebClient())
            {
                try
                {
                    Security.Start();
                    wc.Proxy = null;

                    response = Encryption.DecryptService(Encoding.Default.GetString(wc.UploadValues(Constants.ApiUrl, new NameValueCollection
                    {
                        ["token"]       = Encryption.EncryptService(Constants.Token),
                        ["timestamp"]   = Encryption.EncryptService(DateTime.Now.ToString()),
                        ["aid"]         = Encryption.APIService(OnProgramStart.AID),
                        ["session_id"]  = Constants.IV,
                        ["api_id"]      = Constants.APIENCRYPTSALT,
                        ["api_key"]     = Constants.APIENCRYPTKEY,
                        ["session_key"] = Constants.Key,
                        ["secret"]      = Encryption.APIService(OnProgramStart.Secret),
                        ["type"]        = Encryption.APIService("register"),
                        ["username"]    = Encryption.APIService(AIO),
                        ["password"]    = Encryption.APIService(AIO),
                        ["email"]       = Encryption.APIService(AIO),
                        ["license"]     = Encryption.APIService(AIO),
                        ["hwid"]        = Encryption.APIService(Constants.HWID()),
                    }))).Split("|".ToCharArray());
                    if (response[0] != Constants.Token)
                    {
                        Console.WriteLine("Security error has been triggered!", OnProgramStart.Name);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                    }
                    if (Security.MaliciousCheck(response[1]))
                    {
                        Console.WriteLine("Possible malicious activity detected!", OnProgramStart.Name);
                        Process.GetCurrentProcess().Kill();
                    }
                    if (Constants.Breached)
                    {
                        Console.WriteLine("Possible malicious activity detected!", OnProgramStart.Name);
                        Process.GetCurrentProcess().Kill();
                    }
                    Security.End();
                    switch (response[2])
                    {
                    case "success":
                        return(true);

                    case "error":
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message, ApplicationSettings.Name);
                    Process.GetCurrentProcess().Kill();
                }
                return(false);
            }
        }
Esempio n. 5
0
        // Token: 0x06000137 RID: 311 RVA: 0x0000F400 File Offset: 0x0000D600
        public static bool Register(string username, string password, string email, string license)
        {
            bool flag = !Constants.Initialized;

            if (flag)
            {
                MessageBox.Show("Please initialize your application first!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                Security.End();
                Process.GetCurrentProcess().Kill();
            }
            bool flag2 = string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(license);

            if (flag2)
            {
                MessageBox.Show("Invalid registrar information!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                Process.GetCurrentProcess().Kill();
            }
            string[] array = new string[0];
            bool     result;

            using (WebClient webClient = new WebClient())
            {
                try
                {
                    Security.Start();
                    webClient.Proxy = null;
                    Encoding            @default            = Encoding.Default;
                    WebClient           webClient2          = webClient;
                    string              apiUrl              = Constants.ApiUrl;
                    NameValueCollection nameValueCollection = new NameValueCollection();
                    nameValueCollection["token"]       = Encryption.EncryptService(Constants.Token);
                    nameValueCollection["timestamp"]   = Encryption.EncryptService(DateTime.Now.ToString());
                    nameValueCollection["aid"]         = Encryption.APIService(OnProgramStart.AID);
                    nameValueCollection["session_id"]  = Constants.IV;
                    nameValueCollection["api_id"]      = Constants.APIENCRYPTSALT;
                    nameValueCollection["api_key"]     = Constants.APIENCRYPTKEY;
                    nameValueCollection["session_key"] = Constants.Key;
                    nameValueCollection["secret"]      = Encryption.APIService(OnProgramStart.Secret);
                    nameValueCollection["type"]        = Encryption.APIService("register");
                    nameValueCollection["username"]    = Encryption.APIService(username);
                    nameValueCollection["password"]    = Encryption.APIService(password);
                    nameValueCollection["email"]       = Encryption.APIService(email);
                    nameValueCollection["license"]     = Encryption.APIService(license);
                    nameValueCollection["hwid"]        = Encryption.APIService(Constants.HWID());
                    array = Encryption.DecryptService(@default.GetString(webClient2.UploadValues(apiUrl, nameValueCollection))).Split("|".ToCharArray());
                    bool flag3 = array[0] != Constants.Token;
                    if (flag3)
                    {
                        MessageBox.Show("Security error has been triggered!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                        Security.End();
                        Process.GetCurrentProcess().Kill();
                    }
                    bool flag4 = Security.MaliciousCheck(array[1]);
                    if (flag4)
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        Process.GetCurrentProcess().Kill();
                    }
                    bool breached = Constants.Breached;
                    if (breached)
                    {
                        MessageBox.Show("Possible malicious activity detected!", OnProgramStart.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        Process.GetCurrentProcess().Kill();
                    }
                    string text  = array[2];
                    string text2 = text;
                    if (text2 != null)
                    {
                        if (text2 == "success")
                        {
                            Security.End();
                            return(true);
                        }
                        if (text2 == "invalid_license")
                        {
                            MessageBox.Show("License does not exist!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                            Security.End();
                            Process.GetCurrentProcess().Kill();
                            return(false);
                        }
                        if (text2 == "email_used")
                        {
                            MessageBox.Show("Email has already been used!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                            Security.End();
                            Process.GetCurrentProcess().Kill();
                            return(false);
                        }
                        if (text2 == "invalid_username")
                        {
                            MessageBox.Show("You entered an invalid/used username!", ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                            Security.End();
                            Process.GetCurrentProcess().Kill();
                            return(false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ApplicationSettings.Name, MessageBoxButton.OK, MessageBoxImage.Hand);
                    Process.GetCurrentProcess().Kill();
                }
                result = false;
            }
            return(result);
        }