Core concepts
Blocks
Discover the block types built into RedTeamer. Or don't, the choice is yours.
Module
The module block is required and defines the metadata and runtime image for a module.
Required Arguments
- description (
string): Purpose of the module. - image (
string): Container image with the tools.
Optional Arguments
- help_url (
string): Link to docs or repo.
Outputs
- dir (
string): Directory of this module file.
Example
module {
description = "Enumerate directories on a target web server"
image = "ubuntu:latest"
help_url = "https://github.com/redteamer-io/docs"
}
Import
The import block declares a dependency on an external module collection.
Required Arguments
- source (
string): Git repository URL of the module pack.
Example:https://github.com/redteamer-io/core.git
Optional Arguments
- version (
string): SemVer version constraint.
If not set, the latest stable version is used.
Outputs
- dir (
string): Local path where the import is downloaded.
Example
import "core" {
source = "https://github.com/redteamer-io/core.git"
version = "~> 1.0"
}
Input
The input block lets operators or modules pass values at runtime.
Required Arguments
- description (
string): Explains the purpose of the input. - type (
type): Data type (string,number,list(string), etc.). - example (
any): Example usage for documentation.
Optional Arguments
- default (
any): Value if the operator does not set one. - nullable (
bool): If true, allowsnull. Default is false.
Nested Blocks
- assert: Validate values. Fail with a custom error if the condition is false.
Example
input "target" {
description = "Target web application"
type = string
example = "https://corp-portal.internal"
assert {
condition = val::url(self.value)
error_msg = "Input must be a valid URL"
}
}
Var
The var block is used to defines any number of staic reusable values inside the module.
var {
common = "/usr/share/wordlists/dirb/common.txt"
targeted = "/usr/share/wordlists/dirb/targeted.txt"
wordlists = [var.common, var.targeted]
}
Service
The service block defines a long-running container process.
Use services for redirectors, C2 servers, phishing sites, or payload staging.
A service runs in the background for the duration of the run.
Required Arguments
- image (
string): The container image to run.
Optional Arguments
- command (
list(string)): Override the default command. - depends_on (
set): Specify dependent blocks. - entrypoint (
list(string)): Override the entrypoint. - envs (
map): Set environment variables. - host_network (
bool): Attach service to host network. - workdir (
string): Set working directory.
Nested Blocks
- assert: Validate conditions before service starts.
- health: Define health checks inside the container.
- command (
string): Command to test container health. - interval (
number): Seconds between checks. - retries (
number): Number of allowed failures. - start_period (
number): Delay before health checks begin. - timeout (
number): Seconds before check times out.
- command (
- port: Define container-to-host port mappings.
- container_port (
number): Port inside container. - host_port (
number): Port on host. - host_address (
string): Bind IP (optional). - protocol (
string):tcporudp(defaulttcp).
- container_port (
- retry: Configure retry logic.
- attempts (
number): Maximum retry attempts. - backoff (
bool): Enable exponential backoff. - condition (
bool): Retry if true. - delay (
number): Delay in seconds between retries.
- attempts (
Example
service "redirector" {
image = "nginx:stable"
port {
container_port = 80
host_port = 8080
}
envs = {
REDIRECT_URL = "http://10.0.6.15:50050"
}
health {
command = "curl -f http://localhost/"
interval = 10
retries = 3
timeout = 5
}
}
Action
Command
SSH Command
SSH Upload
SSH Download
HTTP Request
HTTP Download
HTTP Upload
Module
Output
The output block exposes values to the operator or other modules. Outputs often return results from reconnaissance or exploitation steps.
Required Arguments
- description (
string): Explains what this output is for and what value it represents. - example (
any type): A sample value that shows what this output will typically return. - type (
type): The data type of the output value. For example:string,number,map, orlist(string). - value (
any type): The value to be shared by this output. Usually this is a reference to something like a result from aactionblock or computed expression.
Nested Blocks
- assert: Validate output values.
Example
output "loot" {
description = "Exfiltrated files from target"
example = ["/loot/passwords.txt", "/loot/config.xml"]
type = list(filepath)
value = action.exfil.local_path
}