Esempio n. 1
0
        public IHttpActionResult Post([FromBody] UserBase user)
        {
            #region Validations
            if (user == null)
            {
                return(BadRequest("Invalid data"));
            }

            #endregion

            try
            {
                var newUserId = DBUtils.AddUser(user);

                if (newUserId > 0)
                {
                    return(Ok($"User created with id: {newUserId}"));
                }
                else
                {
                    return(InternalServerError(new Exception("Cannot create user!")));
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError());
            }
        }
Esempio n. 2
0
        public ActionResult <UserAccount> Create(UserAccount userAccount)
        {
            DBUtils du = new DBUtils();

            return(du.AddUser(userAccount));
        }
Esempio n. 3
0
        public async Task <string> download(DownloadRequest content) //Download API endpoint
        {
            //Grabs IP from cloudflare header
            string IpAddress = Request.Headers["CF-Connecting-IP"];

            if (content == null)
            {
                return(SendError(10, "Missing data or malformed request!"));                 //Bad POST request
            }
            if (content.Stage == null || content.Hwid == null)
            {
                return(SendError(10, "Missing data or malformed request!"));                                               //No stage or HWID
            }
            //Get user record from SQL server
            UserObject User = await DBUtils.GetUser(context, content.Hwid);

            if (User == null) //Record doesnt exist, create one
            {
                User = new UserObject
                {
                    hwid    = content.Hwid,
                    ip      = IpAddress,
                    lastuse = DateTime.Now
                };

                await DBUtils.AddUser(context, User);
            }

            //Update records
            User.ip      = IpAddress;
            User.lastuse = DateTime.Now;
            await context.SaveChangesAsync();

            //Check if premium
            if (!User.premium)
            {
                return(SendError(-2, "Error parsing your POST data!"));
            }

            //Parse stage
            if (!int.TryParse(content.Stage, out int stage))
            {
                return(SendError(11, "Stage is not of type int!"));
            }

            switch (stage)
            {
            case 1:     //Injector
                dynamic       injection       = new JObject();
                EncryptReturn injectionReturn = await EncryptFile("files/ironic-loader.dll");

                if (!injectionReturn.Success)
                {
                    return(SendError(9, "Internal Server Error"));
                }
                injection.injection = injectionReturn.data;
                return(SendData(injection));

            case 2:     //Native DLL
                dynamic       hack       = new JObject();
                EncryptReturn hackReturn = await EncryptFile("files/ironic-payload-loader.dll");

                if (!hackReturn.Success)
                {
                    return(SendError(9, "Internal Server Error"));
                }
                hack.hack = hackReturn.data;
                return(SendData(hack));

            case 3:     //C# Assembly
                dynamic       payload       = new JObject();
                EncryptReturn payloadReturn = await EncryptFile("files/Thanking.dll");

                if (!payloadReturn.Success)
                {
                    return(SendError(9, "Internal Server Error"));
                }
                payload.payload = payloadReturn.data;
                return(SendData(payload));

            case 4:     //Heartbeat
                long Steam64 = 0;
                if (!Int64.TryParse((content.Steam_64 == null ? "0" : content.Steam_name), out Steam64))
                {
                    Steam64 = 0;
                }

                User.steam64   = (Steam64 == 0 ? User.steam64 : Steam64);
                User.steamname = (content.Steam_name == null ? User.steamname : content.Steam_name);
                await context.SaveChangesAsync();

                //Returned string (Client checks if it contains a certain string)
                return("cLNX4sftHUD03zGVamceM1pWeqlhmUhCjTkrw74UeyFxDOSaPnNWu5mU3bGK9bJMbvOB+mbC5S5Sz7ekahgTyqkeF0GBXBBUPCUtqwaZa4m65c9tTgZPMs8k5I2I709rQUZGfvmJuGCJUAtzMPmTJEUIHbcJtTVITplQ");
            }

            //No other possiblities
            return(SendError(12, "Unknown Stage!"));
        }