MSFConsole
Benefits to Using MSFconsole
It is the only supported way to access most of the features within Metasploit.
Provides a console-based interface to the framework.
Full readline support, tabbing, and command completion.
Execution of external commands in msfconsole is possible:
msf > ping -c 1 192.168.1.100
[*] exec: ping -c 1 192.168.1.100
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=10.3 ms
--- 192.168.1.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 10.308/10.308/10.308/0.000 ms
msf >How to Use the Command Prompt
Launching MSFConsole
MSFconsole is located in the /usr/share/metasploit-framework/msfconsole directory.
The -q option removes the launch banner by starting msfconsole in quiet mode.
Help Information
Pass -h to msfconsole to see the other usage options available.
Entering help or a ? once in the msf command prompt will display a listing of available commands along with a description of what they are used for.
Tab Completion
As with most other shells, entering what you know and pressing ‘Tab’ will present you with a list of options available to you or auto-complete the string if there is only one option.
MSFConsole Commands
Back
Move back from the current context.
Variables will only carry over if they are set globally.
Banner
Display an awesome metasploit banner.
Check
To see if a target is vulnerable to a particular exploit instead of actually exploiting it.
Color
Enable or disable color output.
Connect
A miniature Netcat clone is built into the msfconsole to support SSL, proxies, pivoting, and file transfers.
Connect to a remote host, by issuing the connect command with an IP address and port number.
Edit
The edit command will edit the current module with $VISUAL or $EDITOR.
By default, this will open the current module in Vim.
Exit
Exit msfconsole.
Grep
Grep the output of another command.
The following is an example of using grep to match output containing the string “http” from a search for modules containing the string “oracle”.
Help
The help command will give you a list and small description of all available commands or options.
Info
The info command will provide detailed information about a particular module including all options, targets, and other information.
Be sure to always read the module description prior to using it as some may have un-desired effects.
IRB
Running the irb command will drop you into a live Ruby interpreter shell where you can issue commands and create Metasploit scripts on the fly. (IRB Scripting Mode)
Jobs
Display and terminate jobs.
Kill
The kill command will kill any running jobs when supplied with the job id.
Load
The load command loads a plugin from Metasploit’s plugin directory.
Arguments are passed as key=val on the shell.
Loadpath
The loadpath command will load a third-part module tree for the path so you can point Metasploit at your 0-day exploits, encoders, payloads, etc.
Unload
The unload command unloads a previously loaded plugin and removes any extended commands.
Resource
Run the commands stored in a file.
Use -r to pass a batch file to msfconsole at startup.
Route
Route traffic destined to a given subnet through a supplied session.
To add a route, you pass the target subnet and network mask followed by the session (comm) number.
Search
Searche module names, descriptions, references and etc, based on extensive regular-expression.
Session
The sessions command allows you to list, interact with, and kill spawned sessions.
The sessions can be shells, Meterpreter sessions, VNC, etc.
To list any active sessions, pass the -l options to sessions.
To interact with a given session, use the -i switch followed by the id number of the session.
Set
The set command allows you to configure Framework options and parameters for the current module you are working with.
Unset removes a parameter previously configured with set.
You can remove all assigned variables with unset all.
Setg
Set global variables with the setg command.
The pitfall is forgetting you have saved globals, so always check your options before you run or exploit.
Use the unsetg command to unset a global variable.
Save
Run the save command to save your current environment and settings, which will be automatically loaded on the next startup.
Show
Displays modules of a given type, or all modules.
When you are in the context of a particular exploit, you can:
run show payloads to display the payloads that are compatible with that particular exploit.
issue the show options command to display which settings are available and/or required for that specific module.
run the show targets command to see which targets are supported.
run show advanced to see more advanced options.
Use
Selects a module by name.
The use command changes your context to a specific module, exposing type-specific commands.
References
Last updated