Class SnapshotSummary

java.lang.Object
ai.attackframework.tools.burp.sinks.SnapshotSummary

public final class SnapshotSummary extends Object
Shared helper for logging completion summaries of one-shot export waves.

Reporters such as ProxyHistoryIndexReporter and SitemapIndexReporter run bounded, single-pass exports at Start. This helper captures counter deltas across the run and emits a single INFO-level panel line with attempted, file, and OpenSearch outcomes. The file={...}; openSearch={...} body shares the substructure with the Repeater Tabs startup completion summary so operators can visually align per-source totals across reporters; the surrounding prefix and suffix differ per reporter.

Two counter sources are supported via forRoute(TrafficRouteBucket.Route) and forIndexKey(String): traffic reporters use the per-route bucket counters, while non-traffic reporters (Sitemap, Findings, etc.) use the index-key totals exposed by ExportStats / FileExportStats. Both flavors share identical body output.

  • Method Details

    • forRoute

      public static SnapshotSummary.Baseline forRoute(TrafficRouteBucket.Route route)
      Snapshots the current file and OpenSearch counters for a traffic route. Use before starting a run and pair with logInfo(java.lang.String, ai.attackframework.tools.burp.sinks.SnapshotSummary.Baseline, int, long, boolean, boolean) after the run to compute deltas.
      Parameters:
      route - route whose counters should be tracked; null returns an empty snapshot
      Returns:
      baseline snapshot; never null
    • forIndexKey

      public static SnapshotSummary.Baseline forIndexKey(String indexKey)
      Snapshots the current file and OpenSearch counters for a non-traffic indexKey.
      Parameters:
      indexKey - logical index key (for example "sitemap", "findings"); null or blank returns an empty snapshot
      Returns:
      baseline snapshot; never null
    • logInfo

      public static void logInfo(String prefix, SnapshotSummary.Baseline baseline, int attempted, long durationMs, boolean openSearchActive, boolean fileActive)
      Logs a completion summary comparing current counters to baseline.
      Parameters:
      prefix - logger bracket prefix (for example "ProxyHistory", "Sitemap")
      baseline - snapshot captured before the run started
      attempted - total documents attempted in the run (including those that produced no doc)
      durationMs - wall-clock run duration in milliseconds
      openSearchActive - whether the OpenSearch sink was active for the run
      fileActive - whether any file sink was active for the run
    • formatCompletionBody

      public static String formatCompletionBody(SnapshotSummary.Baseline baseline, boolean openSearchActive, boolean fileActive)
      Builds the file={...}; openSearch={...} body fragment that reporters can compose into their own completion log lines.

      Each section is included only when the corresponding sink was active for the run. When both are inactive the method returns an empty string. Reporters are responsible for prepending/appending any surrounding prefix, suffix, or separators.

      Parameters:
      baseline - snapshot captured before the run; null yields zeroed deltas
      openSearchActive - whether the OpenSearch sink was active for the run
      fileActive - whether any file sink was active for the run
      Returns:
      fragment such as "file={success=2, failure=0}; openSearch={success=2, failure=0}"; never null