Пример #1
0
        public static SynResetResponse ResetPassword(string ResetToken, string NewPassword)
        {
            var Mappings = new Dictionary <string, ResetPasswordResult>
            {
                { "OK", ResetPasswordResult.OK },
                { "ERR1", ResetPasswordResult.INVALID_REQUEST },
                { "ERR2", ResetPasswordResult.INVALID_KEY },
                { "ERR3", ResetPasswordResult.KEY_EXPIRED },
                { "ERR4", ResetPasswordResult.ACCOUNT_DOES_NOT_EXIST }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/passwordresetkey", Method.POST);

            Request.AddHeader("R", CInterface.Sign(Convert.ToBase64String(Encoding.UTF8.GetBytes(NewPassword)) + ResetToken));
            Request.AddParameter("a", Convert.ToBase64String(Encoding.UTF8.GetBytes(NewPassword)));
            Request.AddParameter("b", ResetToken);

            var Result = Client.Execute(Request).Content;

            if (Result.Contains("OK"))
            {
                return(new SynResetResponse(ResetPasswordResult.OK, Result.Split('|')[1]));
            }

            return(Mappings.ContainsKey(Result) ? new SynResetResponse(Mappings[Result]) : new SynResetResponse(ResetPasswordResult.UNKNOWN));
        }
Пример #2
0
        public static Data.ScriptHubHolder GetScriptHubData()
        {
            var    Rand = RandomString(16);
            string WebDl;

            using (var WC = new WebClient {
                Proxy = null
            })
            {
                WC.Headers.Add("R", CInterface.Sign(Hwid + Rand));
                WebDl = WC.DownloadString("https://synapse.to/whitelist/getscripthubdata?a=" + Hwid + "&b=" + Rand);
            }

            var Dec          = Decrypt("s6nnBBMt9e7Jm88Y" + Rand, "v9WGGhv1w6EolYQP", WebDl);
            var VerfContents = JsonConvert.DeserializeObject <Data.VerifiedContents <Data.ScriptHubHolder> >(Dec);

            RSAParameters RsaParams;

            using (var Rsa = new RSACryptoServiceProvider())
            {
                Rsa.FromXmlString("<RSAKeyValue><Modulus>tHc4tAP48V2bQ1ovz7LKWzoBVM7Ukb/R/cCzAlINa3yOS8I++0rBwYUBv0qdP5yWKGbAQmkINgruJKMC6EUgwz7RftCiKq8SEU0mVvuVFk99IABAYOO156aORISID+SBsSs28FYZKxHA4j1Ykt7YODj1wYeBSdqS0+e+V+vAabAE7Qsnh8VA9pPN6iPtKW9Zs6n2eGQpM1E+C8POMYIMnSrTIiVCBGMQXEgP0JUmiVlXG2CrqlECBpWR56ur8F1UFR3wcQU+Fix8l3Q1fiPIifFQkIHR8WQXa0JBLfNtQUJVYCtsR5zsoYZ+bqFmKqsjMMjqMlSbcr5XRwv3OX7/iQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
                RsaParams = Rsa.ExportParameters(false);
            }

            if (VerifyData(JsonConvert.SerializeObject(GetScriptHubData(VerfContents)), GetScriptHubSignature(VerfContents), RsaParams))
            {
                return(GetScriptHubData(VerfContents));
            }

            MessageBox.Show("Failed to verify Script Hub data. Please check your anti-virus software.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error);
            Environment.Exit(0);

            return(new Data.ScriptHubHolder());
        }
Пример #3
0
        public static ChangeResult ChangeDiscord(string Token, string DiscordId)
        {
            var Mappings = new Dictionary <string, ChangeResult>
            {
                { "OK", ChangeResult.OK },
                { "ERR1", ChangeResult.INVALID_REQUEST },
                { "ERR2", ChangeResult.INVALID_TOKEN },
                { "ERR3", ChangeResult.EXPIRED_TOKEN },
                { "ERR4", ChangeResult.NOT_ENOUGH_TIME }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/changediscord", Method.POST);

            var PCUser      = WindowsIdentity.GetCurrent().Name;
            var MachineUser = Environment.MachineName;

            Request.AddHeader("R", CInterface.Sign(Convert.ToBase64String(Encoding.UTF8.GetBytes(Token)) + DiscordId));
            Request.AddParameter("a", Convert.ToBase64String(Encoding.UTF8.GetBytes(Token)));
            Request.AddParameter("b", Convert.ToBase64String(Encoding.UTF8.GetBytes(PCUser)));
            Request.AddParameter("c", Convert.ToBase64String(Encoding.UTF8.GetBytes(MachineUser)));
            Request.AddParameter("d", DiscordId);

            var Result = Client.Execute(Request).Content;

            return(Mappings.ContainsKey(Result) ? Mappings[Result] : ChangeResult.UNKNOWN);
        }
Пример #4
0
        public static ResetEmailResult SendResetEmail(string UsernameEmail)
        {
            var Mappings = new Dictionary <string, ResetEmailResult>
            {
                { "OK", ResetEmailResult.OK },
                { "ERR1", ResetEmailResult.INVALID_REQUEST },
                { "ERR2", ResetEmailResult.INVALID_REQUEST },
                { "ERR3", ResetEmailResult.NOT_ENOUGH_TIME },
                { "ERR4", ResetEmailResult.ACCOUNT_DOES_NOT_EXIST }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/passwordreset", Method.POST);

            Request.AddHeader("R", CInterface.Sign(Convert.ToBase64String(Encoding.UTF8.GetBytes(UsernameEmail)) + Hwid));
            Request.AddParameter("a", Convert.ToBase64String(Encoding.UTF8.GetBytes(UsernameEmail)));
            Request.AddParameter("b", Hwid);

            var Result = Client.Execute(Request).Content;

            return(Mappings.ContainsKey(Result) ? Mappings[Result] : ResetEmailResult.UNKNOWN);
        }
Пример #5
0
        public static SynLoginResponse Login(string Username, string Password)
        {
            var Mappings = new Dictionary <string, LoginResult>
            {
                { "OK", LoginResult.OK },
                { "ERR1", LoginResult.INVALID_REQUEST },
                { "ERR2", LoginResult.NOT_MIGRATED },
                { "ERR3", LoginResult.INVALID_USER_PASS }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/login", Method.POST);

            var PCUser      = WindowsIdentity.GetCurrent().Name;
            var MachineUser = Environment.MachineName;

            Request.AddHeader("R", CInterface.Sign(Convert.ToBase64String(Encoding.UTF8.GetBytes(Username)) + Convert.ToBase64String(Encoding.UTF8.GetBytes(PCUser)) + Hwid));
            Request.AddParameter("a", Convert.ToBase64String(Encoding.UTF8.GetBytes(Username)));
            Request.AddParameter("b", Convert.ToBase64String(Encoding.UTF8.GetBytes(Password)));
            Request.AddParameter("c", Convert.ToBase64String(Encoding.UTF8.GetBytes(PCUser)));
            Request.AddParameter("d", Convert.ToBase64String(Encoding.UTF8.GetBytes(MachineUser)));
            Request.AddParameter("e", Hwid);

            var Result = Client.Execute(Request).Content;

            return(Result.Contains("OK") ? new SynLoginResponse(LoginResult.OK, Result.Split('|')[1]) : new SynLoginResponse(Mappings.ContainsKey(Result) ? Mappings[Result] : LoginResult.UNKNOWN));
        }
Пример #6
0
        public static RedeemResult Redeem(string Username, string SerialKey)
        {
            var Mappings = new Dictionary <string, RedeemResult>
            {
                { "OK", RedeemResult.OK },
                { "ERR1", RedeemResult.INVALID_REQUEST },
                { "ERR2", RedeemResult.INVALID_USERNAME },
                { "ERR3", RedeemResult.INVALID_KEY },
                { "ERR4", RedeemResult.ALREADY_UNLIMITED }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/redeem", Method.POST);

            Request.AddHeader("R", CInterface.Sign(Username + SerialKey));
            Request.AddParameter("a", Username);
            Request.AddParameter("b", SerialKey);

            var Result = Client.Execute(Request).Content;

            if (Result.StartsWith("OK"))
            {
                return(RedeemResult.OK);
            }

            return(Mappings.ContainsKey(Result) ? Mappings[Result] : RedeemResult.UNKNOWN);
        }
Пример #7
0
        public static SynRegisterResponse Register(string Username, string Password, string Email, string SerialKey)
        {
            var Mappings = new Dictionary <string, RegisterResult>
            {
                { "OK", RegisterResult.OK },
                { "ERR1", RegisterResult.INVALID_REQUEST },
                { "ERR2", RegisterResult.INVALID_REQUEST },
                { "ERR3", RegisterResult.ALPHA_NUMERIC_ONLY },
                { "ERR4", RegisterResult.USERNAME_TAKEN },
                { "ERR5", RegisterResult.ALREADY_EXISTING_ACCOUNT },
                { "ERR6", RegisterResult.INVALID_KEY }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/create", Method.POST);

            Request.AddHeader("R", CInterface.Sign(Convert.ToBase64String(Encoding.UTF8.GetBytes(Username)) + Hwid + SerialKey));
            Request.AddParameter("a", Convert.ToBase64String(Encoding.UTF8.GetBytes(Username)));
            Request.AddParameter("b", Convert.ToBase64String(Encoding.UTF8.GetBytes(Password)));
            Request.AddParameter("c", Hwid);
            Request.AddParameter("d", Email);
            Request.AddParameter("e", SerialKey);

            var Result = Client.Execute(Request).Content;

            return(Result.Contains("OK") ? new SynRegisterResponse(RegisterResult.OK, Result.Split('|')[1]) : new SynRegisterResponse(Mappings.ContainsKey(Result) ? Mappings[Result] : RegisterResult.UNKNOWN));
        }
Пример #8
0
        public static SynMigrationResponse Migrate(string Username, string Password)
        {
            var Mappings = new Dictionary <string, MigrationResult>
            {
                { "OK", MigrationResult.OK },
                { "ERR1", MigrationResult.INVALID_REQUEST },
                { "ERR2", MigrationResult.INVALID_USER_PASS },
                { "ERR3", MigrationResult.ALREADY_EXISTING_ACCOUNT }
            };

            var Client = new RestClient("https://synapse.to")
            {
                Proxy = null
            };
            var Request = new RestRequest("whitelist/migrate", Method.POST);

            Request.AddHeader("R", CInterface.Sign(Convert.ToBase64String(Encoding.UTF8.GetBytes(Username)) + Hwid));
            Request.AddParameter("a", Convert.ToBase64String(Encoding.UTF8.GetBytes(Username)));
            Request.AddParameter("b", Convert.ToBase64String(Encoding.UTF8.GetBytes(Password)));
            Request.AddParameter("c", Hwid);

            var Result = Client.Execute(Request).Content;

            return(Result.Contains("OK") ? new SynMigrationResponse(MigrationResult.OK, Result.Split('|')[1]) : new SynMigrationResponse(Mappings.ContainsKey(Result) ? Mappings[Result] : MigrationResult.UNKNOWN));
        }
Пример #9
0
        public static void InitHwid()
        {
            Hwid = CInterface.GetHwid();

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
        }