[Part 2]$~Metasploit for Beginners
Metasploit for beginners
So, hello friends. This is my 2nd post on Metasploit for beginners if you haven't checked the previous post then it is here.
So, today we will discuss "Metasploit commands" in depth.
The MSFconsole has many different command options to chose from. The following are a core set of Metasploit commands with reference to their output. Take a look:
back Move back from the current contextbanner Display an awesome metasploit bannercd Change the current working directorycolor Toggle colorconnect Communicate with a hostedit Edit the current module with $VISUAL or $EDITORexit Exit the consoleget Gets the value of a context-specific variablegetg Gets the value of a global variablego_pro Launch Metasploit web GUIgrep Grep the output of another commandhelp Help menuinfo Displays information about one or more moduleirb Drop into irb scripting modejobs Displays and manages jobskill Kill a jobload Load a framework pluginloadpath Searches for and loads modules from a pathmakerc Save commands entered since start to a filepopm Pops the latest module off the stack and makes it activeprevious Sets the previously loaded module as the current modulepushm Pushes the active or list of modules onto the module stackquit Exit the consolereload_all Reloads all modules from all defined module pathsrename_job Rename a jobresource Run the commands stored in a fileroute Route traffic through a sessionsave Saves the active datastoressearch Searches module names and descriptionssessions Dump session listings and display information about sessionsset Sets a context-specific variable to a valuesetg Sets a global variable to a valueshow Displays modules of a given type, or all modulessleep Do nothing for the specified number of secondsspool Write console output into a file as well the screenthreads View and manipulate background threadsunload Unload a framework pluginunset Unsets one or more context-specific variablesunsetg Unsets one or more global variablesuse Selects a module by nameversion Show the framework and console library version numbers
Simply displays a randomly selected banner so, for this, in our MSFconsole just type "banner".
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 undesired effects. The info command also provides the following information: The author and licensing information, vulnerability references (ie: CVE, BID, etc) ...
msf > use exploit/windows/smb/ms08_067_netapi
msf exploit(ms08_067_netapi) > info
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. This feature is also very useful for understanding the internals of the Framework.
Jobs are modules that are running in the background. The jobs command provides the ability to list and terminate these jobs.
The msfconsole includes an extensive regular expression based search functionality. If you have a general idea of what you are looking for you can search for it via ‘search ‘ command. In the output below, a search is being made for "NETGEAR ProSafe Network Management System 300 Arbitrary File Upload". The search function will locate this string within the module names, descriptions, references, etc.
When you have decided on a particular module to make use of, issue the ‘use’ command to select it. The ‘use’ command changes your context to a specific module, exposing type-specific commands. Notice in the output below that any global variables that were previously set are already configured.
Suppose you want to use the "ms08_067_netapi" exploit then we will use 'use' command
msf > use exploit/windows/smb/ms08_067_netapi
The ‘set’ command allows you to configure Framework options and parameters for the current module you are working with.
Suppose you want to set the RHOSt etc. then we can use
msf exploit(ms08_067_netapi) > set RHOSt 192.168.0.1RHOSt => 192.168.0.1
Executing ‘show auxiliary’ will display a listing of all of the available auxiliary modules within Metasploit. As mentioned earlier, auxiliary modules include scanners, denial of service modules, fuzzers, and more.
Naturally, ‘show exploits’ will be the command you are most interested in running since at its core, Metasploit is all about exploitation. Run ‘show exploits’ to get a listing of all exploits contained in the framework.
As you can see, there are a lot of payloads available. Fortunately, when you are in the context of a particular exploit, running ‘show payloads’ will only display the payloads that are compatible with that particular exploit. For instance, if it is a Windows exploit, you will not be shown the Linux payloads.
If you want to check some of my Metasploit tutorials then you can check them out on my channel.