Learn how to efficiently distribute workflow nodes across multiple machines using splitter nodes and batch output patterns.
to-distribute.txt
. The file contains the following data:
string-to-file
which is a very basic one, and it is used to convert the string back to the file and help other tools continue the distribution. In our case, both string-to-file
and nuclei
will execute three times for each of domains described in the to-distribute.txt
file.
folder
output, you can check more on how inputs and outputs work in the inputs and outputs tutorialrecursively-cat-all
(or any script) to the nuclei
output and then connect the custom-script
to the folder
output.
in/nuclei-1/1/output.txt
, in/nuclei-1/2/output.txt
, in/nuclei-1/3/output.txt
and merge them into one file out/output.txt
.
recursively-cat-all
script, you can see that visualization showing the distribution is gone, this means that splitter chain is stopped and that this script got all results in the file and folder structure mentioned above.file
inputs and you want to distribute the inputs in batches.
Let’s use a bigger file as example:
9
domains. We want to distribute these domains to multiple machines and to different tools. We can use a batch output pattern to split the data into multiple files and then connect these files to different nodes (tools).
Our fleet has 3
machines, and we want to distribute these domains to 3 machines. We can use a batch pattern to split the data into 3 files, each containing 3 domains. This pattern consists of 3 main nodes:
batch-output
node. It will generate a file with the number of lines in the input file.
file-splitter
This is how the pattern looks like:
generate-line-batches
script, we can see that it is calculating the number of lines in the input file and then it is creating a file with the number of lines in the input file.
BATCH_SIZE
which is the number of lines in the input file that will be in each batch.
Notice also how the initial list is being passed to the batch-output
node. So even if you don’t understand the script, you will be able to understand that this script is getting:
generate-line-batches
scriptnuclei
tool to scan these domains.
BATCH_SIZE
to 100
in the generate-line-batches
script. In this case, we will have 100
domains in each batch, and the httpx
and nuclei
will each execute 100
times, which is less than current splitter limit.httpx
to the batch-output
output, and then connect the nuclei
to the batch-output
output.recursively-cat-all
script to the nuclei
output, and then connect the custom-script
to the folder
output.httpx
and then create two separate files in recursively-cat-all
script, one for nuclei
and one for katana
.
When we connect katana
to httpx
it will also execute 100
times. Just like nuclei
will.
recursively-cat-all
script to merge-all-results
and change the script so we can have two files:
nuclei-results.txt
katana-results.txt
merge-all-results
script we will have: