コード例 #1
0
ファイル: DirParentCheck.java プロジェクト: troiska/Vega
  @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());
  }
コード例 #2
0
ファイル: FileProcessor.java プロジェクト: troiska/Vega
  @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);
    }
  }