示例#1
0
        private void removeDuplicatesButton_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                var coll   = db.GetCollection <Hit>("hits");
                var groups = coll
                             .FindAll()
                             .GroupBy(h => GetHitChecksum(h))
                             .Where(g => g.Count() > 1)
                             .Select(g => g.OrderBy(h => h.Date).Reverse().Skip(1));

                Globals.LogInfo(Components.HitsDB, $"Deleting {groups.Select(g => g.Count()).Sum()} duplicate hits");

                foreach (var group in groups)
                {
                    var list = group.ToList();
                    Hit curr = null;
                    while ((curr = list.FirstOrDefault()) != null)
                    {
                        db.GetCollection <Hit>("hits").Delete(curr.Id);              // Delete in the DB
                        vm.HitsList.Remove(vm.HitsList.First(h => h.Id == curr.Id)); // Remove the actual reference to the hit (curr is from a cloned list, generated via Select LINQ method)
                        list.RemoveAt(0);                                            // Remove from list of items to delete
                    }
                }
            }
        }
示例#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");
        }
示例#3
0
        private void saveSelectedFull_Click(object sender, RoutedEventArgs e)
        {
            var file = GetSaveFile();

            if (file == "")
            {
                return;
            }

            try
            {
                StreamWriter SaveFile = new StreamWriter(file);
                foreach (Hit selected in hitsListView.SelectedItems)
                {
                    SaveFile.WriteLine(
                        "Data = " + selected.Data +
                        " | Type = " + selected.Type +
                        " | Config = " + selected.ConfigName +
                        " | Wordlist = " + selected.WordlistName +
                        " | Proxy = " + selected.Proxy +
                        " | Date = " + selected.Date.ToLongDateString() +
                        " | CapturedData = " + selected.CapturedData.ToCaptureString()
                        );
                }

                SaveFile.Close();

                Globals.LogInfo(Components.HitsDB, $"Saved {hitsListView.SelectedItems.Count} hits");
            }
            catch (Exception ex) { Globals.LogError(Components.HitsDB, $"Exception while saving hits - {ex.Message}"); }
        }
示例#4
0
        private void startDebuggerButton_Click(object sender, RoutedEventArgs e)
        {
            switch (debugger.Status)
            {
            case WorkerStatus.Idle:
                if (vm.View == StackerView.Blocks)
                {
                    vm.LS.FromBlocks(vm.GetList());
                }
                else
                {
                    vm.LS.Script = loliScriptEditor.Text;
                }

                if (debuggerTabControl.SelectedIndex == 1)
                {
                    logRTB.Focus();
                }
                vm.ControlsEnabled = false;
                if (!Globals.obSettings.General.PersistDebuggerLog)
                {
                    logRTB.Clear();
                }
                dataRTB.Document.Blocks.Clear();

                if (!debugger.IsBusy)
                {
                    debugger.RunWorkerAsync();
                    Globals.LogInfo(Components.Stacker, "Started the debugger");
                }
                else
                {
                    Globals.LogError(Components.Stacker, "Cannot start the debugger (busy)");
                }

                startDebuggerButton.Content = "Abort";
                debugger.Status             = WorkerStatus.Running;
                break;

            case WorkerStatus.Running:
                if (debugger.IsBusy)
                {
                    debugger.CancelAsync();
                    Globals.LogInfo(Components.Stacker, "Sent Cancellation Request to the debugger");
                }

                startDebuggerButton.Content = "Force";
                debugger.Status             = WorkerStatus.Stopping;
                break;

            case WorkerStatus.Stopping:
                debugger.Abort();
                Globals.LogInfo(Components.Stacker, "Hard aborted the debugger");
                startDebuggerButton.Content = "Start";
                debugger.Status             = WorkerStatus.Idle;
                vm.ControlsEnabled          = true;
                break;
            }
        }
示例#5
0
        private void screenshotImage_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var bitmap = CopyScreen((int)Width, (int)Height, (int)Top, (int)Left);

            Clipboard.SetImage(bitmap);
            GetBitmap(bitmap).Save("screenshot.jpg", ImageFormat.Jpeg);
            Globals.LogInfo(Components.Main, "Acquired screenshot");
        }
