Пример #1
0
        public MainWindow()
        {
            SB.MainWindow = this;

            // Clean or create log file
            File.WriteAllText(SB.logFile, "");

            InitializeComponent();

            var title = $"🅾🅿🅴🅽 🅱🆄🅻🅻🅴🆃 {SB.Version}";

            Title = title;
            titleLabel.Content = title;

            // Make sure all folders are there or recreate them
            var folders = new string[] { "Captchas", "ChromeExtensions", "Configs", "DB", "Hits", "Plugins", "Screenshots", "Settings", "Sounds", "Wordlists", "Js" };

            foreach (var folder in folders.Select(f => Path.Combine(Directory.GetCurrentDirectory(), f)))
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
            }

            // Initialize Environment Settings
            try
            {
                SB.Settings.Environment = IOManager.ParseEnvironmentSettings(SB.envFile);
            }
            catch
            {
                SB.Logger.LogError(Components.Main,
                                   "Could not find / parse the Environment Settings file. Please fix the issue and try again.", true);
                Environment.Exit(0);
            }

            if (SB.Settings.Environment.WordlistTypes.Count == 0 || SB.Settings.Environment.CustomKeychains.Count == 0)
            {
                SB.Logger.LogError(Components.Main,
                                   "At least one WordlistType and one CustomKeychain must be defined in the Environment Settings file.", true);
                Environment.Exit(0);
            }

            try
            {
                var vcInstalledVersion = SilverBullet.RedistributableChecker.RedistributablePackage.GetInstalledVersion();

                if (vcInstalledVersion.Length == 0)
                {
                    SB.Logger.LogError(Components.Main, "Visual C++ Redistributable 2015+ Not Installed\nInstall vc_redist.x64 AND vc_redist.x86\nDl Link: microsoft.com/en-us/download/details.aspx?id=48145");
                }

                else if (!vcInstalledVersion.Any(v => v.Contains("x86")))
                {
                    SB.Logger.LogError(Components.Main, "Visual C++ Redistributable 2015+ (x86) Not Installed\nDl Link: microsoft.com/en-us/download/details.aspx?id=48145");
                }
                else if (!vcInstalledVersion.Any(v => v.Contains("x64")))
                {
                    SB.Logger.LogError(Components.Main, "Visual C++ Redistributable 2015+ (x64) Not Installed\nDl Link: microsoft.com/en-us/download/details.aspx?id=48145");
                }
            }
            catch
            {
                SB.Logger.LogError(Components.Main, "Error on check Visual C++ is installed");
            }

            // Initialize Settings
            SB.Settings.RLSettings           = new RLSettingsViewModel();
            SB.Settings.ProxyManagerSettings = new ProxyManagerSettings();
            SB.SBSettings = new SBSettingsViewModel();

            // Create / Load Settings
            if (!File.Exists(SB.rlSettingsFile))
            {
                MessageBox.Show("RuriLib Settings file not found, generating a default one");
                SB.Logger.LogWarning(Components.Main, "RuriLib Settings file not found, generating a default one");
                IOManager.SaveSettings(SB.rlSettingsFile, SB.Settings.RLSettings);
                SB.Logger.LogInfo(Components.Main, $"Created the default RuriLib Settings file {SB.rlSettingsFile}");
            }
            else
            {
                SB.Settings.RLSettings = IOManager.LoadSettings <RLSettingsViewModel>(SB.rlSettingsFile);
                SB.Logger.LogInfo(Components.Main, "Loaded the existing RuriLib Settings file");
            }

            if (!File.Exists(SB.proxyManagerSettingsFile))
            {
                SB.Logger.LogWarning(Components.Main, "Proxy manager Settings file not found, generating a default one");
                SB.Settings.ProxyManagerSettings.ProxySiteUrls.Add(SB.defaultProxySiteUrl);
                SB.Settings.ProxyManagerSettings.ActiveProxySiteUrl = SB.defaultProxySiteUrl;
                SB.Settings.ProxyManagerSettings.ProxyKeys.Add(SB.defaultProxyKey);
                SB.Settings.ProxyManagerSettings.ActiveProxyKey = SB.defaultProxyKey;
                IOManager.SaveSettings(SB.proxyManagerSettingsFile, SB.Settings.ProxyManagerSettings);
                SB.Logger.LogInfo(Components.Main, $"Created the default proxy manager Settings file {SB.proxyManagerSettingsFile}");
            }
            else
            {
                SB.Settings.ProxyManagerSettings = IOManager.LoadSettings <ProxyManagerSettings>(SB.proxyManagerSettingsFile);
                SB.Logger.LogInfo(Components.Main, "Loaded the existing proxy manager Settings file");
            }

            if (!File.Exists(SB.obSettingsFile))
            {
                MessageBox.Show("OpenBullet Settings file not found, generating a default one");
                SB.Logger.LogWarning(Components.Main, "OpenBullet Settings file not found, generating a default one");
                SBIOManager.SaveSettings(SB.obSettingsFile, SB.SBSettings);
                SB.Logger.LogInfo(Components.Main, $"Created the default OpenBullet Settings file {SB.obSettingsFile}");
            }
            else
            {
                SB.SBSettings = SBIOManager.LoadSettings(SB.obSettingsFile);
                SB.Logger.LogInfo(Components.Main, "Loaded the existing OpenBullet Settings file");
            }

            // If there is no DB backup or if it's more than 1 day old, back up the DB
            try
            {
                if (SB.SBSettings.General.BackupDB &&
                    (!File.Exists(SB.dataBaseBackupFile) ||
                     (File.Exists(SB.dataBaseBackupFile) && ((DateTime.Now - File.GetCreationTime(SB.dataBaseBackupFile)).TotalDays > 1))))
                {
                    // Check that the DB is not corrupted by accessing a random collection. If this fails, an exception will be thrown.
                    using (var db = new LiteDB.LiteDatabase(SB.dataBaseFile))
                    {
                        var coll = db.GetCollection <RuriLib.Models.CProxy>("proxies");
                    }

                    // Delete the old file and copy over the new one
                    File.Delete(SB.dataBaseBackupFile);
                    File.Copy(SB.dataBaseFile, SB.dataBaseBackupFile);
                    SB.Logger.LogInfo(Components.Main, "Backed up the DB");
                }
            }
            catch (Exception ex)
            {
                SB.Logger.LogError(Components.Main, $"Could not backup the DB: {ex.Message}");
            }

            Topmost = SB.SBSettings.General.AlwaysOnTop;

            // Load Plugins
            var(plugins, blockPlugins) = Loader.LoadPlugins(SB.pluginsFolder);
            SB.BlockPlugins            = blockPlugins.ToList();

            // Set mappings
            SB.BlockMappings = new List <(Type, Type, System.Windows.Media.Color)>()
            {
                (typeof(BlockBypassCF), typeof(PageBlockBypassCF), Colors.DarkSalmon),
                (typeof(BlockImageCaptcha), typeof(PageBlockCaptcha), Colors.DarkOrange),
                (typeof(BlockReportCaptcha), typeof(PageBlockReportCaptcha), Colors.DarkOrange),
                (typeof(BlockFunction), typeof(PageBlockFunction), Colors.YellowGreen),
                (typeof(BlockKeycheck), typeof(PageBlockKeycheck), Colors.DodgerBlue),
                (typeof(BlockLSCode), typeof(PageBlockLSCode), Colors.White),
                (typeof(BlockParse), typeof(PageBlockParse), Colors.Gold),
                (typeof(BlockRecaptcha), typeof(PageBlockRecaptcha), Colors.Turquoise),
                (typeof(BlockSolveCaptcha), typeof(PageBlockSolveCaptcha), Colors.Turquoise),
                (typeof(BlockRequest), typeof(PageBlockRequest), Colors.LimeGreen),
                (typeof(BlockTCP), typeof(PageBlockTCP), Colors.MediumPurple),
                (typeof(BlockOcr), typeof(PageBlockOcr), System.Windows.Media.Color.FromRgb(230, 230, 230)),
                (typeof(BlockWebSocket), typeof(PageBlockWebSocket), System.Windows.Media.Color.FromRgb(245, 180, 0)),
                (typeof(BlockSpeechToText), typeof(PageBlockSpeechToText), System.Windows.Media.Color.FromRgb(164, 198, 197)),
                (typeof(BlockUtility), typeof(PageBlockUtility), Colors.Wheat),
                (typeof(SBlockBrowserAction), typeof(PageSBlockBrowserAction), Colors.Green),
                (typeof(SBlockElementAction), typeof(PageSBlockElementAction), Colors.Firebrick),
                (typeof(SBlockExecuteJS), typeof(PageSBlockExecuteJS), System.Windows.Media.Color.FromRgb(60, 193, 226)),
                (typeof(SBlockNavigate), typeof(PageSBlockNavigate), Colors.RoyalBlue)
            };

            // Add block plugins to mappings
            foreach (var plugin in blockPlugins)
            {
                try
                {
                    var color = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(plugin.Color);
                    SB.BlockMappings.Add((plugin.GetType(), typeof(BlockPluginPage), color));
                    BlockParser.BlockMappings.Add(plugin.Name, plugin.GetType());
                    SB.Logger.LogInfo(Components.Main, $"Initialized {plugin.Name} block plugin");
                }
                catch
                {
                    SB.Logger.LogError(Components.Main, $"The color {plugin.Color} in block plugin {plugin.Name} is invalid", true);
                    Environment.Exit(0);
                }
            }

            // ViewModels
            SB.RunnerManager   = new RunnerManagerViewModel();
            SB.ProxyManager    = new ProxyManagerViewModel();
            SB.WordlistManager = new WordlistManagerViewModel();
            SB.ConfigManager   = new ConfigManagerViewModel();
            SB.HitsDB          = new HitsDBViewModel();

            // Views
            RunnerManagerPage = new RunnerManager();

            // If we create first runner and there was no session to restore
            if (SB.SBSettings.General.AutoCreateRunner & !SB.RunnerManager.RestoreSession())
            {
                var firstRunner = SB.RunnerManager.Create();
                CurrentRunnerPage = SB.RunnerManager.RunnersCollection.FirstOrDefault().View;
            }

            SB.Logger.LogInfo(Components.Main, "Initialized RunnerManager");
            ProxyManagerPage = new ProxyManager();
            SB.Logger.LogInfo(Components.Main, "Initialized ProxyManager");
            WordlistManagerPage = new WordlistManager();
            SB.Logger.LogInfo(Components.Main, "Initialized WordlistManager");
            ConfigsPage = new ConfigsSection();
            SB.Logger.LogInfo(Components.Main, "Initialized ConfigManager");
            HitsDBPage = new HitsDB();
            SB.Logger.LogInfo(Components.Main, "Initialized HitsDB");
            OBSettingsPage = new Settings();
            SB.Logger.LogInfo(Components.Main, "Initialized Settings");
            ToolsPage = new ToolsSection();
            SB.Logger.LogInfo(Components.Main, "Initialized Tools");
            PluginsPage = new PluginsSection(plugins);
            SB.Logger.LogInfo(Components.Main, "Initialized Plugins");
            AboutPage   = new Help();
            SupportPage = new Support();

            menuOptionRunner_Click(this, null);

            var width  = SB.SBSettings.General.StartingWidth;
            var height = SB.SBSettings.General.StartingHeight;

            if (width > 800)
            {
                Width = width;
            }
            if (height > 600)
            {
                Height = height;
            }

            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            if (SB.SBSettings.Themes.EnableSnow)
            {
                Loaded += MainWindow_Loaded;
            }
        }
