Use / Use Module
Use Module
Selects a specific module for use in the Metasploit Framework.
use <auxiliary/scanner/portscan/syn> use <auxiliary/scanner/portscan/syn> #!/bin/bash
# Use Module
use {{auxiliary/scanner/portscan/syn}} import subprocess
# Use Module
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"use",
"<auxiliary/scanner/portscan/syn>"
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: use not found. Please install it first.")
if __name__ == "__main__":
run_command() When To Use
When a specific exploit or auxiliary module is required for testing.
Pro Tip
Use 'info' after 'use' to understand prerequisites and options offered by the module.
Anatomy of Output
Understanding the result
[*] Using auxiliary/scanner/portscan/syn Module Selected Confirms the selected module is now active.
[+] Module options have been set. Options Status Indicates successful configuration of module-specific options.
[*] Ready for execution. Ready State The session is primed for running the selected module.
Power User Variants
Optimized versions
use exploit/multi/http/apache_mod_cgi_bash_env_exec Selects an exploit for Apache web servers.
use payload/windows/meterpreter/reverse_tcp Selects a reverse shell payload for Windows.
Troubleshooting
Common pitfalls
[-] Module does not exist: 'invalid/module'.
Solution: Check for typos in the module path or ensure it is part of the current installation.
[-] No options defined for selected module.
Solution: Review the module's options and configure as needed.
[ERROR] Module type not accessible; check permissions.
Solution: Ensure your user has permission to access the necessary modules.
Command Breakdown
What each part is doing
-
use - Base Command
- The executable that performs this operation. Here it runs Use before the shell applies any redirect operators.
-
<auxiliary/scanner/portscan/syn> - auxiliary scanner portscan syn
- The port value supplied to this command.
Alternative Approaches
Comparable commands in other tools
Alternative security tools for the same job.
nettacker --ping-before-scan -m <port_scan,subdomain_scan,waf_scan,...> -g <80,443> -i <owasp.org> Gpg / Display Help In Gpg Tui <?> Freshclam / Update Virus Definitions Clamav freshclam Secret Tool / Retrieve Password secret-tool lookup key <key> John / Show Passwords Cracked john --show <path/to/hashes.txt>