示例#6
0
 private void copySelectedProxy_Click(object sender, RoutedEventArgs e)
 {
     try {
         var hit = (Hit)hitsListView.SelectedItem;
         Clipboard.SetText(hit.Proxy);
         Globals.LogInfo(Components.HitsDB, $"Copied the selected proxy {hit.Proxy}");
     } catch (Exception ex) { Globals.LogError(Components.HitsDB, $"Failed to copy selected proxy - {ex.Message}"); }
 }
示例#7
0
        public void AddProxies(string fileName, ProxyType type, List <string> lines)
        {
            List <string> fromFile = new List <string>();
            List <string> fromBox  = new List <string>();

            // Load proxies from file
            if (fileName != "")
            {
                Globals.LogInfo(Components.ProxyManager, $"Trying to load from file {fileName}");

                fromFile.AddRange(File.ReadAllLines(fileName).ToList());
            }
            else
            {
                Globals.LogInfo(Components.ProxyManager, "No file specified, skipping the import from file");
            }

            // Load proxies from textbox lines
            fromBox.AddRange(lines);

            Globals.LogInfo(Components.ProxyManager, $"Adding {fromFile.Count + fromBox.Count} proxies to the database");

            // Check if they're valid
            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                foreach (var p in fromFile.Where(p => !string.IsNullOrEmpty(p)).Distinct().ToList())
                {
                    try
                    {
                        CProxy proxy = new CProxy(p, type);
                        if (!proxy.IsNumeric || proxy.IsValidNumeric)
                        {
                            vm.ProxyList.Add(proxy);
                            db.GetCollection <CProxy>("proxies").Insert(proxy);
                        }
                    }
                    catch { }
                }

                foreach (var p in fromBox.Where(p => !string.IsNullOrEmpty(p)).Distinct().ToList())
                {
                    try
                    {
                        CProxy proxy = new CProxy();
                        proxy.Parse(p, type);
                        if (!proxy.IsNumeric || proxy.IsValidNumeric)
                        {
                            vm.ProxyList.Add(proxy);
                            db.GetCollection <CProxy>("proxies").Insert(proxy);
                        }
                    }
                    catch { }
                }
            }

            // Refresh
            vm.UpdateProperties();
        }
 private void showLog_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         (new MainDialog(new DialogShowLog(((ValidData)GetCurrentListView().SelectedItem).Log), "Complete Log")).Show();
         Globals.LogInfo(Components.Runner, "Opened the log for the hit " + ((ValidData)GetCurrentListView().SelectedItem).Data);
     }
     catch { MessageBox.Show("FAILED"); }
 }
 private void copySelectedProxy_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Clipboard.SetText(((ValidData)GetCurrentListView().SelectedItem).Proxy);
         Globals.LogInfo(Components.Runner, "Copied the proxy " + ((ValidData)GetCurrentListView().SelectedItem).Proxy);
     }
     catch (Exception ex) { Globals.LogError(Components.Runner, $"Couldn't copy the proxy for the selected hit - {ex.Message}"); }
 }
示例#10
0
 public void AddWordlistToDB(Wordlist wordlist)
 {
     // Add it to the DB
     Globals.LogInfo(Components.WordlistManager, "Adding Wordlist '" + wordlist.Name + " at position '" + wordlist.Path + "' with type '" + wordlist.Type + "' and purpose '" + wordlist.Purpose + "' to the DB");
     using (var db = new LiteDatabase(Globals.dataBaseFile))
     {
         db.GetCollection <Wordlist>("wordlists").Insert(wordlist);
     }
 }
示例#11
0
        public Configs()
        {
            InitializeComponent();

            ConfigManagerPage = new ConfigManager();
            Globals.LogInfo(Components.ConfigManager, "Initialized Manager Page");

            menuOptionManager_MouseDown(this, null);
        }
示例#12
0
 private void configFilterCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         vm.ConfigFilter = configFilterCombobox.SelectedValue.ToString();
     }
     catch { }
     Globals.LogInfo(Components.HitsDB, "Changed config filter to " + vm.ConfigFilter + ", found " + vm.HitsList.Count + " hits");
 }
