示例#1
0
        /// <summary>
        /// Get Anyones Account Details (Admin)
        /// </summary>
        /// <param name="Token">User Auth-Token</param>
        public string AdminGetAccountDetails(string Username, string Token)
        {
            if (!clientSocket.Connected)
            {
                Connect();
            }

            CleanStream();

            if (!Prepare.PrepareString(Token))
            {
                if (!Prepare.PrepareString(Token))
                {
                    Log.Write("Prepare Failed: Token=" + Token);
                }

                return("Empty Token");
            }

            //Sockets Connection
            //Debug - Log Times
            Stopwatch timer = new Stopwatch();

            timer.Start();

            string Response = API.SendAPIRequest(clientSocket, "Request=AdminGetAccountDetails&Username="******"&Token=" + Token);

            Log.Write(timer.Elapsed.TotalMilliseconds + "ms");

            timer.Reset();

            return(Response);
        }
示例#2
0
        /// <summary>
        /// Contacts server for Login Check
        /// </summary>
        /// <param name="Username">Username</param>
        /// <param name="Password">Password</param>
        /// <param name="HWID">Hardware ID</param>
        /// <param name="Token">Users Token</param>
        /// <returns></returns>
        public string ResetPassword(string Username, string Password)
        {
            if (!clientSocket.Connected)
            {
                Connect();
            }

            CleanStream();

            if (!Prepare.PrepareString(Password))
            {
                if (!Prepare.PrepareString(Password))
                {
                    Log.Write("Prepare Failed: Password="******"Empty Credentials");
            }

            //Sockets Connection
            //Debug - Log Times
            Stopwatch timer = new Stopwatch();

            timer.Start();

            string Response = API.SendAPIRequest(clientSocket, "Request=ResetPassword&Username="******"&Password="******"&HWID=" + FingerPrint.Value());

            Log.Write(timer.Elapsed.TotalMilliseconds + "ms");

            timer.Reset();

            return(Response);
        }
示例#3
0
        /// <summary>
        /// Contacts server for Login Check
        /// </summary>
        /// <param name="Username">Username</param>
        /// <param name="Password">Password</param>
        /// <param name="HWID">Hardware ID</param>
        /// <param name="Token">Users Token</param>
        /// <returns></returns>
        public string Login(string Username, string Password, out string Token)
        {
            string Success;

            if (!clientSocket.Connected)
            {
                Connect();
            }

            CleanStream();

            Token = "";

            if (!Prepare.PrepareString(Username) || !Prepare.PrepareString(Password))
            {
                if (!Prepare.PrepareString(Username))
                {
                    Log.Write("Prepare Failed: Username="******"Prepare Failed: Password="******"Empty Credentials");
            }

            //Sockets Connection
            //Debug - Log Times
            Stopwatch timer = new Stopwatch();

            timer.Start();

            string Response = API.SendAPIRequest(clientSocket, "Request=Login&Username="******"&Password="******"&HWID=" + FingerPrint.Value());

            if (Response.Split('-')[0] == "Login Found")
            {
                Token = Response.Split('-')[1];

                Log.Write("Login Found: " + Username + " -> " + Password + " -> " + Token);

                Success = "Login Found";
            }
            else
            {
                Log.Write("Error: Login not Found -> " + Response);

                Success = Response;
            }

            Log.Write(timer.Elapsed.TotalMilliseconds + "ms");

            timer.Reset();

            return(Success);
        }
示例#4
0
        /// <summary>
        /// Contacts server for Registeration Check
        /// </summary>
        /// <param name="Username"></param>
        /// <param name="Password"></param>
        /// <param name="HWID"></param>
        /// <returns></returns>
        public string Register(string Username, string Password)
        {
            string Success;

            if (!clientSocket.Connected)
            {
                Connect();
            }

            CleanStream();

            if (!Prepare.PrepareString(Username) || !Prepare.PrepareString(Password))
            {
                if (!Prepare.PrepareString(Username))
                {
                    Log.Write("Prepare Failed: Username="******"Prepare Failed: Password="******"Empty Credentials");
            }

            //Debug - Log Times
            Stopwatch timer = new Stopwatch();

            timer.Start();

            string Response = API.SendAPIRequest(clientSocket, "Request=Register&Username="******"&Password="******"&HWID=" + FingerPrint.Value());

            if (Response == "Registration Successful")
            {
                Log.Write("Registration Successful: " + Username + " -> " + Password);

                Success = "Registration Successful";
            }
            else
            {
                Log.Write("Registration Failed: " + Username + " -> " + Password);

                Success = Response;
            }

            Log.Write(timer.Elapsed.TotalMilliseconds + "ms");

            timer.Reset();

            return(Success);
        }
示例#5
0
        /// <summary>
        /// Contacts Server for Activation Check
        /// </summary>
        /// <param name="Token">User Token</param>
        /// <param name="LicenseKey">License Key</param>
        /// <returns></returns>
        public string Activate(string Token, string LicenseKey)
        {
            if (!clientSocket.Connected)
            {
                Connect();
            }

            CleanStream();

            if (!Prepare.PrepareString(Token) || !Prepare.PrepareString(LicenseKey))
            {
                if (!Prepare.PrepareString(Token))
                {
                    Log.Write("Prepare Failed: Token=" + Token);
                }
                else if (!Prepare.PrepareString(LicenseKey))
                {
                    Log.Write("Prepare Failed: LicenseKey=" + LicenseKey);
                }

                return("Error: " + "Prepare Failed: LicenseKey=" + LicenseKey + "&" + "Prepare Failed: Token=" + Token);
            }

            //Debug - Log Times
            Stopwatch timer = new Stopwatch();

            timer.Start();

            string Response = API.SendAPIRequest(clientSocket, "Request=Activate&Token=" + Token + "&LicenseKey=" + LicenseKey);

            if (Response == "Activation Successful")
            {
                Log.Write("Activation Successful: " + Token + " -> " + LicenseKey);
            }
            else
            {
                Log.Write("Activation Failed: " + Token + " -> " + LicenseKey);
            }

            Log.Write(timer.Elapsed.TotalMilliseconds + "ms");

            timer.Reset();

            return(Response);
        }
示例#6
0
        /// <summary>
        /// Contacts server for a download - Cheat / Update
        /// </summary>
        /// <param name="Token">User Token</param>
        /// <param name="File">File to Download</param>
        /// <param name="productid">Product ID</param>
        /// <returns></returns>
        public string Download(string Token, string File, int productid)
        {
            if (!clientSocket.Connected)
            {
                Connect();
            }

            CleanStream();

            if (!Prepare.PrepareString(Token))
            {
                if (!Prepare.PrepareString(Token))
                {
                    Log.Write("Prepare Failed: Username="******"Empty Token");
            }

            //Sockets Connection
            //Debug - Log Times
            Stopwatch timer = new Stopwatch();

            timer.Start();

            serverStream = clientSocket.GetStream();
            byte[] outStream = Encoding.ASCII.GetBytes("Request=Download&Token=" + Token + "&ProductID=" + productid);
            byte[] outSize   = BitConverter.GetBytes(outStream.Length);

            Log.Write("Raw Data: " + BitConverter.ToInt32(outSize, 0) + " -> " + Encoding.ASCII.GetString(outStream));

            //Write Bytes
            serverStream.Write(outSize, 0, outSize.Length);
            serverStream.Write(outStream, 0, outStream.Length);
            serverStream.Flush();

            //Wait for Response - TODO: Add Recieve Byte outSize

            byte[] size = new byte[4];

            serverStream.Read(size, 0, size.Length);

            byte[] bytesFrom = new byte[BitConverter.ToInt32(size, 0)];

            Log.Write("ExpectedSize: " + BitConverter.ToInt32(size, 0) + " bytesFrom Length: " + bytesFrom.Length);

            serverStream.Read(bytesFrom, 0, bytesFrom.Length);

            string returndata = Encoding.ASCII.GetString(bytesFrom); //Out of memory????

            Log.Write("Data from Server: " + returndata);

            if (Request.Contains("Size", returndata))
            {
                long ExpectedSize = Convert.ToInt64(Request.Get("Size", returndata));

                Download download = new Download(serverStream, Environment.CurrentDirectory + "\\" + File, ExpectedSize);
                download.ShowDialog();

                if (download.Done)
                {
                    Log.Write("Download Completed: " + File + " -> Size: " + ExpectedSize);

                    return("Download Completed");
                }
                else
                {
                    Log.Write("Download Failed: " + File + " -> Size: " + ExpectedSize);

                    return("Download Failed");
                }
            }
            else
            {
                Console.WriteLine("Size Parameter was not provided");
            }

            Log.Write(timer.Elapsed.TotalMilliseconds + "ms");

            timer.Reset();

            return(returndata);
        }