Skip to content

Environment Variables

Automatic environment variable management that keeps terminal sessions in sync with workspace state.

How It Works

When hosts and credentials are modified in Markdown files, the extension:

  1. Parses YAML blocks and updates workspace state
  2. Writes current target info to .vscode/.zshrc
  3. New terminals automatically source these variables

Built-in Variables

Host Variables

VariableSourceDescription
$TARGETCurrent hostTarget hostname
$HOSTCurrent hostHostname (same as TARGET)
$DOMAINCurrent hostDomain name
$RHOSTCurrent hostTarget IP address
$IPCurrent hostIP address (same as RHOST)
$DC_HOSTCurrent DCDomain controller hostname
$DC_IPCurrent DCDomain controller IP

Credential Variables

VariableSourceDescription
$USERCurrent userUsername
$USERNAMECurrent userUsername (same as USER)
$PASSCurrent userPassword
$PASSWORDCurrent userPassword (same as PASS)
$NT_HASHCurrent userNTLM hash
$LOGINCurrent userLogin domain

Config Variables

VariableSourceDescription
$LHOSTConfigLocal listening IP
$LPORTConfigLocal listening port

Custom Variables

Add custom env vars via host/user props with ENV_ prefix:

yaml
- hostname: target.htb
  ip: 10.10.10.100
  props:
    ENV_WEB_PORT: "8080"

Exports as: export WEB_PORT='8080'

Additional custom variables via settings:

json
{
  "weaponized.envs": {
    "WORDLIST_DIR": "/usr/share/wordlists"
  }
}

Shell Helper Functions

.vscode/.zshrc also provides utilities:

bash
current_status          # View current target status
url encode "string"     # URL encode
url decode "string"     # URL decode
ntlm "password"         # Generate NTLM hash
proxys on|off|show      # Proxy switching

Key Files

  • src/features/targets/sync/markdownSync.ts — Parses and exports variables
  • src/features/targets/sync/index.ts — Sync entry point
  • src/features/targets/sync/graphBuilder.ts — Builds the target graph