Пример #2
0
        public MainWindow()
        {
            // Clean or create log file
            File.WriteAllText(Globals.logFile, "");

            InitializeComponent();

            Title = title;
            titleLabel.Content = title;

            // Set global reference to this window
            Globals.mainWindow = this;

            // Make sure all folders are there or recreate them
            var folders = new string[] { "Captchas", "ChromeExtensions", "Configs", "DB", "Screenshots", "Settings", "Sounds", "Wordlists" };

            foreach (var folder in folders.Select(f => System.IO.Path.Combine(Directory.GetCurrentDirectory(), f)))
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
            }

            // Initialize Environment Settings
            try
            {
                Globals.environment = IOManager.ParseEnvironmentSettings(Globals.envFile);
            }
            catch
            {
                MessageBox.Show("Could not find / parse the Environment Settings file. Please fix the issue and try again.");
                Environment.Exit(0);
            }

            if (Globals.environment.WordlistTypes.Count == 0 || Globals.environment.CustomKeychains.Count == 0)
            {
                MessageBox.Show("At least one WordlistType and one CustomKeychain must be defined in the Environment Settings file.");
                Environment.Exit(0);
            }

            // Initialize Settings
            Globals.rlSettings = new RLSettingsViewModel();
            Globals.obSettings = new OBSettingsViewModel();

            // Create / Load Settings
            if (!File.Exists(Globals.rlSettingsFile))
            {
                MessageBox.Show("RuriLib Settings file not found, generating a default one");
                Globals.LogWarning(Components.Main, "RuriLib Settings file not found, generating a default one");
                IOManager.SaveSettings(Globals.rlSettingsFile, Globals.rlSettings);
                Globals.LogInfo(Components.Main, $"Created the default RuriLib Settings file {Globals.rlSettingsFile}");
            }
            else
            {
                Globals.rlSettings = IOManager.LoadSettings(Globals.rlSettingsFile);
                Globals.LogInfo(Components.Main, "Loaded the existing RuriLib Settings file");
            }

            if (!File.Exists(Globals.obSettingsFile))
            {
                MessageBox.Show("OpenBullet Settings file not found, generating a default one");
                Globals.LogWarning(Components.Main, "OpenBullet Settings file not found, generating a default one");
                OBIOManager.SaveSettings(Globals.obSettingsFile, Globals.obSettings);
                Globals.LogInfo(Components.Main, $"Created the default OpenBullet Settings file {Globals.obSettingsFile}");
            }
            else
            {
                Globals.obSettings = OBIOManager.LoadSettings(Globals.obSettingsFile);
                Globals.LogInfo(Components.Main, "Loaded the existing OpenBullet Settings file");
            }

            Topmost = Globals.obSettings.General.AlwaysOnTop;

            RunnerManagerPage = new RunnerManager(Globals.obSettings.General.AutoCreateRunner);
            if (Globals.obSettings.General.AutoCreateRunner)
            {
                CurrentRunnerPage = RunnerManagerPage.vm.Runners.FirstOrDefault().Page;
            }
            Globals.LogInfo(Components.Main, "Initialized RunnerManager");
            ProxyManagerPage = new ProxyManager();
            Globals.LogInfo(Components.Main, "Initialized ProxyManager");
            WordlistManagerPage = new WordlistManager();
            Globals.LogInfo(Components.Main, "Initialized WordlistManager");
            ConfigsPage = new Configs();
            Globals.LogInfo(Components.Main, "Initialized ConfigManager");
            HitsDBPage = new HitsDB();
            Globals.LogInfo(Components.Main, "Initialized HitsDB");
            OBSettingsPage = new Settings();
            Globals.LogInfo(Components.Main, "Initialized Settings");
            ToolsPage = new Tools();
            Globals.LogInfo(Components.Main, "Initialized Tools");
            AboutPage = new About();

            menuOptionRunner_MouseDown(this, null);

            var width  = Globals.obSettings.General.StartingWidth;
            var height = Globals.obSettings.General.StartingHeight;

            if (width > 800)
            {
                Width = width;
            }
            if (height > 600)
            {
                Height = height;
            }

            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            if (Globals.obSettings.Themes.EnableSnow)
            {
                Loaded += MainWindow_Loaded;
            }
        }
