Skip to main content

Default Variables Reference

Osmedeus workflows use template variables for dynamic content substitution. Variables are enclosed in double curly braces: {{variable}}.

Template Syntax

Standard Variables

Standard variables use {{variable}} syntax and are evaluated at step execution time.
command: "nuclei -l {{Output}}/urls.txt -t {{Data}}/templates/"

Secondary Variables (Foreach)

Foreach loops use [[variable]] syntax to avoid conflicts with standard templates:
- name: scan-each
  type: foreach
  input: "{{Output}}/subdomains.txt"
  variable: sub
  step:
    type: bash
    command: "httpx -u [[sub]] >> {{Output}}/httpx.txt"

Built-in Variables

Path Variables

VariableDescriptionDefault
{{BaseFolder}}Base installation folder~/osmedeus-base
{{base_folder}}Alias for BaseFolder~/osmedeus-base
{{Binaries}}Path to binaries{{BaseFolder}}/external-binaries
{{Data}}Path to data files{{BaseFolder}}/data
{{ExternalData}}Alias for Data{{BaseFolder}}/data
{{ExternalConfigs}}Path to external configs{{BaseFolder}}/configs
{{ExternalScripts}}Path to external scripts{{BaseFolder}}/scripts
{{ExternalAgentConfigs}}Path to agent configs{{BaseFolder}}/external-agent-configs
{{ExternalAgents}}Alias for ExternalAgentConfigs{{BaseFolder}}/external-agent-configs
{{Workflows}}Path to workflows{{BaseFolder}}/workflows
{{MarkdownTemplates}}Path to markdown report templates{{BaseFolder}}/markdown-report-templates
{{ExternalMarkdowns}}Alias for MarkdownTemplates{{BaseFolder}}/markdown-report-templates
{{Workspaces}}Path to workspaces (overridable with -W flag)~/workspaces-osmedeus
{{SnapshotsFolder}}Path to snapshots{{BaseFolder}}/snapshots

Target Variables

VariableDescriptionExample
{{Target}}Current scan targetexample.com
{{target}}Alias for Targetexample.com
{{TargetFile}}File containing targets (-T flag)/path/to/targets.txt
{{TargetSpace}}Sanitized target (workspace name)example_com
{{Output}}Output directory for target{{Workspaces}}/example_com
{{Workspace}}Alias for TargetSpaceexample_com
{{workspace}}Alias for Workspaceexample_com

Target Heuristics (Auto-Detected)

These variables are automatically populated based on target type detection. Set --heuristics none to disable.
VariableDescriptionApplies To
{{TargetType}}Detected typeurl, domain, ip, file, unknown
{{HeuristicsCheck}}Heuristics levelbasic (default), deep, none
URL Target Variables (when {{TargetType}} is url):
VariableDescriptionExample
{{TargetBaseURL}}Base URL without pathhttps://example.com:8080
{{TargetRootURL}}Root URL (scheme+host)https://example.com
{{TargetHostname}}Hostname from URLexample.com
{{TargetRootDomain}}Root domainexample.com
{{TargetTLD}}Top-level domaincom
{{TargetSLD}}Second-level domainexample
{{Org}}Alias for TargetSLDexample
{{TargetHost}}Host with portexample.com:8080
{{TargetPort}}Port number8080
{{TargetPath}}URL path/api/v1
{{TargetFileExt}}File extensionhtml
{{TargetScheme}}URL schemehttps
{{TargetStatusCode}}HTTP status code (if detected)200
{{TargetContentLength}}Content length (if detected)1234
Domain Target Variables (when {{TargetType}} is domain):
VariableDescriptionExample
{{TargetRootDomain}}Root domainexample.com
{{TargetTLD}}Top-level domaincom
{{TargetSLD}}Second-level domainexample
{{Org}}Alias for TargetSLDexample
{{TargetIsWildcard}}Is wildcard subdomaintrue, false
{{TargetResolvedIP}}Resolved IP address (if available)93.184.216.34
IP Target Variables (when {{TargetType}} is ip):
VariableDescriptionExample
{{TargetRootDomain}}Original IP value192.168.1.1

Platform Detection Variables

VariableDescriptionExample Values
{{PlatformOS}}Operating systemlinux, darwin, windows
{{PlatformArch}}CPU architectureamd64, arm64
{{PlatformInDocker}}Running in Docker containertrue, false
{{PlatformInKubernetes}}Running in Kubernetes podtrue, false
{{PlatformCloudProvider}}Detected cloud provideraws, gcp, azure, local

