Exemplo n.º 1
0
  public void sendRequest() {
    if (requestBuilderPartCurr != null) {
      try {
        requestBuilderPartCurr.processContents();
      } catch (Exception e) {
        displayExceptionError(e);
        return;
      }
    }

    HttpUriRequest uriRequest;
    try {
      uriRequest = requestBuilder.buildRequest();
    } catch (Exception e) {
      displayExceptionError(e);
      return;
    }

    BasicHttpContext ctx = new BasicHttpContext();
    IHttpResponse response;
    try {
      response = requestEngine.sendRequest(uriRequest, ctx);
      responseViewer.displayHttpResponse(response.getRawResponse());
    } catch (Exception e) {
      displayExceptionError(e);
      return;
    }
    if (contentAnalyzer != null) {
      contentAnalyzer.processResponse(response);
    }

    if (requestBuilderPartCurr != null) {
      requestBuilderPartCurr.refresh();
    }
  }
Exemplo n.º 2
0
  @Override
  public void runModule(
      HttpUriRequest request, IHttpResponse response, IInjectionModuleContext ctx) {
    final IPathState ps = ctx.getPathState();

    if (response.isFetchFail()) {
      ctx.error(request, response, "Fetch failed during parent directory check");
    } else if (ps.matchesPathFingerprint(response.getPageFingerprint())) {
      ctx.debug("Problem with parent directory behavior");
      ctx.getPathState().setBadParentDirectory();
    }

    ipsCheck.initialize(ctx.getPathState());
  }
Exemplo n.º 3
0
  @Override
  public void processResponse(
      IWebCrawler crawler, HttpUriRequest request, IHttpResponse response, Object argument) {
    final IInjectionModuleContext ctx = (IInjectionModuleContext) argument;

    final IPathState ps = ctx.getPathState();
    ps.setResponse(response);
    ps.getPath().setVisited(true);

    if (response.isFetchFail()) {
      ctx.error(request, response, "during initial file fetch");
      return;
    }

    final IPathState ps404Parent = ps.get404Parent();
    boolean is404Response =
        ((ps404Parent == null) && response.getResponseCode() == 404)
            || ((ps404Parent != null)
                && ps404Parent.has404FingerprintMatching(response.getPageFingerprint()));

    if (is404Response) {
      ps.setPageMissing();
    } else {
      if (response.getResponseCode() > 400)
        ctx.debug("Page is not accessible.  http code (" + response.getResponseCode() + ")");

      final IPathState pps = ps.getParentState();
      if (pps == null
          || pps.getResponse() == null
          || !ps.matchesPathFingerprint(pps.getPathFingerprint())) {
        ctx.responseChecks(request, response);
      }
      if (ps404Parent != null && !ps.isParametric()) secondaryExtChecks.initialize(ps);
      if (ps.getPath().getPathType() == PathType.PATH_FILE) caseCheck.initialize(ps);
    }

    ps.unlockChildren();
    if (ps.isParametric()) {
      parametricChecks.initialize(ps);
    } else {
      injectionChecks.initialize(ps);
    }
  }