Пример #3
0
        public MainWindow()
        {
            // Clean or create log file
            File.WriteAllText(Globals.logFile, "");

            InitializeComponent();

            Title = title;
            titleLabel.Content = title;

            // Set global reference to this window
            Globals.mainWindow = this;

            // Make sure all folders are there or recreate them
            var folders = new string[] { "Captchas", "ChromeExtensions", "Configs", "DB", "Screenshots", "Settings", "Sounds", "Wordlists" };

            foreach (var folder in folders.Select(f => System.IO.Path.Combine(Directory.GetCurrentDirectory(), f)))
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
            }

            // Initialize Environment Settings
            try
            {
                Globals.environment = IOManager.ParseEnvironmentSettings(Globals.envFile);
            }
            catch
            {
                MessageBox.Show("Could not find / parse the Environment Settings file. Please fix the issue and try again.");
                Environment.Exit(0);
            }

            if (Globals.environment.WordlistTypes.Count == 0 || Globals.environment.CustomKeychains.Count == 0)
            {
                MessageBox.Show("At least one WordlistType and one CustomKeychain must be defined in the Environment Settings file.");
                Environment.Exit(0);
            }

            // Initialize Settings
            Globals.rlSettings = new RLSettingsViewModel();
            Globals.obSettings = new OBSettingsViewModel();

            // Create / Load Settings
            if (!File.Exists(Globals.rlSettingsFile))
            {
                MessageBox.Show("RuriLib Settings file not found, generating a default one");
                Globals.LogWarning(Components.Main, "RuriLib Settings file not found, generating a default one");
                IOManager.SaveSettings(Globals.rlSettingsFile, Globals.rlSettings);
                Globals.LogInfo(Components.Main, $"Created the default RuriLib Settings file {Globals.rlSettingsFile}");
            }
            else
            {
                Globals.rlSettings = IOManager.LoadSettings(Globals.rlSettingsFile);
                Globals.LogInfo(Components.Main, "Loaded the existing RuriLib Settings file");
            }

            if (!File.Exists(Globals.obSettingsFile))
            {
                MessageBox.Show("OpenBullet Settings file not found, generating a default one");
                Globals.LogWarning(Components.Main, "OpenBullet Settings file not found, generating a default one");
                OBIOManager.SaveSettings(Globals.obSettingsFile, Globals.obSettings);
                Globals.LogInfo(Components.Main, $"Created the default OpenBullet Settings file {Globals.obSettingsFile}");
            }
            else
            {
                Globals.obSettings = OBIOManager.LoadSettings(Globals.obSettingsFile);
                Globals.LogInfo(Components.Main, "Loaded the existing OpenBullet Settings file");
            }

            // If there is no DB backup or if it's more than 1 day old, back up the DB
            try
            {
                if (Globals.obSettings.General.BackupDB &&
                    (!File.Exists(Globals.dataBaseBackupFile) ||
                     (File.Exists(Globals.dataBaseBackupFile) && ((DateTime.Now - File.GetCreationTime(Globals.dataBaseBackupFile)).TotalDays > 1))))
                {
                    // Check that the DB is not corrupted by accessing a random collection. If this fails, an exception will be thrown.
                    using (var db = new LiteDB.LiteDatabase(Globals.dataBaseFile))
                    {
                        var coll = db.GetCollection <RuriLib.Models.CProxy>("proxies");
                    }

                    // Delete the old file and copy over the new one
                    File.Delete(Globals.dataBaseBackupFile);
                    File.Copy(Globals.dataBaseFile, Globals.dataBaseBackupFile);
                    Globals.LogInfo(Components.Main, "Backed up the DB");
                }
            }
            catch (Exception ex)
            {
                Globals.LogError(Components.Main, $"Could not backup the DB: {ex.Message}");
            }

            Topmost = Globals.obSettings.General.AlwaysOnTop;

            RunnerManagerPage = new RunnerManager(Globals.obSettings.General.AutoCreateRunner);
            if (Globals.obSettings.General.AutoCreateRunner)
            {
                CurrentRunnerPage = RunnerManagerPage.vm.Runners.FirstOrDefault().Page;
            }
            Globals.LogInfo(Components.Main, "Initialized RunnerManager");
            ProxyManagerPage = new ProxyManager();
            Globals.LogInfo(Components.Main, "Initialized ProxyManager");
            WordlistManagerPage = new WordlistManager();
            Globals.LogInfo(Components.Main, "Initialized WordlistManager");
            ConfigsPage = new Configs();
            Globals.LogInfo(Components.Main, "Initialized ConfigManager");
            HitsDBPage = new HitsDB();
            Globals.LogInfo(Components.Main, "Initialized HitsDB");
            OBSettingsPage = new Settings();
            Globals.LogInfo(Components.Main, "Initialized Settings");
            ToolsPage = new Tools();
            Globals.LogInfo(Components.Main, "Initialized Tools");
            AboutPage = new About();

            menuOptionRunner_MouseDown(this, null);

            var width  = Globals.obSettings.General.StartingWidth;
            var height = Globals.obSettings.General.StartingHeight;

            if (width > 800)
            {
                Width = width;
            }
            if (height > 600)
            {
                Height = height;
            }

            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            if (Globals.obSettings.Themes.EnableSnow)
            {
                Loaded += MainWindow_Loaded;
            }
        }