Thread Variables

VariableDescriptionDefault
{{threads}}Thread count (tactic based)10
{{baseThreads}}Base thread count (threads / 2)5

Metadata Variables

VariableDescriptionExample
{{Version}}Osmedeus version5.0.0
{{ModuleName}}Current workflow/module namesubdomain-enum
{{workflow}}Alias for ModuleNamesubdomain-enum
{{FlowName}}Parent flow name (empty if running module directly)recon-flow
{{RunUUID}}UUID for current run execution550e8400-e29b-41d4-a716-446655440000
{{run_uuid}}Alias for RunUUID550e8400-e29b-41d4-a716-446655440000
{{DBRunID}}Integer Run.ID for database foreign keys42
{{TaskDate}}Task date2025-01-15
{{Today}}Current date2025-01-15
{{TimeStamp}}Unix timestamp1705312800
{{CurrentTime}}Current time (ISO 8601)2025-01-15T10:00:00
{{RandomString}}Random 6-char lowercase stringxkmprq

Constants

VariableDescriptionExample
{{DefaultUA}}Default User-Agent stringMozilla/5.0 ...

State File Variables

VariableDescription
{{StateExecutionLog}}Path to execution log
{{StateConsoleLog}}Path to console log
{{StateCompletedFile}}Path to run-completed.json
{{StateFile}}Path to run-state.json
{{StateWorkflowFile}}Path to run-workflow.yaml
{{StateWorkflowFolder}}Path to run-modules folder

Chunk Mode Variables

Used for distributed scanning with --chunk flag:
VariableDescription
{{ChunkIndex}}Current chunk index
{{ChunkSize}}Number of items per chunk
{{TotalChunks}}Total number of chunks
{{ChunkStart}}Start position
{{ChunkEnd}}End position

Event Trigger Variables

These variables are only available for event-triggered workflows:
VariableDescriptionExample
{{EventEnvelope}}Full event envelope as JSON string{"topic":"assets.new",...}
{{EventTopic}}Event topicassets.new
{{EventSource}}Event sourcenuclei
{{EventDataType}}Event data typeasset
{{EventTimestamp}}Event timestamp2025-01-15T10:00:00Z
{{EventData}}Event data payload as JSON string{"url":"https://...",...}

Utility Functions

Utility functions are executed via the Goja JavaScript runtime and can be used in function steps or template expressions.

File Operations

FunctionReturnsDescription
fileExists(path)boolCheck if file exists
fileLength(path)intCount non-empty lines in file
dirLength(path)intCount entries in directory
fileContains(path, pattern)boolCheck if file contains pattern
regexExtract(path, pattern)[]stringExtract matching lines from file
readFile(path)stringRead entire file contents
readLines(path)[]stringRead file as array of lines
removeFile(path)boolDelete a file
removeFolder(path)boolDelete folder recursively
rm_rf(path)boolDelete file or folder recursively
remove_all_except(folder, keep)boolRemove all except keep_file
createFolder(path)boolCreate folder recursively
appendFile(dest, source)boolAppend source file to dest
moveFile(source, dest)boolMove/rename file
glob(pattern)[]stringList files matching glob pattern
grep_string(source, str)stringReturn lines containing string
grep_regex(source, pattern)stringReturn lines matching regex
grep_string_to_file(dest, source, str)boolWrite matching lines to file
grep_regex_to_file(dest, source, pattern)boolWrite matching lines to file
remove_blank_lines(path)boolRemove blank lines in-place

String Operations

FunctionReturnsDescription
trim(str)stringTrim whitespace
split(str, delim)[]stringSplit by delimiter
join(arr, delim)stringJoin with delimiter
replace(str, old, new)stringReplace all occurrences
contains(str, substr)boolCheck contains substring
startsWith(str, prefix)boolCheck starts with prefix
endsWith(str, suffix)boolCheck ends with suffix
toLowerCase(str)stringConvert to lowercase
toUpperCase(str)stringConvert to uppercase
match(str, pattern)boolCheck regex match
regex_match(pattern, str)boolCheck regex match (pattern first)
cut_with_delim(input, delim, field)stringExtract field (1-indexed)
normalize_path(input)stringReplace special chars with _
clean_sub(path, target?)boolClean and dedupe subdomains

Type Conversion

