Пример #1
0
    //Timestamp Check, Need to merge to main module soon.
    private bool TimestampCheck(string timestamp)
    {
        if (string.IsNullOrEmpty(timestamp)) return false;

        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        try
        {
            var urlAddress = PublicURL + PublicURLExtension + "_timestamp";

            using (var _client = new ProtectedWebClient())
            {
                _client.Headers.Add("user-agent", AccessKey);
                var postData = new NameValueCollection
                {
                    {"timestamp", timestamp}
                };

                var received = Encoding.UTF8.GetString(_client.UploadValues(urlAddress, postData));
                var messagedecrypt = DecryptRJ256(PrivateKey, received);
                if (messagedecrypt == "TIMESTAMP_ERROR")
                    return false;
                return true;
            }
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
            return false;
        }
    }
Пример #2
0
    //Restore Password Feature
    public string ForgotPassword(string username, string email, string secret_quest, string newpassword,
        string rnewpassword)
    {
        try
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(secret_quest) ||
                string.IsNullOrEmpty(newpassword) || string.IsNullOrEmpty(rnewpassword)) return "FORGOTPWD_FIELDEMPTY";

            if (TimestampCheck(EncryptRJ256(PrivateKey,
                GetNetworkTime().ToString("yyyy-MM-dd hh:mm:ss", new CultureInfo("en-US")))))
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                var urlAddress = PublicURL + PublicURLExtension + "forgot_pwd";

                using (var _client = new ProtectedWebClient())
                {
                    _client.Headers.Add("user-agent", AccessKey);
                    var postData = new NameValueCollection
                    {
                        {"username", EncryptRJ256(PrivateKey, username)},
                        {"email", EncryptRJ256(PrivateKey, email)},
                        {"secret_quest", EncryptRJ256(PrivateKey, secret_quest)},
                        {"newpassword", EncryptRJ256(PrivateKey, newpassword)},
                        {"rnewpassword", EncryptRJ256(PrivateKey, rnewpassword)},
                        {"hwid", EncryptRJ256(PrivateKey, HardwareIDGenerate())}
                    };

                    var received = Encoding.UTF8.GetString(_client.UploadValues(urlAddress, postData));
                    var messagedecrypt = DecryptRJ256(PrivateKey, received);
                    var messageexport = messagedecrypt.Split('|');

                    return messageexport[1];
                }
            }
        }
        catch
        {
            return "UNKNOWN_ERROR";
        }

        return "UNKNOWN_ERROR";
    }
Пример #3
0
    //License Register Feature
    public string LicenseRegister(string username, string password, string timeleft, bool lifetime)
    {
        try
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(timeleft))
                return "LICENSEREG_FIELDEMPTY";

            if (TimestampCheck(EncryptRJ256(PrivateKey,
                GetNetworkTime().ToString("yyyy-MM-dd hh:mm:ss", new CultureInfo("en-US")))))
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                var urlAddress = PublicURL + PublicURLExtension + "license_reg";

                using (var _client = new ProtectedWebClient())
                {
                    _client.Headers.Add("user-agent", AccessKey);
                    var postData = new NameValueCollection
                    {
                        {"username", EncryptRJ256(PrivateKey, username)},
                        {"password", EncryptRJ256(PrivateKey, password)},
                        {"hwid", EncryptRJ256(PrivateKey, HardwareIDGenerate())},
                        {"timeleft", EncryptRJ256(PrivateKey, timeleft)},
                        {"lifetime", EncryptRJ256(PrivateKey, Convert.ToInt32(lifetime).ToString())}
                    };

                    var received = Encoding.UTF8.GetString(_client.UploadValues(urlAddress, postData));
                    var messagedecrypt = DecryptRJ256(PrivateKey, received);
                    var messageexport = messagedecrypt.Split('|');

                    return messageexport[1];
                }
            }
        }
        catch
        {
            return "UNKNOWN_ERROR";
        }

        return "UNKNOWN_ERROR";
    }
Пример #4
0
    //Autoban Feature, you can delete it if you don't need this feature.
    public string AutoBan(string username)
    {
        try
        {
            if (string.IsNullOrEmpty(username)) return "AUTOBAN_FIELDEMPTY";

            if (TimestampCheck(EncryptRJ256(PrivateKey,
                GetNetworkTime().ToString("yyyy-MM-dd hh:mm:ss", new CultureInfo("en-US")))))
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                var urlAddress = PublicURL + PublicURLExtension + "autoban";

                using (var _client = new ProtectedWebClient())
                {
                    _client.Headers.Add("user-agent", AccessKey);
                    var postData = new NameValueCollection
                    {
                        {"username", EncryptRJ256(PrivateKey, username)},
                        {"hwid", EncryptRJ256(PrivateKey, HardwareIDGenerate())}
                    };

                    var received = Encoding.UTF8.GetString(_client.UploadValues(urlAddress, postData));
                    var messagedecrypt = DecryptRJ256(PrivateKey, received);
                    var messageexport = messagedecrypt.Split('|');

                    return messageexport[1];
                }
            }
        }
        catch
        {
            return "UNKNOWN_ERROR";
        }

        return "UNKNOWN_ERROR";
    }