Hands-On Web Penetration Testing with Metasploit
上QQ阅读APP看书,第一时间看更新

Interacting with Metasploit Framework using msfconsole

You can interact with MSF console either in normal mode, using the msfconsole command, or you can run the MSF console command in Quiet mode. The only difference between these modes is the absence of errors, warnings, and banners in the console. Running in normal mode will make a cool MSF banner appear. In Quiet mode, you can interact with the MSF console, which can be done by executing the msfconsole -q command:

There are other MSF console options available that can be used, according to your situation and needs. For example, if you want to run an MSF console without any database support, you can always execute the msfconsole -qn command.

You can't execute any commands or load any plugins with the db_ prefix in them if the database hasn't been initialized:

When you try to load a plugin from the console, you'll get the following uninitialized error:

Here, we used the -x option in msfconsole. As you may have guessed, this switch is used to execute MSF-supported commands inside the console. We can also execute shell commands in the console since Metasploit passes these commands to our default shell to use as arguments:

In the preceding command, we echoed the WELCOME TO METASPLOIT FRAMEWORK string from the MSF console and exited. To check all the options that are available, you can execute the msfconsole -h command. Let's now go through the most basic and most common commands that are used in the MSF console.