./redteamer

Functions

Collection Functions

Functions for the creation, manipulation and logical conditionals of lists, sets and maps.


List Functions

These functions allow you to create, modify, and manipulate lists in various ways.

chunk_list

The col::chunk_list function enables you to split a single list into multiple smaller lists, or 'chunks'.

col::chunk_list(["192.168.1.1", "192.168.1.2", "192.168.1.3", "192.168.1.4", "192.168.1.5"], 2)
# Result:
[
  ["192.168.1.1", "192.168.1.2"],
  ["192.168.1.3", "192.168.1.4"],
  ["192.168.1.5"],
]

concat

The col::concat function allows you to merge two or more lists into one unified list.

col::concat(["payload1", "payload2"], ["payload3", "payload4"])
# Result:
[
  "payload1",
  "payload2",
  "payload3",
  "payload4",
]

distinct

The col::distinct function takes a list and refines it by eliminating any duplicate elements.

col::distinct(["192.168.1.1", "192.168.1.2", "192.168.1.1", "192.168.1.3"])
# Result:
[
  "192.168.1.1",
  "192.168.1.2",
  "192.168.1.3",
]

element

The col::element function allows you to access a specific element from a list.

col::element(["payload1", "payload2", "payload3"], 1)
# Result:
"payload2"

flatten

The col::flatten function takes a list and simplifies it by replacing any elements that are lists with a flattened sequence of the list contents.

col::flatten([["payload1", "payload2"], ["payload3"]])
# Result:
[
  "payload1",
  "payload2",
  "payload3",
]

index

The col::index function allows you to locate the index of a specific value within a list.

col::index(["192.168.1.1", "192.168.1.2", "192.168.1.3"], "192.168.1.2")
# Result:
1

reverse

The col::reverse function accepts a sequence and creates a new sequence that contains the same elements but in reverse order.

col::reverse(["payload1", "payload2", "payload3"])
# Result:
[
  "payload3",
  "payload2",
  "payload1",
]

slice

The col::slice function allows you to extract a specific range of consecutive elements from within a list.

col::slice(["192.168.1.1", "192.168.1.2", "192.168.1.3", "192.168.1.4"], 1, 3)
# Result:
[
  "192.168.1.2",
  "192.168.1.3",
]

sort

The col::sort function enables you to take a list of strings and return a new list, with all the strings arranged in lexicographic order.

col::sort(["example.com", "test.com", "abc.com"])
# Result:
[
  "abc.com",
  "example.com",
  "test.com",
]

one

The col::one function accepts a list, set, or tuple and returns a specific output based on the number of elements in the collection.

col::one(["192.168.1.1"])
# Result:
"192.168.1.1"

Set Functions

Set functions in RedTeamer provide you with powerful tools for performing operations on sets, or lists without duplicate elements.

set_intersection

The col::set_intersection function allows you to take multiple sets as input and generates a single set that includes only the elements common to all the input sets.

col::set_intersection(["SQL Injection", "XSS"], ["XSS", "CSRF"], ["XSS", "RCE"])
# Result:
[
  "XSS",
]

set_product

The col::set_product function generates all possible combinations of elements from given sets, providing an exhaustive list of permutations.

col::set_product(["development", "staging", "production"], ["app1", "app2"])
# Result:
[
  ["development", "app1"],
  ["development", "app2"],
  ["staging", "app1"],
  ["staging", "app2"],
  ["production", "app1"],
  ["production", "app2"],
]

set_subtract

The col::set_subtract function enables you to take two sets and generate a new set that includes only the elements present in the first set but not in the second.

col::set_subtract(["SQL Injection", "XSS", "CSRF"], ["SQL Injection", "CSRF"])
# Result:
toset([
  "XSS",
])

set_union

The col::set_union function allows you to take multiple sets and generate a single set that includes all the unique elements from the given sets.

col::set_union(["SQL Injection", "XSS"], ["XSS", "CSRF"], ["RCE"])
# Result:
[
  "SQL Injection",
  "XSS",
  "CSRF",
  "RCE",
]

Map Functions

Map functions in RedTeamer provide a set of tools for managing and manipulating map data structures, which are collections of key-value pairs.

keys

The col::keys function allows you to extract the keys from a given map.

col::keys({username="admin", password="1234", host="localhost"})
# Result:
[
  "username",
  "password",
  "host",
]

lookup

The col::lookup function allows you to extract the value of a specific element from a map using its key.

col::lookup({username="admin", password="1234"}, "password", "not found")
# Result:
"1234"

merge

The col::merge function allows you to take an arbitrary number of maps or objects and merge them into a single map or object.

col::merge({username="admin"}, {password="1234"}, {host="localhost"})
# Result:
{
  "username" = "admin"
  "password" = "1234"
  "host" = "localhost"
}

values

The col::values function allows you to take a map and generate a list containing the values of that map's elements.

col::values({username="admin", password="1234", host="localhost"})
# Result:
[
  "admin",
  "1234",
  "localhost",
]

zipmap

The col::zipmap function allows you to create a map from two corresponding lists: one for keys and one for values.

col::zipmap(["username", "password"], ["admin", "1234"])
# Result:
{
  "username" = "admin"
  "password" = "1234"
}

contains

The col::contains function assesses the presence of a single value within a list or set.

col::contains(["SQL Injection", "XSS", "CSRF"], "XSS")
# Result:
true

Data Transformation

Data transformation functions in RedTeamer provide a set of tools for modifying and transforming your data to better suit your needs.

coalesce_list

The col::coalesce_list function accepts multiple list arguments and returns the first one that isn't empty.

col::coalesce_list([], ["payload1", "payload2"], ["payload3"])
# Result:
["payload1", "payload2"]

compact

The col::compact function takes a list of strings and refines it by removing any elements that are null or empty strings.

col::compact(["payload1", "", "payload2", null, "payload3"])
# Result:
[
  "payload1",
  "payload2",
  "payload3",
]

match_keys

The col::match_keys function allows you to construct a new list by selecting elements from one list, based on matching indexes of values in another list.

col::match_keys(["payload1", "payload2", "payload3"], ["low", "high", "high"], ["high"])
# Result:
[
  "payload2",
  "payload3",
]

transpose

The col::transpose function interchanges keys and values in a map of lists of strings, thereby producing a new map.

col::transpose({"vuln1" = ["host1", "host2"], "vuln2" = ["host2", "host3"]})
# Result:
{
  "host1" = [
    "vuln1",
  ],
  "host2" = [
    "vuln1",
    "vuln2",
  ],
  "host3" = [
    "vuln2",
  ],
}
Previous
Commands