示例#13
0
 private void sendToDebugger_Click(object sender, RoutedEventArgs e)
 {
     try // Try because StackerPage can be null if not initialized yet
     {
         Globals.mainWindow.ConfigsPage.StackerPage.vm.TestData  = ((ValidData)GetCurrentListView().SelectedItem).Data;
         Globals.mainWindow.ConfigsPage.StackerPage.vm.TestProxy = ((ValidData)GetCurrentListView().SelectedItem).Proxy;
         Globals.LogInfo(Components.Runner, "Sent data '" + ((ValidData)GetCurrentListView().SelectedItem).Data + "' and proxy '" + ((ValidData)GetCurrentListView().SelectedItem).Proxy + "' to the debugger");
     }
     catch (Exception ex) { Globals.LogError(Components.Runner, $"Could not send data and proxy to the debugger - {ex.Message}"); }
 }
 private void showHTML_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         File.WriteAllText("source.html", ((ValidData)GetCurrentListView().SelectedItem).Source);
         System.Diagnostics.Process.Start("source.html");
         Globals.LogInfo(Components.Runner, "Saved the html to source.html and opened it with the default viewer");
     }
     catch (Exception ex) { Globals.LogError(Components.Runner, $"Couldn't show the HTML - {ex.Message}", true); }
 }
示例#15
0
        private void Page_KeyDown(object sender, KeyEventArgs e)
        {
            if (Keyboard.Modifiers == ModifierKeys.Control)
            {
                switch (e.Key)
                {
                case System.Windows.Input.Key.Z:
                    if (vm.LastDeletedBlock != null)
                    {
                        vm.AddBlock(vm.LastDeletedBlock, vm.LastDeletedIndex);
                        Globals.LogInfo(Components.Stacker, $"Readded block of type {vm.LastDeletedBlock.GetType()} in position {vm.LastDeletedIndex}");
                        vm.LastDeletedBlock = null;
                    }
                    else
                    {
                        Globals.LogError(Components.Stacker, "Nothing to undo");
                    }
                    break;

                case System.Windows.Input.Key.C:
                    if (Globals.obSettings.General.DisableCopyPasteBlocks)
                    {
                        return;
                    }
                    try { Clipboard.SetText(IOManager.SerializeBlocks(vm.SelectedBlocks.Select(b => b.Block).ToList())); }
                    catch { Globals.LogError(Components.Stacker, "Exception while copying blocks"); }
                    break;

                case System.Windows.Input.Key.V:
                    if (Globals.obSettings.General.DisableCopyPasteBlocks)
                    {
                        return;
                    }
                    try
                    {
                        foreach (var block in IOManager.DeserializeBlocks(Clipboard.GetText()))
                        {
                            vm.AddBlock(block);
                        }
                    }
                    catch { Globals.LogError(Components.Stacker, "Exception while pasting blocks"); }
                    break;

                case System.Windows.Input.Key.S:
                    vm.LS.Script = loliScriptEditor.Text;
                    OnSaveConfig();
                    break;

                default:
                    break;
                }
            }
        }
示例#16
0
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            Globals.LogInfo(Components.ProxyManager, $"Deleting {proxiesListView.SelectedItems.Count} proxies");
            List <CProxy> toDelete = new List <CProxy>();

            foreach (CProxy proxy in proxiesListView.SelectedItems)
            {
                toDelete.Add(proxy);
            }
            DeleteProxies(toDelete);
            Globals.LogInfo(Components.ProxyManager, "Proxies deleted successfully");
        }
