Exemplo n.º 1
0
  public void workerStateChanged(
      ObservableValue<? extends Worker.State> observable,
      Worker.State oldValue,
      Worker.State newValue) {
    if (newValue == Worker.State.READY || newValue == Worker.State.SCHEDULED) {
      if (trafficBrowser != null) {
        trafficBrowser.setStartTime(Instant.now());
        trafficBrowser.getTraffic().clear();
      }
      numberOfAlerts.setValue("0");
    } else if (newValue == Worker.State.SUCCEEDED) {
      JSObject result = (JSObject) webEngine.executeScript("window");

      result.setMember(
          "burpCallbacks",
          new BurpExtenderCallbacksBridge(webEngine, BurpExtender.getBurpExtenderCallbacks()));

      result.setMember("burpKit", javaScriptHelpers);

      //            result.setMember("locals", locals);
      //
      //            result.setMember("globals", globals);

      if (controller != null) {
        result.setMember("burpController", controller);
      }
    } else if (newValue == Worker.State.FAILED) {
      dialog
          .title("Navigation Failed")
          .message(webEngine.getLoadWorker().getException().getMessage())
          .showInformation();
      resetParents();
    } else if (newValue == Worker.State.CANCELLED) {
      dialog
          .title("Navigation Cancelled")
          .message(webEngine.getLoadWorker().getMessage())
          .showInformation();
      resetParents();
    }
  }
Exemplo n.º 2
0
  private void handleAlert(WebEvent<String> event) {
    numberOfAlerts.setValue(Integer.toString(Integer.valueOf(numberOfAlerts.getValue()) + 1));
    String message = event.getData();

    /*
     * Handle all the external onAlert event handlers first.
     */
    for (EventHandler<WebEvent<String>> handler : alertListeners) handler.handle(event);

    /*
     * Finally display an alert box if the operator demands it.
     */
    if (showAlerts.getValue()) {
      dialog.title("JavaScript Alert").message(message).showInformation();
      resetParents();
    }
  }