Пример #4
0
        public MainWindow()
        {
            OB.MainWindow = this;

            // Clean or create log file
            File.WriteAllText(OB.logFile, "");

            InitializeComponent();

            var title = $"OpenBullet {OB.Version}";

            Title = title;
            titleLabel.Content = title;

            // Make sure all folders are there or recreate them
            var folders = new string[] { "Captchas", "ChromeExtensions", "Configs", "DB", "Plugins", "Screenshots", "Settings", "Sounds", "Wordlists" };

            foreach (var folder in folders.Select(f => Path.Combine(Directory.GetCurrentDirectory(), f)))
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
            }

            // Initialize Environment Settings
            try
            {
                OB.Settings.Environment = IOManager.ParseEnvironmentSettings(OB.envFile);
            }
            catch
            {
                OB.Logger.LogError(Components.Main,
                                   "Could not find / parse the Environment Settings file. Please fix the issue and try again.", true);
                Environment.Exit(0);
            }

            if (OB.Settings.Environment.WordlistTypes.Count == 0 || OB.Settings.Environment.CustomKeychains.Count == 0)
            {
                OB.Logger.LogError(Components.Main,
                                   "At least one WordlistType and one CustomKeychain must be defined in the Environment Settings file.", true);
                Environment.Exit(0);
            }

            // Initialize Settings
            OB.Settings.RLSettings = new RLSettingsViewModel();
            OB.OBSettings          = new OBSettingsViewModel();

            // Create / Load Settings
            if (!File.Exists(OB.rlSettingsFile))
            {
                MessageBox.Show("RuriLib Settings file not found, generating a default one");
                OB.Logger.LogWarning(Components.Main, "RuriLib Settings file not found, generating a default one");
                IOManager.SaveSettings(OB.rlSettingsFile, OB.Settings.RLSettings);
                OB.Logger.LogInfo(Components.Main, $"Created the default RuriLib Settings file {OB.rlSettingsFile}");
            }
            else
            {
                OB.Settings.RLSettings = IOManager.LoadSettings(OB.rlSettingsFile);
                OB.Logger.LogInfo(Components.Main, "Loaded the existing RuriLib Settings file");
            }

            if (!File.Exists(OB.obSettingsFile))
            {
                MessageBox.Show("OpenBullet Settings file not found, generating a default one");
                OB.Logger.LogWarning(Components.Main, "OpenBullet Settings file not found, generating a default one");
                OBIOManager.SaveSettings(OB.obSettingsFile, OB.OBSettings);
                OB.Logger.LogInfo(Components.Main, $"Created the default OpenBullet Settings file {OB.obSettingsFile}");
            }
            else
            {
                OB.OBSettings = OBIOManager.LoadSettings(OB.obSettingsFile);
                OB.Logger.LogInfo(Components.Main, "Loaded the existing OpenBullet Settings file");
            }

            // If there is no DB backup or if it's more than 1 day old, back up the DB
            try
            {
                if (OB.OBSettings.General.BackupDB &&
                    (!File.Exists(OB.dataBaseBackupFile) ||
                     (File.Exists(OB.dataBaseBackupFile) && ((DateTime.Now - File.GetCreationTime(OB.dataBaseBackupFile)).TotalDays > 1))))
                {
                    // Check that the DB is not corrupted by accessing a random collection. If this fails, an exception will be thrown.
                    using (var db = new LiteDB.LiteDatabase(OB.dataBaseFile))
                    {
                        var coll = db.GetCollection <RuriLib.Models.CProxy>("proxies");
                    }

                    // Delete the old file and copy over the new one
                    File.Delete(OB.dataBaseBackupFile);
                    File.Copy(OB.dataBaseFile, OB.dataBaseBackupFile);
                    OB.Logger.LogInfo(Components.Main, "Backed up the DB");
                }
            }
            catch (Exception ex)
            {
                OB.Logger.LogError(Components.Main, $"Could not backup the DB: {ex.Message}");
            }

            Topmost = OB.OBSettings.General.AlwaysOnTop;

            // Load Plugins
            var(plugins, blockPlugins) = Loader.LoadPlugins(OB.pluginsFolder);
            OB.BlockPlugins            = blockPlugins.ToList();

            // Set mappings
            OB.BlockMappings = new List <(Type, Type, System.Windows.Media.Color)>()
            {
                (typeof(BlockBypassCF), typeof(PageBlockBypassCF), Colors.DarkSalmon),
                (typeof(BlockImageCaptcha), typeof(PageBlockCaptcha), Colors.DarkOrange),
                (typeof(BlockFunction), typeof(PageBlockFunction), Colors.YellowGreen),
                (typeof(BlockKeycheck), typeof(PageBlockKeycheck), Colors.DodgerBlue),
                (typeof(BlockLSCode), typeof(PageBlockLSCode), Colors.White),
                (typeof(BlockParse), typeof(PageBlockParse), Colors.Gold),
                (typeof(BlockRecaptcha), typeof(PageBlockRecaptcha), Colors.Turquoise),
                (typeof(BlockRequest), typeof(PageBlockRequest), Colors.LimeGreen),
                (typeof(BlockTCP), typeof(PageBlockTCP), Colors.MediumPurple),
                (typeof(BlockUtility), typeof(PageBlockUtility), Colors.Wheat),
                (typeof(SBlockBrowserAction), typeof(PageSBlockBrowserAction), Colors.Green),
                (typeof(SBlockElementAction), typeof(PageSBlockElementAction), Colors.Firebrick),
                (typeof(SBlockExecuteJS), typeof(PageSBlockExecuteJS), Colors.Indigo),
                (typeof(SBlockNavigate), typeof(PageSBlockNavigate), Colors.RoyalBlue)
            };

            // Add block plugins to mappings
            foreach (var plugin in blockPlugins)
            {
                try
                {
                    var color = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(plugin.Color);
                    OB.BlockMappings.Add((plugin.GetType(), typeof(BlockPluginPage), color));
                    BlockParser.BlockMappings.Add(plugin.Name, plugin.GetType());
                    OB.Logger.LogInfo(Components.Main, $"Initialized {plugin.Name} block plugin");
                }
                catch
                {
                    OB.Logger.LogError(Components.Main, $"The color {plugin.Color} in block plugin {plugin.Name} is invalid", true);
                    Environment.Exit(0);
                }
            }

            // ViewModels
            OB.RunnerManager   = new RunnerManagerViewModel();
            OB.ProxyManager    = new ProxyManagerViewModel();
            OB.WordlistManager = new WordlistManagerViewModel();
            OB.ConfigManager   = new ConfigManagerViewModel();
            OB.HitsDB          = new HitsDBViewModel();

            // Views
            RunnerManagerPage = new RunnerManager(OB.OBSettings.General.AutoCreateRunner);
            if (OB.OBSettings.General.AutoCreateRunner)
            {
                CurrentRunnerPage = OB.RunnerManager.RunnersCollection.FirstOrDefault().View;
            }
            OB.Logger.LogInfo(Components.Main, "Initialized RunnerManager");
            ProxyManagerPage = new ProxyManager();
            OB.Logger.LogInfo(Components.Main, "Initialized ProxyManager");
            WordlistManagerPage = new WordlistManager();
            OB.Logger.LogInfo(Components.Main, "Initialized WordlistManager");
            ConfigsPage = new ConfigsSection();
            OB.Logger.LogInfo(Components.Main, "Initialized ConfigManager");
            HitsDBPage = new HitsDB();
            OB.Logger.LogInfo(Components.Main, "Initialized HitsDB");
            OBSettingsPage = new Settings();
            OB.Logger.LogInfo(Components.Main, "Initialized Settings");
            ToolsPage = new ToolsSection();
            OB.Logger.LogInfo(Components.Main, "Initialized Tools");
            PluginsPage = new PluginsSection(plugins);
            OB.Logger.LogInfo(Components.Main, "Initialized Plugins");
            AboutPage = new About();

            menuOptionRunner_MouseDown(this, null);

            var width  = OB.OBSettings.General.StartingWidth;
            var height = OB.OBSettings.General.StartingHeight;

            if (width > 800)
            {
                Width = width;
            }
            if (height > 600)
            {
                Height = height;
            }

            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            if (OB.OBSettings.Themes.EnableSnow)
            {
                Loaded += MainWindow_Loaded;
            }
        }