FunctionReturnsDescription
parseInt(str)intParse string to integer
parseFloat(str)floatParse string to float
toString(val)stringConvert to string
toBoolean(val)boolConvert to boolean

Utility

FunctionReturnsDescription
len(val)intGet length of string/array
isEmpty(val)boolCheck if empty
isNotEmpty(val)boolCheck if not empty
printf(message)voidPrint to stdout
cat_file(path)voidPrint file content
exit(code)voidExit with code
exec_cmd(command)stringExecute bash command
sleep(seconds)voidPause execution

Logging

FunctionReturnsDescription
log_debug(message)voidLog with [DEBUG] prefix
log_info(message)voidLog with [INFO] prefix
log_warn(message)voidLog with [WARN] prefix
log_error(message)voidLog with [ERROR] prefix

HTTP

FunctionReturnsDescription
httpRequest(url, method, headers, body)objectMake HTTP request
http_get(url)objectHTTP GET request
http_post(url, body)objectHTTP POST request

Generation

FunctionReturnsDescription
randomString(length)stringRandom alphanumeric string
uuid()stringGenerate UUID v4

Encoding

FunctionReturnsDescription
base64Encode(str)stringEncode to base64
base64Decode(str)stringDecode from base64

Data Query

FunctionReturnsDescription
jq(jsonData, query)anyExtract data using jq syntax
jq_from_file(path, query)anyjq from JSON file

Notification

FunctionReturnsDescription
notifyTelegram(message)boolSend Telegram message
sendTelegramFile(path, caption?)boolSend file to Telegram
notifyWebhook(message)boolSend to all webhooks
sendWebhookEvent(eventType, data)boolSend event to webhooks

CDN/Storage

FunctionReturnsDescription
cdnUpload(localPath, remotePath)boolUpload to cloud storage
cdnDownload(remotePath, localPath)boolDownload from cloud storage
cdnExists(remotePath)boolCheck if file exists
cdnDelete(remotePath)boolDelete from cloud storage
cdnSyncUpload(localDir, remotePrefix)objectSync directory to cloud
cdnSyncDownload(remotePrefix, localDir)objectSync from cloud
cdnGetPresignedURL(remotePath, expiryMins?)stringGenerate presigned URL
cdnList(prefix?)[]objectList files with metadata
cdnStat(remotePath)object|nullGet file metadata

Unix Commands

FunctionReturnsDescription
sortUnix(input, output?)boolSort with LC_ALL=C sort -u
wgetUnix(url, output?)boolDownload with wget
gitClone(repo, dest?)boolClone git repository
zipUnix(source, dest)boolCreate zip archive
unzipUnix(source, dest?)boolExtract zip archive
tarUnix(source, dest)boolCreate tar.gz archive
untarUnix(source, dest?)boolExtract tar.gz archive
diffUnix(file1, file2, output?)stringCompare files
sed_string_replace(syntax, src, dest)boolString replacement
sed_regex_replace(syntax, src, dest)boolRegex replacement

Archive (Go implementations)

FunctionReturnsDescription
zip_dir(source, dest)boolZip using Go archive/zip
unzip_dir(source, dest)boolUnzip using Go archive/zip

Diff

FunctionReturnsDescription
extractDiff(file1, file2)stringLines only in file2

Output

FunctionReturnsDescription
save_content(content, path)boolSave content to file
jsonl_to_csv(source, dest)boolConvert JSONL to CSV
csv_to_jsonl(source, dest)boolConvert CSV to JSONL
jsonl_unique(source, dest, fields)boolDeduplicate JSONL
jsonl_filter(source, dest, fields)boolFilter JSONL fields

URL Processing

FunctionReturnsDescription
interesting_urls(src, dest, field?)boolDedupe and filter URLs

Markdown

FunctionReturnsDescription
render_markdown_from_file(path)stringRender markdown
print_markdown_from_file(path)voidPrint with highlighting
convert_jsonl_to_markdown(input, output)boolJSONL to markdown table
convert_csv_to_markdown(path)stringCSV to markdown table
render_markdown_report(template, output)boolRender report template
generate_security_report(template)boolGenerate security report

Database