示例#17
0
        public void SaveConfig()
        {
            if (Globals.mainWindow.ConfigsPage.CurrentConfig == null ||
                Globals.mainWindow.ConfigsPage.StackerPage == null ||
                Globals.mainWindow.ConfigsPage.OtherOptionsPage == null)
            {
                Globals.LogError(Components.ConfigManager, "No config eligible for saving!", true);
                return;
            }

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

            if (vm.CurrentConfigName == "")
            {
                Globals.LogError(Components.ConfigManager, "Empty config name, cannot save", true);
                return;
            }

            var stacker = Globals.mainWindow.ConfigsPage.StackerPage.vm;

            stacker.ConvertKeychains();

            if (stacker.View == StackerView.Blocks)
            {
                stacker.LS.FromBlocks(stacker.GetList());
            }

            Current.Config.Script = stacker.LS.Script;

            Globals.LogInfo(Components.ConfigManager, $"Saving config {vm.CurrentConfigName}");

            Current.Config.Settings.LastModified = DateTime.Now;
            Current.Config.Settings.Version      = Globals.obVersion;
            Globals.LogInfo(Components.ConfigManager, "Converted the unbinded observables and set the Last Modified date");

            // Save to file
            if (!IOManager.SaveConfig(Current.Config, Current.Path))
            {
                Globals.LogError(Components.ConfigManager, "Failed to save the config to file.", true);
                return;
            }
            ;

            // Save the last state of the config
            SaveState();

            Globals.LogInfo(Components.ConfigManager, "Refreshing the list");
            // vm.RefreshList();
        }
示例#18
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);
            }
        }
示例#19
0
        private void Process()
        {
            try {
                vm.LS.TakeStep(vm.BotData);
                Globals.LogInfo(Components.Stacker, $"Processed {BlockBase.TruncatePretty(vm.LS.CurrentLine, 20)}");
            }
            catch (Exception ex) {
                Globals.LogError(Components.Stacker, $"Processing of line {BlockBase.TruncatePretty(vm.LS.CurrentLine, 20)} failed, exception: {ex.Message}");
            }

            PrintBotData();
            PrintLogBuffer();
            DisplayHTML();
        }
 private void InitCustomInputs(IRunnerMessaging sender)
 {
     // Ask for Custom User Input
     App.Current.Dispatcher.Invoke(new Action(() =>
     {
         vm.CustomInputs = new List <KeyValuePair <string, string> >();
         foreach (var input in vm.Config.Settings.CustomInputs)
         {
             Globals.LogInfo(Components.Runner, $"Asking for input {input.Description}");
             (new MainDialog(new DialogCustomInput(this, input.VariableName, input.Description), "Custom Input")).ShowDialog();
         }
         vm.CustomInputsInitialized = true;
     }));
 }
示例#21
0
 private void deleteButton_Click(object sender, RoutedEventArgs e)
 {
     Globals.LogInfo(Components.WordlistManager, $"Deleting {wordlistListView.SelectedItems.Count} references from the DB");
     using (var db = new LiteDatabase(Globals.dataBaseFile))
     {
         var list = wordlistListView.SelectedItems.Cast <Wordlist>();
         while (list.Count() > 0)
         {
             db.GetCollection <Wordlist>("wordlists").Delete(list.First().Id);
             vm.WordlistList.Remove(list.First());
         }
     }
     Globals.LogInfo(Components.WordlistManager, "Successfully deleted the wordlist references from the DB");
 }
示例#22
0
        private void copySelectedProxies_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var toCopy = "";
                foreach (CProxy proxy in proxiesListView.SelectedItems)
                {
                    toCopy += proxy.Proxy + Environment.NewLine;
                }

                Clipboard.SetText(toCopy);
                Globals.LogInfo(Components.ProxyManager, $"Copied {proxiesListView.SelectedItems.Count} proxies");
            }
            catch (Exception ex) { Globals.LogError(Components.ProxyManager, $"Failed to copy proxies - {ex.Message}"); }
        }
        private void SetupSoundPlayers()
        {
            var hitSound    = $"Sounds/{Globals.obSettings.Sounds.OnHitSound}";
            var reloadSound = $"Sounds/{Globals.obSettings.Sounds.OnReloadSound}";

            if (File.Exists(hitSound))
            {
                hitPlayer = new SoundPlayer(hitSound);
            }
            if (File.Exists(reloadSound))
            {
                reloadPlayer = new SoundPlayer(reloadSound);
            }
            Globals.LogInfo(Components.Runner, "Set up sound players");
        }
