public static string Products(TcpClient clientSocket, string data) { string IP = ((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(); string Product = ""; //Check if they own a Paid Product string ServerResponse; if (Request.Contains("Product", data)) { Product = Request.Get("Product", data); } if (Tokens.Tokens.GetToken(IP) != null) { Tokens.Token token = Tokens.Tokens.GetToken(IP); if (Tokens.Tokens.CheckToken(token)) { if (Product != "") { int ProductID = 0; try { ProductID = Convert.ToInt32(Product); } catch { ProductID = 0; } Connect connect = new Connect(); if (ProductID != 0) { ServerResponse = (connect.QueryUserProducts(token.ID, token.Username).Any(productid => productid == ProductID) ? "Authenticated" : "Not Authenticated"); } else { ServerResponse = "Not Authenticated"; } connect.Close(); } else { ServerResponse = "Not Authenticated"; } } else { ServerResponse = "Not Authenticated"; } } else { ServerResponse = "Not Authenticated"; } return(ServerResponse); }
public static string AccountDetails(TcpClient clientSocket, string data) { string Token; string ServerResponse; //Check for Auth Token if (Request.Contains("Token", data)) { Token = Request.Get("Token", data); Tokens.Token token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(Token).ID, Tokens.Tokens.GetTokenByToken(Token).Username, Token); //Check for Token if (Tokens.Tokens.CheckToken(token)) { //Query Database for Account Details Associated to the Name Connect connect = new Connect(); //Username, HWID....etc ServerResponse = connect.QueryUserAccount(token.Username) + "|" + connect.QueryUserLicensing(token.Username); //index[4] connect.Close(); } else { ServerResponse = "Authenticated Token was not found"; } } else { ServerResponse = "Authentication Token Parameter was not provided"; } return(ServerResponse); }
public static string Verified(TcpClient clientSocket, string data) { string IP = ((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(); string Device = ""; string DisplayName = ""; string ServerResponse; if (Request.Contains("Device", data)) { Device = Request.Get("Device", data); } if (Request.Contains("Name", data)) { DisplayName = Request.Get("Name", data); } if (Tokens.Tokens.GetToken(IP) != null) { Tokens.Token token = Tokens.Tokens.GetToken(IP); if (Tokens.Tokens.CheckToken(token)) { if (Device != "" || DisplayName != "") { if (Device != "") { token.LastDevice = Device; } /* * Connect connect = new Connect(); * * connect.UpdateAPICheck(token.Username, token.LastDevice, DisplayName); * * connect.Close(); */ } ServerResponse = "Authenticated"; } else { ServerResponse = "Not Authenticated"; //ServerResponse = "Not Authenticated"; } } else { ServerResponse = "Not Authenticated"; //ServerResponse = "Not Authenticated"; } return(ServerResponse); }
public static string AdminGetAccountDetails(TcpClient clientSocket, string data) { string Username; string token; Tokens.Token Token; string ServerResponse; //Check for Auth Token if (Request.Contains("Username", data)) { Username = Request.Get("Username", data); if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); //Query Database for Account Details Associated to the Name Connect connect = new Connect(); if (connect.IsAdmin(Token.Username)) { if (connect.CheckForAccount(Username)) { ServerResponse = connect.QueryUserAccount(Username) + "|" + connect.QueryUserLicensing(Username); //index[4] } else { ServerResponse = "Account not Found"; } } else { ServerResponse = "Invalid Permissions"; } connect.Close(); } else { ServerResponse = "Token Not Provided"; } } else { ServerResponse = "Username Not Provided"; } return(ServerResponse); }
public static string Activate(TcpClient clientSocket, string data) { string[] datas = data.Split('&'); string token; string LicenseKey; string ServerResponse; if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Tokens.Token Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); Console.WriteLine(Token.IP + " - " + Token.Username + " - " + Token.AuthToken); if (Tokens.Tokens.CheckToken(Token)) { if (Request.Contains("LicenseKey", data)) { LicenseKey = Request.Get("LicenseKey", data); if (ActivateKey(Token.Username, LicenseKey)) { ServerResponse = "Activation Successful"; } else { ServerResponse = "Activation Failed"; } } else { ServerResponse = "LicenseKey Parameter was not provided"; } } else { ServerResponse = "Authentication Token was not found"; } } else { ServerResponse = "Username Parameter was not provided"; } return(ServerResponse); }
public static bool HasProduct(int id, Tokens.Token token) { //grab username products List <int> owned_uids = OwnedProducts(token.ID, token.Username); //Compare username products to list of caches foreach (int product_uid in owned_uids) { if (product_uid == id) { return(true); } } return(false); }
public static string ResetHWID(TcpClient clientSocket, string data) { string Username; string token; Tokens.Token Token; string ServerResponse; //Check for Auth Token if (Request.Contains("Username", data)) { Username = Request.Get("Username", data); if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); //Query Database for Account Details Associated to the Name Connect connect = new Connect(); if (connect.IsAdmin(Token.Username)) { //Username, HWID....etc ServerResponse = connect.HWIDReset(Username); } else { ServerResponse = "Invalid Permissions"; } connect.Close(); } else { ServerResponse = "Token Not Specified"; } } else { ServerResponse = "Username Not Specified"; } return(ServerResponse); }
public static string ProductNews(TcpClient clientSocket, string data) { string[] datas = data.Split('&'); string token; string ServerResponse; if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Tokens.Token Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); Console.WriteLine(Token.IP + " - " + Token.Username + " - " + Token.AuthToken); if (Tokens.Tokens.CheckToken(Token)) { ServerResponse = "Newsfeed="; int id = 0; foreach (News newsfeed in GetNews(Token.Username)) { if (id == 0) { ServerResponse += newsfeed.productid + "-" + newsfeed.newsfeed + "-" + newsfeed.postdate.ToString(); } else { ServerResponse += "|" + newsfeed.productid + "-" + newsfeed.newsfeed + "-" + newsfeed.postdate.ToString(); } id++; } } else { ServerResponse = "Authentication Token was not found"; } } else { ServerResponse = "Username Parameter was not provided"; } return(ServerResponse); }
public static string Ban(TcpClient clientSocket, string data) { string ServerResponse; string Username; string token; Token Token; if (Request.Contains("Username", data)) { Username = Request.Get("Username", data); if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); Connect connect = new Connect(); if (connect.BanUser(Username, Token)) { ServerResponse = "Banned User"; } else { ServerResponse = "Failed to Ban User"; } connect.Close(); } else { ServerResponse = "Token not Provided"; } } else { ServerResponse = "Username not Provided"; } return(ServerResponse); }
public static string LoginCount(TcpClient clientSocket, string data) { //Disabled Command return(""); string token; string ServerResponse; //Check for Auth Token if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Tokens.Token Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); //Check for Token if (Tokens.Tokens.CheckToken(Token)) { Connect connect = new Connect(); ServerResponse = connect.LoginCount().ToString(); connect.Close(); } else { ServerResponse = "Authenticated Token was not found"; } } else { ServerResponse = "Authentication Token Parameter was not provided"; } return(ServerResponse); }
public static string UserProducts(TcpClient clientSocket, string data) { string[] datas = data.Split('&'); string token; string ServerResponse; if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Tokens.Token Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); Console.WriteLine(Token.IP + " - " + Token.Username + " - " + Token.AuthToken); if (Tokens.Tokens.CheckToken(Token)) { ServerResponse = "Packages="; if (Token.Username == "MaverickCheats" || Token.Username == "CrispyCheats") { int id = 0; foreach (Product product in GetProducts(Tokens.Tokens.GetTokenByToken(Token.AuthToken).ID, Tokens.Tokens.GetTokenByToken(Token.AuthToken).Username)) { Console.WriteLine(product.ToString()); if (id == 0) { ServerResponse += product.id + ":" + product.name + ":" + product.file + ":" + product.processname + ":" + product.status + ":" + product.version + ":" + product.free + ":" + product.autolaunchmem; } else { ServerResponse += "|" + product.id + ":" + product.name + ":" + product.file + ":" + product.processname + ":" + product.status + ":" + product.version + ":" + product.free + ":" + product.autolaunchmem; } id++; } } else { int id = 0; foreach (Product product in GetProducts(Tokens.Tokens.GetTokenByToken(Token.AuthToken).ID, Tokens.Tokens.GetTokenByToken(Token.AuthToken).Username)) { if (id == 0) { ServerResponse += product.id + ":" + product.name + ":" + product.file + ":" + product.processname + ":" + product.status + ":" + product.version + ":" + product.autolaunchmem; } else { ServerResponse += "|" + product.id + ":" + product.name + ":" + product.file + ":" + product.processname + ":" + product.status + ":" + product.version + ":" + product.autolaunchmem; } id++; } } } else { ServerResponse = "Authentication Token was not found"; } } else { ServerResponse = "Username Parameter was not provided"; } return(ServerResponse); }
public static string ResetPassword(TcpClient clientSocket, string data) { string token; string Username; string Password; string HWID; string ServerResponse; if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Tokens.Token Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); if (Request.Contains("Username", data)) { Username = Request.Get("Username", data); //If we arent setting a new password ( assume we're triggering it for a reset ) Connect connect = new Connect(); if (connect.IsAdmin(Token.Username)) { //Login Response ServerResponse = connect.PWReset(Username); } else { ServerResponse = "Invalid Permissions"; } connect.Close(); } else { ServerResponse = "Username not Specified"; } } else { if (Request.Contains("Username", data)) { Username = Request.Get("Username", data); //User is asking for a reset, not the bot if (Request.Contains("Password", data)) { Password = Request.Get("Password", data); //User is asking for a reset, not the bot if (Request.Contains("HWID", data)) { HWID = Request.Get("HWID", data); //If we arent setting a new password ( assume we're triggering it for a reset ) Connect connect = new Connect(); //Login Response; ServerResponse = connect.ResetPassword(Username, Password, HWID); connect.Close(); } else { ServerResponse = "HWID Not Specified"; } } else { ServerResponse = "Password Not Specified"; } } else { ServerResponse = "Username not Specified"; } } return(ServerResponse); }
public static string UploadFile(TcpClient clientSocket, string data) { int productid; string Token; string productfile = null; string ServerResponse = null; if (Request.Contains("Token", data)) { Token = Request.Get("Token", data); Tokens.Token token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(Token).ID, Tokens.Tokens.GetTokenByToken(Token).Username, Token); if (Tokens.Tokens.CheckToken(token)) { if (Request.Contains("ProductID", data)) { productid = Convert.ToInt32(Request.Get("ProductID", data)); if (HandleProducts.HasProduct(productid, token)) { foreach (Product product in Caches.Products) { if (product.id == productid) { productfile = product.file; break; } } if (productfile != null) { if (FileTransfer.UploadFile(clientSocket.GetStream(), productfile)) { ServerResponse = "File Upload Complete"; } else { ServerResponse = "File Upload failed"; } } else { ServerResponse = "ProductID returned an invalid file"; } } else { ServerResponse = "You do not own the Product that was specified"; } } else { ServerResponse = "ProductID was missing from the request"; } } else { ServerResponse = "Authentication Token was not found"; } } return(ServerResponse); }
public static string OnlineCount(TcpClient clientSocket, string data) { string token; string ServerResponse; //Check for Auth Token if (Request.Contains("Token", data)) { token = Request.Get("Token", data); Tokens.Token Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token); //Check for Token if (Tokens.Tokens.CheckToken(Token)) { string response = ""; List <string> products = new List <string>(); List <Tokens.Token> tokens = new List <Tokens.Token>(); lock (Tokens.Tokens.AuthTokens) { tokens = new List <Tokens.Token>(Tokens.Tokens.AuthTokens); } foreach (Product product in Caches.Products) { products.Add(product.name); } foreach (string product in products) { List <string> users = new List <string>(); foreach (Tokens.Token temptoken in tokens.Where(toke => toke.LastDevice == product)) { if (!users.Any(user => user == temptoken.username)) { users.Add(temptoken.username); } } response += product + "-" + users.Count + "|"; } ServerResponse = response; /* Old Method (New Method = Querying Tokens [Much Quicker) * Connect connect = new Connect(); * * ServerResponse = connect.OnlineCount().ToString(); * * connect.Close(); */ } else { ServerResponse = "Authenticated Token was not found"; } } else { ServerResponse = "Authentication Token Parameter was not provided"; } return(ServerResponse); }