FunctionReturnsDescription
db_update(table, key, field, value)boolUpdate database field
db_import_asset(workspace, json)boolImport asset (upsert)
db_raw_insert_asset(workspace, json)intInsert asset (returns ID)
db_import_asset_from_file(workspace, path)intImport from JSONL
db_import_vuln(workspace, json)boolImport vulnerability
db_import_vuln_from_file(workspace, path)intImport vulns from JSONL
db_total_subdomains(path)intCount and update workspace
db_total_urls(path)intCount and update workspace
db_total_assets(path)intCount and update workspace
db_total_vulns(path)intCount and update workspace
db_vuln_critical(path)intCount critical vulns
db_vuln_high(path)intCount high vulns
db_vuln_medium(path)intCount medium vulns
db_vuln_low(path)intCount low vulns
db_total_ips(path)intCount and update IPs
db_total_links(path)intCount and update links
db_total_content(path)intCount and update content
db_total_archive(path)intCount and update archive
runtime_export()boolExport run state
register_artifact(path, type?)boolRegister as artifact
store_artifact(path)boolStore as artifact
db_select_assets(workspace, format)stringSelect assets
db_select_assets_filtered(ws, status, type, fmt)stringFiltered assets
db_select_vulnerabilities(workspace, format)stringSelect vulns
db_select_vulnerabilities_filtered(ws, sev, asset, fmt)stringFiltered vulns
db_select(sql_query, format)stringExecute SELECT
db_select_to_file(sql_query, dest)boolSELECT to file
db_select_to_jsonl(sql_query, fields, dest)boolSELECT to JSONL
db_select_total_subdomains()intGet workspace subdomain count
db_select_total_urls()intGet workspace URL count
db_select_total_assets()intGet workspace asset count
db_select_total_vulns()intGet workspace vuln count
db_select_vuln_critical()intGet critical count
db_select_vuln_high()intGet high count
db_select_vuln_medium()intGet medium count
db_select_vuln_low()intGet low count
db_asset_diff(workspace)stringGet asset diff JSONL
db_vuln_diff(workspace)stringGet vuln diff JSONL
db_asset_diff_to_file(workspace, dest)boolAsset diff to file
db_vuln_diff_to_file(workspace, dest)boolVuln diff to file

Environment Functions

FunctionReturnsDescription
os_getenv(name)stringGet environment variable value
os_setenv(name, value)boolSet environment variable

Installer Functions

FunctionReturnsDescription
go_getter(url, dest)boolDownload files/repos using go-getter
go_getter_with_sshkey(ssh_key, git_url, dest)boolClone git repo with SSH key
nix_install(package, dest?)boolInstall package via Nix

LLM Functions

FunctionReturnsDescription
llm_invoke(message)stringSimple LLM call with direct message
llm_invoke_custom(message, body_json)stringLLM call with custom POST body template (use {{message}} placeholder)
llm_conversations(msg1, msg2, ...)stringMulti-turn conversation with role:content format messages

Usage Examples

Using Environment Functions

- name: setup-api-key
  type: function
  functions:
    - "os_setenv('API_KEY', '{{api_token}}')"
    - "log_info('API key configured')"

- name: read-config
  type: function
  function: "os_getenv('HOME')"
  exports:
    home_dir: "{{_result}}"

Using Installer Functions

- name: install-tools
  type: function
  functions:
    - "go_getter('https://github.com/projectdiscovery/nuclei/releases/download/v3.0.0/nuclei_3.0.0_linux_amd64.zip', '{{Binaries}}')"
    - "nix_install('subfinder', '{{Binaries}}')"

- name: clone-private-repo
  type: function
  function: "go_getter_with_sshkey('~/.ssh/id_rsa', '[email protected]:user/private-templates.git', '{{Data}}/templates')"

Database Functions

- name: update-stats
  type: function
  functions:
    - "db_total_subdomains('{{Output}}/subdomains.txt')"
    - "db_total_urls('{{Output}}/urls.txt')"
    - "db_import_asset_from_file('{{Workspace}}', '{{Output}}/httpx.jsonl')"
    - "db_import_vuln_from_file('{{Workspace}}', '{{Output}}/nuclei.jsonl')"

Conditional Logic with Functions

- name: check-and-process
  type: function
  pre_condition: "fileExists('{{Output}}/results.txt')"
  function: "fileLength('{{Output}}/results.txt')"
  exports:
    result_count: "{{_result}}"

- name: decide-next
  type: function
  function: "log_info('Results: ' + {{result_count}})"
  decision:
    switch: "{{result_count}}"
    cases:
      "0": { goto: _end }
    default: { goto: process-results }