using System; using System.IO; using System.Net; using System.Collections.Generic; using FilterAPI.External; namespace FilterAPI { public class Authentication { public Dictionary ConfigValues = new Dictionary(); public Authentication() { String ConfigURL = "rCZnS9NERSFBVctGyokjX4e+ViXjzKkQ8IjvtTZZw/o="; String HashesURL = "1rmNBpLr95EzB1EyuIZgZCtZBGXCnYGPKZYC1D5dSpQ="; String Password = "KGDQIN5B42lY2HoLQrusdehnyCcMoM4Xo2EZIiL0B96nhNo7sAIAtkrHwXNJ8Gk3"; ConfigURL = Encryption.DecryptText(ConfigURL, Password); HashesURL = Encryption.DecryptText(HashesURL, Password); WebClient AuthenticationClient = new WebClient(); try { using (var HashStream = new StreamReader(AuthenticationClient.OpenRead(HashesURL))) { List Lines = new List(); String CurrentLine; while ((CurrentLine = HashStream.ReadLine()) != null) { Lines.Add(CurrentLine); } String[] DecryptedLines = Encryption.DecryptStringArray(Lines.ToArray(), Password); Dictionary FileHashes = new Dictionary(); foreach (String DecryptedLine in DecryptedLines) { String[] LineSplit = DecryptedLine.Split(new String[] { ": " }, StringSplitOptions.None); FileHashes.Add(LineSplit[0], LineSplit[1]); } if (Convert.ToBoolean(FileHashes["Enabled"])) { String FileName = AppDomain.CurrentDomain.FriendlyName.Replace(".exe", ""); if (FileName.StartsWith("FilterZone")) { FileName = "FilterZone"; } if (!FileHashes.ContainsKey(FileName)) { Environment.Exit(0); } else if (FileHashes[FileName] != ExecutingHash.GetMD5OfExE(String.Concat(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName))) { Environment.Exit(0); } } } using (var ConfigStream = new StreamReader(AuthenticationClient.OpenRead(String.Format(ConfigURL, File.ReadAllLines(String.Format("{0}GUID.txt", AppDomain.CurrentDomain.BaseDirectory))[0])))) { List Lines = new List(); String CurrentLine; while ((CurrentLine = ConfigStream.ReadLine()) != null) { Lines.Add(CurrentLine); } String[] DecryptedLines = Encryption.DecryptStringArray(Lines.ToArray(), Password); foreach (String DecryptedLine in DecryptedLines) { String[] LineSplit = DecryptedLine.Split(new String[] { ": " }, StringSplitOptions.None); if (ConfigValues.ContainsKey(LineSplit[0])) { File.WriteAllLines(String.Format("{0}{1}AuthDuplicateRow.txt", AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName.Replace(".exe", "")), new String[] { LineSplit[0] }); } ConfigValues.Add(LineSplit[0], LineSplit[1]); } } if (Convert.ToBoolean(ConfigValues["TimeLocked"])) { String[] DateSplit = ConfigValues["TimeLockEnd"].Split('/'); DateTime LockDate = new DateTime(Convert.ToInt32(DateSplit[2]), Convert.ToInt32(DateSplit[1]), Convert.ToInt32(DateSplit[0]), 0, 0, 0); if (DateTime.Now > LockDate) { Environment.Exit(0); } } } catch (Exception Error) { File.WriteAllLines(String.Format("{0}{1}Crash.txt", AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName.Replace(".exe", "")), new String[] { Error.ToString() }); Environment.Exit(0); } } } }