示例#24
0
        private void deleteSelected_Click(object sender, RoutedEventArgs e)
        {
            Globals.LogInfo(Components.HitsDB, $"Deleting {hitsListView.SelectedItems.Count} hits");

            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                var list = hitsListView.SelectedItems.Cast <Hit>();
                while (list.Count() > 0)
                {
                    db.GetCollection <Hit>("hits").Delete(list.First().Id);
                    vm.HitsList.Remove(list.First());
                }
            }

            Globals.LogInfo(Components.HitsDB, "Succesfully sent the delete query and refreshed the list");
        }
示例#25
0
        private void copySelectedCustom_Click(object sender, RoutedEventArgs e)
        {
            var clipboardText = "";

            try
            {
                foreach (Hit selected in hitsListView.SelectedItems)
                {
                    clipboardText += selected.ToFormattedString((sender as MenuItem).Header.ToString().Replace(@"\r\n", "\r\n")) + Environment.NewLine;
                }

                Globals.LogInfo(Components.HitsDB, $"Copied {hitsListView.SelectedItems.Count} hits (full)");
                Clipboard.SetText(clipboardText);
            }
            catch (Exception ex) { Globals.LogError(Components.HitsDB, $"Exception while copying hits - {ex.Message}"); }
        }
示例#26
0
        private void copySelectedCapture_Click(object sender, RoutedEventArgs e)
        {
            var clipboardText = "";

            try
            {
                foreach (Hit selected in hitsListView.SelectedItems)
                {
                    clipboardText += selected.Data + " | " + selected.CapturedData.ToCaptureString() + Environment.NewLine;
                }

                Globals.LogInfo(Components.HitsDB, $"Copied {hitsListView.SelectedItems.Count} hits with capture");
                Clipboard.SetText(clipboardText);
            }
            catch (Exception ex) { Globals.LogError(Components.HitsDB, $"Exception while copying hits - {ex.Message}"); }
        }
示例#27
0
        private void DeleteProxies(List <CProxy> proxies)
        {
            Globals.LogInfo(Components.ProxyManager, "Deleting selected proxies");

            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                var list = proxiesListView.SelectedItems.Cast <CProxy>();
                while (list.Count() > 0)
                {
                    db.GetCollection <CProxy>("proxies").Delete(list.First().Id);
                    vm.ProxyList.Remove(list.First());
                }
            }

            vm.UpdateProperties();
        }
        private void sendToDebugger_Click(object sender, RoutedEventArgs e)
        {
            try // Try because StackerPage can be null if not initialized yet
            {
                var stacker = Globals.mainWindow.ConfigsPage.StackerPage.vm;
                var current = GetCurrentListView().SelectedItem as ValidData;

                stacker.TestData = current.Data;

                stacker.TestProxy = current.Proxy;
                stacker.ProxyType = current.ProxyType;

                Globals.LogInfo(Components.Runner, $"Sent to the debugger");
            }
            catch (Exception ex) { Globals.LogError(Components.Runner, $"Could not send data and proxy to the debugger - {ex.Message}"); }
        }
示例#29
0
        private void deleteUntestedButton_Click(object sender, RoutedEventArgs e)
        {
            Globals.LogInfo(Components.ProxyManager, "Deleting all non tested proxies");

            using (var db = new LiteDatabase(Globals.dataBaseFile))
            {
                db.GetCollection <CProxy>("proxies").Delete(p => p.Working == ProxyWorking.UNTESTED);
                var list = vm.ProxyList.Where(p => p.Working == ProxyWorking.UNTESTED);
                while (list.Count() > 0)
                {
                    vm.ProxyList.Remove(list.First());
                }
            }

            vm.UpdateProperties();
        }
        private void copySelectedCapture_Click(object sender, RoutedEventArgs e)
        {
            var clipboardText = "";

            try
            {
                foreach (ValidData selected in GetCurrentListView().SelectedItems)
                {
                    clipboardText += selected.Data + " | " + selected.CapturedData + Environment.NewLine;
                }

                Globals.LogInfo(Components.Runner, $"Copied {GetCurrentListView().SelectedItems.Count} data");
                Clipboard.SetText(clipboardText);
            }
            catch (Exception ex) { Globals.LogError(Components.Runner, $"Exception while copying data - {ex.Message}"); }
        }