Private Beta
.md

BountyHub Docs

For Each

Bounded data-parallel execution over targets with step.for_each.

Recon often means doing the same thing thousands of times: probe every subdomain, screenshot every host, fuzz every parameter. step.for_each is the bounded data-parallel primitive for exactly that.

#Basic Shape

BHW
  • items — what to iterate over (see below).
  • do — an ordinary one-parameter function. It is deferred: stored as a template and invoked once per item at runtime. The item is bound to its single parameter; there is no magic item variable. Lambdas and named def functions both work.
  • concurrency — upper bound on parallel iterations, so you do not get your IP rate-limited or your runner OOM-killed at 3 AM.
BHW

A named function is equivalent and reads better for multi-step bodies:

BHW

#What Can Be Items

#Lists

Plain Starlark lists work:

BHW

#Files and globs

path.glob(base, pattern) enumerates files matching a pattern — this is how you fan out over partitioned transform output or per-target result files. Both arguments are required; prefer the keyword form:

BHW

#Typed transform expressions

Any typed Items<T> expression can be iterated directly, including partitioned transforms (see Transforms):

BHW

A Batch<T> is an execution-local group of items, not a file. Call .as_file() explicitly when a tool needs the batch materialized on disk.

#Multi-Step Bodies

The body returns a list of steps, so each iteration can be a small sequential pipeline of its own:

BHW

Iterations are independent: one target failing does not stop the others. The whole for_each step fails only after all iterations complete if any failed (unless allow_failure = True).

#Conditions Inside Bodies

Steps inside the body support the usual cond, so you can branch per item:

BHW

#Tuning Concurrency

Pick concurrency like you would pick threads for your own tooling:

  • CPU-bound tools (screenshots, headless browsers): low, e.g. 5.
  • Network-bound probes (httpx, subfinder): higher, e.g. 50.
  • Aggressive scanners (nuclei with all templates): moderate, and respect the program's scope and rate limits — being first to report is worthless if you get banned for hammering infrastructure.