How variables work
Variables use the%%%VARIABLE_NAME%%% syntax in tool argument definitions. When a tool is launched, QtRecon automatically replaces these placeholders with actual values from the current context.
Example
192.168.1.100:80, this becomes:
Built-in variables
QtRecon provides several built-in variables that are automatically populated based on the scan context.Network variables
The target IP address being scannedExample:
192.168.1.100The specific port number for the current contextExample:
443The protocol (automatically determined based on port)Values:
http or httpsExample: https for port 443The hostname of the target (if resolved)Example:
webserver.example.comAuthentication variables
Username for authenticated operationsExample:
administratorPassword for authenticated operationsExample:
P@ssw0rd123Password hash for pass-the-hash attacksExample:
aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586cPath to SSH private key fileExample:
/home/user/.ssh/id_rsaDomain name for Active Directory environmentsExample:
CORPAttacker variables
Local host IP address (attacker machine)Automatically determined from
preferred_interfaces in user_prefsExample: 10.10.14.5Local port for reverse connectionsDefaults to value in
user_prefs.preferred_lportExample: 8444Custom variables
Define your own variables in theuser_variables section of the configuration file:
Custom variable example: Keyboard layout
TheXFREERDP_KEYBOARD variable is particularly useful for RDP connections:
0x00000409- US English0x0000040C- French0x00000407- German0x00000809- UK English0x0000040A- Spanish
Variable usage examples
Web application testing
Combine multiple variables for comprehensive web scanning:Authenticated SMB enumeration
Use authentication variables for Windows enumeration:SSH with key authentication
RDP with credentials
Reverse shell snippets
Variables are also used in thesnippets section:
Configuring LHOST and LPORT
The%%%LHOST%%% and %%%LPORT%%% variables are configured through user_prefs:
List of network interfaces in priority order. QtRecon uses the first available interface to determine
%%%LHOST%%%.Default local port for reverse connections (
%%%LPORT%%%).Variable resolution behavior
Missing variables
Missing variables
If a variable cannot be resolved (e.g.,
%%%USERNAME%%% when no username is set), QtRecon typically:- Prompts you to enter the value before launching the tool
- Or leaves the variable as-is if the tool has
"edit_before_launch": true
Protocol auto-detection
Protocol auto-detection
%%%PROTO%%% is automatically determined:- Port 443, 8443:
https - Port 80, 8080, 8000:
http - Other ports: defaults to
http
Variable case sensitivity
Variable case sensitivity
Variable names are case-sensitive. Use uppercase:
%%%IP%%% not %%%ip%%%Custom variable priority
Custom variable priority
Custom variables in
user_variables can override built-in variables if they use the same name (not recommended).Best practices
Use descriptive custom variable names
Use descriptive custom variable names
Choose clear, uppercase names for custom variables:
Validate tool commands manually
Validate tool commands manually
Before relying on variables, test the resulting command manually to ensure proper substitution:
Document custom variables
Document custom variables
Add comments (if your JSON parser supports them) or maintain separate documentation for custom variables.
Quote variables in shell scripts
Quote variables in shell scripts
When using variables in custom shell scripts, quote them to handle special characters:
Complete example
Here’s a tool configuration demonstrating multiple variable types:Next steps
Tool setup
Learn how to configure tools that use variables
Autorun rules
Use variables in automated tool execution
