private void ProxyListViewDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (var file in files.Where(x => x.EndsWith(".txt")).ToArray()) { try { if ((file.ToLower()).Contains("http")) { AddProxies(file, ProxyType.Http, File.ReadAllText(file).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None).ToList()); } else if ((file.ToLower()).Contains("socks4")) { AddProxies(file, ProxyType.Socks4, File.ReadAllText(file).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None).ToList()); } else if ((file.ToLower()).Contains("socks4a")) { AddProxies(file, ProxyType.Socks4a, File.ReadAllText(file).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None).ToList()); } else if ((file.ToLower()).Contains("socks5")) { AddProxies(file, ProxyType.Socks5, File.ReadAllText(file).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None).ToList()); } else { Globals.LogError(Components.ProxyManager, "Failed to parse proxies type from file name"); } } catch { } } } }
private void CheckCountry(CProxy proxy) { try { using (var request = new HttpRequest()) { request.ConnectTimeout = (int)vm.Timeout; var response = request.Get("http://ip-api.com/csv/" + proxy.Host); var csv = response.ToString(); var split = csv.Split(','); var country = "Unknown"; if (split[0] == "success") { country = split[1]; } proxy.Country = country.Replace("\"", ""); using (var db = new LiteDatabase(Globals.dataBaseFile)) { db.GetCollection <CProxy>("proxies").Update(proxy); } Globals.LogInfo(Components.ProxyManager, "Checked country for proxy '" + proxy.Proxy + "' with result '" + proxy.Country + "'"); } } catch (Exception ex) { Globals.LogError(Components.ProxyManager, "Failted to check country for proxy '" + proxy.Proxy + $"' - {ex.Message}"); } }
private void sendToRecheck_Click(object sender, RoutedEventArgs e) { if (hitsListView.SelectedItems.Count == 0) { Globals.LogError(Components.HitsDB, "No hits selected!", true); return; } var first = (Hit)hitsListView.SelectedItem; var partialName = "Recheck-" + first.ConfigName; var wordlist = new Wordlist(partialName, "NULL", Globals.environment.RecognizeWordlistType(first.Data), "", true, true); var manager = Globals.mainWindow.RunnerManagerPage.vm; manager.CreateRunner(); var runner = manager.Runners.Last().Page; Globals.mainWindow.ShowRunner(runner); runner.vm.SetWordlist(wordlist); runner.vm.DataPool = new DataPool(hitsListView.SelectedItems.Cast <Hit>().Select(h => h.Data).ToList()); // Try to select the config referring to the first selected hit try { var cfg = Globals.mainWindow.ConfigsPage.ConfigManagerPage.vm.ConfigsList.First(c => c.Name == first.ConfigName).Config; runner.vm.SetConfig(cfg, false); runner.vm.BotsNumber = Math.Min(cfg.Settings.SuggestedBots, hitsListView.SelectedItems.Count); } catch { } // Switch to Runner Globals.mainWindow.menuOptionRunner_MouseDown(this, null); }
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"); } }
private void ScrapeButton_Click(object sender, RoutedEventArgs e) { try { if (string.IsNullOrEmpty(APIUrl.Text)) { return; } string html = "0"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(APIUrl.Text); request.Proxy = null; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (System.IO.Stream stream = response.GetResponseStream()) using (System.IO.StreamReader reader = new System.IO.StreamReader(stream)) { html = reader.ReadToEnd(); } proxiesBox.Text = html; } catch { Globals.LogError(Components.ConfigManager, "Could not scrape proxies from the host"); } }
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}"); } }
private void sendToRecheck_Click(object sender, RoutedEventArgs e) { if (hitsListView.SelectedItems.Count == 0) { Globals.LogError(Components.HitsDB, "No hits selected!", true); return; } var first = (Hit)hitsListView.SelectedItem; var partialName = "Recheck-" + BlockBase.MakeValidFileName(first.ConfigName); // Choose list name var fileName = BlockBase.GetFirstAvailableFileName("Wordlists\\", partialName, "txt"); // Write to disk var path = $@"{Directory.GetCurrentDirectory()}\Wordlists\{fileName}"; using (var sw = new StreamWriter(path)) { foreach (Hit selected in hitsListView.SelectedItems) { sw.WriteLine(selected.Data); } } // Import it var listName = fileName.Substring(0, fileName.Length - 4); var wordlist = new Wordlist(listName, path, Globals.environment.RecognizeWordlistType(first.Data), ""); Globals.mainWindow.WordlistManagerPage.AddWordlist(wordlist); var runner = Globals.mainWindow.CurrentRunnerPage; if (runner == null) { MessageBox.Show("Please select a Runner from the manager first!"); return; } else if (runner.vm.Busy) { MessageBox.Show("The selected Runner is busy, please choose another one!"); return; } try { runner.vm.SetWordlist(Globals.mainWindow.WordlistManagerPage.GetList(listName)); } catch { } // Try to select the config referring to the first selected hit try { var cfg = Globals.mainWindow.ConfigsPage.ConfigManagerPage.vm.ConfigsList.First(c => c.Name == first.ConfigName).Config; runner.vm.SetConfig(cfg, false); runner.vm.BotsNumber = Math.Min(cfg.Settings.SuggestedBots, hitsListView.SelectedItems.Count); } catch { } // Switch to Runner Globals.mainWindow.menuOptionRunner_MouseDown(this, null); }
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; } }
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}"); } }
private void openConfigFolderButton_Click(object sender, RoutedEventArgs e) { try { System.Diagnostics.Process.Start(System.IO.Path.Combine(Directory.GetCurrentDirectory(), Globals.configFolder)); } catch { Globals.LogError(Components.ConfigManager, "No config folder found!", true); } }
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}"); } }
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); } }
private void saveConfigButton_Click(object sender, RoutedEventArgs e) { if (Current == null) { Globals.LogError(Components.ConfigManager, "No config selected for saving!"); return; } SaveConfig(); }
public void AddWordlist(Wordlist wordlist) { if (vm.WordlistList.Any(w => w.Path == wordlist.Path)) { Globals.LogError(Components.WordlistManager, $"Wordlist already present: {wordlist.Path}"); return; } vm.WordlistList.Add(wordlist); AddWordlistToDB(wordlist); }
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(); }
public ConfigOtherOptionsRequests() { InitializeComponent(); try { DataContext = Globals.mainWindow.ConfigsPage.CurrentConfig.Config.Settings; } catch { Globals.LogError(Components.ConfigManager, "You can't edit this.", true); } }
public void menuOptionStacker_MouseDown(object sender, MouseButtonEventArgs e) { if (CurrentConfig != null && StackerPage != null) { Main.Content = StackerPage; menuOptionSelected(menuOptionStacker); } else { Globals.LogError(Components.ConfigManager, "Cannot switch to stacker since no config is loaded or the loaded config isn't public"); } }
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; } } }
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 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 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 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}"); } }
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}"); } }
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}"); } }
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}"); } }
private void menuOptionOtherOptions_MouseDown(object sender, MouseButtonEventArgs e) { if (CurrentConfig != null) { if (OtherOptionsPage == null) { OtherOptionsPage = new ConfigOtherOptions(); } Main.Content = OtherOptionsPage; menuOptionSelected(menuOptionOtherOptions); } else { Globals.LogError(Components.ConfigManager, "Cannot switch to other options since no config is loaded"); } }
private void RegisterHit(IRunnerMessaging sender, Hit hit) { Globals.LogInfo(Components.Runner, $"Adding {hit.Type} hit " + hit.Data + " to the DB"); try { using (var db = new LiteDatabase(Globals.dataBaseFile)) { App.Current.Dispatcher.Invoke(new Action(() => { Globals.mainWindow.HitsDBPage.vm.HitsList.Add(hit); Globals.mainWindow.HitsDBPage.AddConfigToFilter(vm.ConfigName); })); db.GetCollection <Hit>("hits").Insert(hit); } } catch (Exception ex) { Globals.LogError(Components.Runner, $"Failed to add {hit.Type} hit " + hit.Data + $" to the DB - {ex.Message}"); } }
private void SOCKS5Button_Click(object sender, RoutedEventArgs e) { try { string html = "0"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://proxyscrape.com/api/?request=displayproxies&proxytype=socks5"); request.Proxy = null; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (System.IO.Stream stream = response.GetResponseStream()) using (System.IO.StreamReader reader = new System.IO.StreamReader(stream)) { html = reader.ReadToEnd(); } proxiesBox.Text = html; proxyTypeCombobox.SelectedIndex = 3; } catch { Globals.LogError(Components.ConfigManager, "Could not scrape proxies from the host"); } }
private void saveSelectedCustom_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(selected.ToFormattedString((sender as MenuItem).Header.ToString().Replace(@"\r\n", "\r\n")) + Environment.NewLine); } SaveFile.Close(); Globals.LogInfo(Components.HitsDB, $"Saved {hitsListView.SelectedItems.Count} hits"); } catch (Exception ex) { Globals.LogError(Components.HitsDB, $"Exception while saving hits - {ex.Message}"); } }