public PageSBlockBrowserAction(SBlockBrowserAction block) { InitializeComponent(); vm = block; DataContext = vm; foreach (var a in Enum.GetNames(typeof(BrowserAction))) { actionCombobox.Items.Add(a); } actionCombobox.SelectedIndex = (int)vm.Action; }
private void debuggerCheck(object sender, DoWorkEventArgs e) { // Dispose of previous browser (if any) if (vm.BotData != null) { if (vm.BotData.BrowserOpen) { OB.Logger.LogInfo(Components.Stacker, "Quitting the previously opened browser"); vm.BotData.Driver.Quit(); OB.Logger.LogInfo(Components.Stacker, "Quitted correctly"); } } // Convert Observables OB.Logger.LogInfo(Components.Stacker, "Converting Observables"); vm.ConvertKeychains(); // Initialize Request Data OB.Logger.LogInfo(Components.Stacker, "Initializing the request data"); CProxy proxy = null; if (vm.TestProxy.StartsWith("(")) // Parse in advanced mode { try { proxy = (new CProxy()).Parse(vm.TestProxy); } catch { OB.Logger.LogError(Components.Stacker, "Invalid Proxy Syntax", true); } } else // Parse in standard mode { proxy = new CProxy(vm.TestProxy, vm.ProxyType); } // Initialize BotData and Reset LS var cData = new CData(vm.TestData, OB.Settings.Environment.GetWordlistType(vm.TestDataType)); vm.BotData = new BotData(OB.Settings.RLSettings, vm.Config.Config.Settings, cData, proxy, vm.UseProxy, new Random()); vm.LS.Reset(); // Ask for user input foreach (var input in vm.BotData.ConfigSettings.CustomInputs) { OB.Logger.LogInfo(Components.Stacker, $"Asking for user input: {input.Description}"); App.Current.Dispatcher.Invoke(new Action(() => { (new MainDialog(new DialogCustomInput(vm, input.VariableName, input.Description), "Custom Input")).ShowDialog(); })); } // Set start block OB.Logger.LogInfo(Components.Stacker, "Setting the first block as the current block"); // Print start line var proxyEnabledText = vm.UseProxy ? "ENABLED" : "DISABLED"; vm.BotData.LogBuffer.Add(new LogEntry($"===== DEBUGGER STARTED FOR CONFIG {vm.Config.Name} WITH DATA {vm.TestData} AND PROXY {vm.TestProxy} ({vm.ProxyType}) {proxyEnabledText} ====={Environment.NewLine}", Colors.White)); timer = new Stopwatch(); timer.Start(); // Open browser if Always Open if (vm.Config.Config.Settings.AlwaysOpen) { OB.Logger.LogInfo(Components.Stacker, "Opening the Browser"); SBlockBrowserAction.OpenBrowser(vm.BotData); } // Step-by-step if (vm.SBS) { vm.SBSClear = true; // Good to go for the first round do { Thread.Sleep(100); if (debugger.CancellationPending) { OB.Logger.LogInfo(Components.Stacker, "Found cancellation pending, aborting debugger"); return; } if (vm.SBSClear) { vm.SBSEnabled = false; Process(); OB.Logger.LogInfo(Components.Stacker, $"Block processed in SBS mode, can proceed: {vm.LS.CanProceed}"); vm.SBSEnabled = true; vm.SBSClear = false; } }while (vm.LS.CanProceed); } // Normal else { do { if (debugger.CancellationPending) { OB.Logger.LogInfo(Components.Stacker, "Found cancellation pending, aborting debugger"); return; } Process(); }while (vm.LS.CanProceed); } // Quit Browser if Always Quit if (vm.Config.Config.Settings.AlwaysQuit || (vm.Config.Config.Settings.QuitOnBanRetry && (vm.BotData.Status == BotStatus.BAN || vm.BotData.Status == BotStatus.RETRY))) { try { vm.BotData.Driver.Quit(); vm.BotData.BrowserOpen = false; OB.Logger.LogInfo(Components.Stacker, "Successfully quit the browser"); } catch (Exception ex) { OB.Logger.LogError(Components.Stacker, $"Cannot quit the browser - {ex.Message}"); } } }