Beispiel #1
0
        private void exportButton_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "Text File |*.txt";
            sfd.Title  = "Export proxies";
            sfd.ShowDialog();

            if (sfd.FileName != "")
            {
                if (proxiesListView.Items.Count > 0)
                {
                    Globals.LogInfo(Components.ProxyManager, $"Exporting {proxiesListView.Items.Count} proxies");
                    List <string> toExport = new List <string>();

                    foreach (CProxy p in proxiesListView.SelectedItems)
                    {
                        toExport.Add(p.Proxy);
                    }

                    File.WriteAllLines(sfd.FileName, toExport);
                }
                else
                {
                    System.Windows.MessageBox.Show("No proxies selected!");
                    Globals.LogWarning(Components.ProxyManager, "No proxies selected");
                }
            }
        }
Beispiel #2
0
        private void deleteFilteredButton_Click(object sender, RoutedEventArgs e)
        {
            Globals.LogWarning(Components.HitsDB, "Delete filtered selected, prompting warning");

            if (MessageBox.Show("This will delete all the hits that are currently being displayed, are you sure you want to continue?", "WARNING", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
            {
                return;
            }

            var deleted = 0;

            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                var list = vm.HitsList.Where(h =>
                                             (string.IsNullOrEmpty(vm.SearchString) ? true : h.CapturedString.ToLower().Contains(vm.SearchString.ToLower())) &&
                                             (vm.ConfigFilter == "All" ? true : h.ConfigName == vm.ConfigFilter) &&
                                             h.Type == vm.TypeFilter).ToList();

                Hit curr = null;
                while ((curr = list.FirstOrDefault()) != null)
                {
                    db.GetCollection <Hit>("hits").Delete(curr.Id);
                    vm.HitsList.Remove(curr);
                    list.Remove(curr);
                    deleted++;
                }
            }

            Globals.LogInfo(Components.HitsDB, $"Deleted {deleted} hits");
        }
        private void deleteConfigsButton_Click(object sender, RoutedEventArgs e)
        {
            if (Current == null)
            {
                Globals.LogError(Components.ConfigManager, "No config selected!", true);
                return;
            }

            if (Current.Remote)
            {
                Globals.LogError(Components.ConfigManager, "The config was pulled from a remote source and cannot be saved!", true);
                return;
            }

            Globals.LogWarning(Components.ConfigManager, "Deletion initiated, prompting warning");
            if (MessageBox.Show("This will delete the physical files from your disk! Are you sure you want to continue?", "WARNING", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                foreach (ConfigViewModel config in configsListView.SelectedItems)
                {
                    try
                    {
                        File.Delete(config.Path);
                    }
                    catch { Globals.LogError(Components.ConfigManager, "Could not delete file: " + config.Path); }
                }

                Globals.LogInfo(Components.ConfigManager, $"Deleted {configsListView.SelectedItems.Count} configs");
                vm.RefreshList(false);
            }
            else
            {
                Globals.LogInfo(Components.ConfigManager, "Deletion cancelled");
            }
        }
Beispiel #4
0
        private void checkButton_Click(object sender, RoutedEventArgs e)
        {
            switch (bw.Status)
            {
            case WorkerStatus.Idle:
                stop = false;
                Globals.LogInfo(Components.ProxyManager, "Disabling the UI and starting the checker");
                checkButton.Content  = "ABORT";
                botsSlider.IsEnabled = false;
                bw.RunWorkerAsync();
                bw.Status = WorkerStatus.Running;
                break;

            case WorkerStatus.Running:
                stop = true;
                Globals.LogWarning(Components.ProxyManager, "Abort signal sent");
                checkButton.Content = "HARD ABORT";
                bw.Status           = WorkerStatus.Stopping;
                break;

            case WorkerStatus.Stopping:
                Globals.LogWarning(Components.ProxyManager, "Hard abort signal sent");
                bw.CancelAsync();
                break;
            }
        }
Beispiel #5
0
        private void checkButton_Click(object sender, RoutedEventArgs e)
        {
            switch (Status)
            {
            case WorkerStatus.Idle:
                Globals.LogInfo(Components.ProxyManager, "Disabling the UI and starting the checker");
                checkButton.Content  = "ABORT";
                botsSlider.IsEnabled = false;
                Status = WorkerStatus.Running;
#pragma warning disable CS4014 // Non è possibile attendere la chiamata, pertanto l'esecuzione del metodo corrente continuerà prima del completamento della chiamata
                CheckProxiesAsync(vm.ProxyList, vm.BotsNumber, 200);
#pragma warning restore CS4014 // Non è possibile attendere la chiamata, pertanto l'esecuzione del metodo corrente continuerà prima del completamento della chiamata
                break;

            case WorkerStatus.Running:
                Globals.LogWarning(Components.ProxyManager, "Abort signal sent");
                checkButton.Content = "HARD ABORT";
                Status = WorkerStatus.Stopping;
                cts.Cancel();
                break;

            case WorkerStatus.Stopping:
                Globals.LogWarning(Components.ProxyManager, "Hard abort signal sent");
                checkButton.Content  = "CHECK";
                botsSlider.IsEnabled = true;
                Status = WorkerStatus.Idle;
                break;
            }
        }
Beispiel #6
0
        private void deleteAllButton_Click(object sender, RoutedEventArgs e)
        {
            Globals.LogWarning(Components.ProxyManager, "Purging all proxies");
            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                db.DropCollection("proxies");
            }

            vm.ProxyList.Clear();

            vm.UpdateProperties();
        }
Beispiel #7
0
 private void newConfigButton_Click(object sender, RoutedEventArgs e)
 {
     if (!CheckSaved())
     {
         Globals.LogWarning(Components.Stacker, "Config not saved, prompting quit confirmation");
         if (MessageBox.Show("The Config in Stacker wasn't saved.\nAre you sure you want to create a new config?",
                             "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
         {
             return;
         }
     }
     (new MainDialog(new DialogNewConfig(this), "New Config")).ShowDialog();
 }
Beispiel #8
0
        private void loadConfigButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSaved())
            {
                Globals.LogWarning(Components.Stacker, "Config not saved, prompting quit confirmation");
                if (MessageBox.Show("The Config in Stacker wasn't saved.\nAre you sure you want to load another config?",
                                    "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    return;
                }
            }

            // Create new instance of stacker
            Current = (ConfigViewModel)configsListView.SelectedItem; // Set Current Config

            if (Current != null)
            {
                if (Current.Remote)
                {
                    Globals.LogError(Components.ConfigManager, "The config was pulled from a remote source and cannot be edited!", true);
                    Current = null;
                    return;
                }

                Globals.LogInfo(Components.ConfigManager, "Loading config: " + Current.Name);

                Globals.mainWindow.ConfigsPage.menuOptionStacker.IsEnabled      = true;
                Globals.mainWindow.ConfigsPage.menuOptionOtherOptions.IsEnabled = true;
                var newStacker = new Stacker(Current);
                if (Globals.mainWindow.ConfigsPage.StackerPage != null)
                {
                    newStacker.vm.TestData  = Globals.mainWindow.ConfigsPage.StackerPage.vm.TestData;
                    newStacker.vm.TestProxy = Globals.mainWindow.ConfigsPage.StackerPage.vm.TestProxy;
                    newStacker.vm.ProxyType = Globals.mainWindow.ConfigsPage.StackerPage.vm.ProxyType;
                }
                Globals.mainWindow.ConfigsPage.StackerPage = newStacker;                    // Create a Stacker instance
                Globals.LogInfo(Components.ConfigManager, "Created and assigned a new Stacker instance");
                Globals.mainWindow.ConfigsPage.OtherOptionsPage = new ConfigOtherOptions(); // Create an Other Options instance
                Globals.LogInfo(Components.ConfigManager, "Created and assigned a new Other Options instance");
                Globals.mainWindow.ConfigsPage.menuOptionStacker_MouseDown(this, null);     // Switch to Stacker

                // Save the last state of the config
                Globals.mainWindow.ConfigsPage.StackerPage.SetScript();
                SaveState();
            }
            else
            {
                Globals.LogError(Components.ConfigManager, "No config selected for loading", true);
            }
        }
 private void deleteNotFoundWordlistsButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.LogWarning(Components.WordlistManager, "Rescan process of wordlists availability.");
     using (var db = new LiteDatabase(Globals.dataBaseFile))
     {
         foreach (var wordlist in wordlistListView.Items.Cast <Wordlist>().ToList())
         {
             if (!File.Exists(wordlist.Path))
             {
                 db.GetCollection <Wordlist>("wordlists").Delete(wordlist.Id);
                 vm.WordlistList.Remove(wordlist);
             }
         }
     }
 }
Beispiel #10
0
        private bool CheckOnQuit()
        {
            var active = RunnerManagerPage.vm.Runners.Count(r => r.Runner.Busy);

            if (!Globals.obSettings.General.DisableQuitWarning || active > 0)
            {
                Globals.LogWarning(Components.Main, "Prompting quit confirmation");

                if (active == 0)
                {
                    if (MessageBox.Show($"Are you sure you want to quit?",
                                        "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (MessageBox.Show($"There are {active} active runners. Are you sure you want to quit?",
                                        "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                    {
                        return(false);
                    }
                }
            }

            if (Globals.mainWindow.ConfigsPage.StackerPage != null)
            {
                Globals.mainWindow.ConfigsPage.StackerPage.SetScript();
            }

            if (!Globals.obSettings.General.DisableNotSavedWarning && !Globals.mainWindow.ConfigsPage.ConfigManagerPage.CheckSaved())
            {
                Globals.LogWarning(Components.Main, "Config not saved, prompting quit confirmation");
                if (MessageBox.Show("The Config in Stacker wasn't saved.\nAre you sure you want to quit?",
                                    "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    return(false);
                }
            }
            Globals.LogInfo(Components.Main, "Quit sequence initiated");
            return(true);
        }
        private void deleteAllButton_Click(object sender, RoutedEventArgs e)
        {
            Globals.LogWarning(Components.WordlistManager, "Purge selected, prompting warning");

            if (MessageBox.Show("This will purge the WHOLE Wordlists DB, are you sure you want to continue?", "WARNING", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                Globals.LogInfo(Components.WordlistManager, "Purge initiated");
                using (var db = new LiteDatabase(Globals.dataBaseFile))
                {
                    db.DropCollection("wordlists");
                }
                vm.WordlistList.Clear();
                Globals.LogInfo(Components.WordlistManager, "Purge finished");
            }
            else
            {
                Globals.LogInfo(Components.WordlistManager, "Purge dismissed");
            }
        }
Beispiel #12
0
 private void Check(object sender, DoWorkEventArgs e)
 {
     stop = false;
     ThreadPool.SetMinThreads(vm.BotsNumber * 2, vm.BotsNumber * 2);
     Globals.LogInfo(Components.ProxyManager, "Set the minimum threads");
     //ThreadPool.SetMaxThreads(1000, 1000);
     Parallel.ForEach(vm.OnlyUntested ? vm.ProxyList.Where(p => p.Working == ProxyWorking.UNTESTED) : vm.ProxyList,
                      new ParallelOptions {
         MaxDegreeOfParallelism = vm.BotsNumber
     }, (proxy, state) =>
     {
         if (stop)
         {
             Globals.LogWarning(Components.ProxyManager, "Abort signal received, breaking the state"); state.Break();
         }
         CheckCountry(proxy);
         CheckProxy(proxy);
         App.Current.Dispatcher.Invoke(new Action(() => vm.UpdateProperties()));
     });
 }
        private void shrinkButton_Click(object sender, RoutedEventArgs e)
        {
            if (Globals.mainWindow.RunnerManagerPage.vm.Runners.Any(r => r.Runner.Master.IsBusy))
            {
                Globals.LogWarning(Components.Database, "Please stop all active runners before shrinking the database!", true);
                return;
            }

            try
            {
                using (var db = new LiteDatabase(Globals.dataBaseFile))
                {
                    var previousSize = (int)(new FileInfo(Globals.dataBaseFile).Length / 1000);
                    db.Shrink();
                    var newSize = (int)(new FileInfo(Globals.dataBaseFile).Length / 1000);
                    Globals.LogInfo(Components.Database, $"Database successfully shrinked from {previousSize} KB to {newSize} KB", true);
                }
            }
            catch (Exception ex)
            {
                Globals.LogError(Components.Database, $"Shrink failed! Error: {ex.Message}");
            }
        }
Beispiel #14
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;
            }
        }
        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;
            }
        }