[OPENING MUSIC]
Installing and configuring the Metasploit framework.
So we're finally ready to get started with the Metasploit
framework, and the first step in that process
is getting the Metasploit framework installed
and configured correctly.
So first of all, let's take a look
at how we can go about installing the Metasploit
framework and what solutions we can utilize
and what Linux distribution we we'll be
using throughout this course.
Now, it's important to note that the Metasploit framework is
distributed by Rapid7 and can be downloaded and installed
as a standalone package on both Windows and Linux.
Now, given the fact that we are going
to be using the Metasploit framework for penetration
testing, we are going to be utilizing or running
the Metasploit framework on Linux.
And our preferred distribution of choice is Kali Linux.
Kali Linux is an offensive security penetration testing
distribution that comes with Kali Linux preinstalled.
And as a result, we don't have to go about installing it.
The only thing we need to know how to do
is essentially updating the Metasploit framework.
And secondly, we need to know how
to interact with the Metasploit framework database.
So we are going to be utilizing Kali Linux as the de
facto penetration testing distribution
throughout this course.
So you can go ahead and setup Kali Linux
if you want to follow along.
You can also utilize Parrot OS or Parrot Security OS
as it also comes with clearly with the Metasploit framework
preinstalled.
Now as I said, the Metasploit framework,
insofar as it does come as a standalone package,
has various dependencies that are required in order
for it to run correctly and that is one of the reasons why
we are using a distribution like Kali Linux
because it comes pre-packaged with Kali.
And as a result, we don't have to install
all the dependencies.
And again, this will save us time
in regards to installing all of these dependencies manually.
Now, I mentioned briefly the Metasploit framework database,
or MSFDB as it's called.
So you may be asking yourself, well, what exactly is this?
You haven't mentioned this before.
Well, the Metasploit framework database, or MSFDB
is really very simple to understand.
It's essentially the main database
that is used by the Metasploit framework
to store all the relevant data pertinent to your assessments,
host data scans, et cetera, all of your data
that you will be working with or interacting
within the Metasploit framework console
will be stored within the Metasploit framework database.
Now, the Metasploit framework utilizes the PostgreSQL
database as the primary database server.
And as a result, we will also need
to ensure that the PostgreSQL Database
Service is running and configured correctly
in order to utilize the Metasploit framework database.
Now, the Metasploit framework database
also facilitates the importation and storage of scan results
from various third-party tools like Nmap and Nessus,
which we will be using.
So it's very important to have the Metasploit framework
database set up, and I will be frequently referring to it
as MSFDB so be aware of that.
All right, so the installation steps
are fairly simple when it comes down
to getting the Metasploit framework installed
and configured on Kali Linux.
We first need to update our repositories
and upgrade our Metasploit framework to the latest version
because, as I mentioned, we should already
have it pre-packaged with Kali.
The next step will involve starting and enabling
the PostgreSQL database service so that it starts up
on whenever you boot up your Kali Linux virtual machine,
and it's always running so that we
don't have any issues whenever you restart your system.
The next step would be to initialize the Metasploit
framework database, and essentially,
get it set up with the relevant database tables
and essentially get it ready for use.
Once that is done, we can check the status of the Metasploit
framework database.
If everything is good, we can launch MSF console,
and we should be ready to go.
So let's take a look at how to do all of this
and I'll see you back on my Kali VM.
All right, so I'm back on my Kali VM.
And I'm just going to head over into the full screen mode
here and let's get started.
So as I said, the first thing you want to do
is you want to make sure you have your repositories updated
and you have the Metasploit framework
upgraded to the latest version.
This can be done through the use of the aptitude package
manager on Kali Linux as it is a Debian-based distribution.
So we can say sudo apt-get update
and so we can say sudo apt-get update and sudo apt-get
install Metasploit framework.
The Kali repositories already have the Metasploit framework
as a package, so we can install it directly
with the aptitude package manager.
So I'm just going to hit Enter, and I'm
going to provide my password for my Kali user account.
And that is going to begin updating my repositories,
and it is then going to upgrade my Metasploit framework
installation to the latest version.
So I'm just going to let this complete.
All right, so the installation process is complete.
As you can see, it updated my repositories
and it's already telling me that my version of Metasploit
framework is already at the newest version, which is great.
We can now move on to the next step,
which again involves enabling and starting
the PostgreSQL service.
Now, given that this is a Debian distribution, the tool
or utility that we will be using to interact with the services,
and essentially setting them up, is the system control
or systemctl.
So we can say sudo systemctl.
We want to enable the PostgreSQL service
to start on system startup.
So we'll say sudo systemctl enable.
Postgresql.
We hit Enter.
As you can see, it's going to set up the actual script
to start on system startup.
Once that is done, we can then say start.
So systemctl start.
That is going to start the PostgreSQL database server.
Once that is done, we can check the status
to ensure that it is started, and that can be done by simply
replacing start with status.
We hit Enter.
As you can see, the PostgreSQL service is active
and it's loaded which means we can interact with it.
The next step will involve the use of the Metasploit framework
database.
And we can interact with it by typing in sudo msfdb.
So that is the command.
If we hit Enter, you can see it is
going to tell you that this utility allows
you to manage the Metasploit framework database.
And this is, essentially, the documentation here,
which is fairly simple.
What we want to do is initialize the database.
In my case, I already have it initialized.
But if this is your first time, then again, you should do that.
So I'm going to say sudo msfdb initialize.
I hit Enter.
As you can see, it's going to say database already started.
And the database appears to be already configured,
and it's going to skip initialization.
Now, if you ever encounter any issues with your Metasploit
framework database, you can always
re-initialize the database.
However, you do need to keep in mind that this will, again,
delete and re-initialize the database so you may lose,
or rather, you will lose all your data.
In my case, I don't have any data.
So I'm just going to re-initialize it.
So we're going to say sudo msfdb re-initialize.
I hit Enter.
As you can see, it's going to begin initializing
the database for me again.
And we should not get any errors.
If you do, you can always troubleshoot it.
In our case if you follow the steps,
you shouldn't experience or have any errors.
As you can see, it again gives us a warning
that the database has already started.
It then creates the database for us, and the database uses MSF--
the database itself is MSF.
And then it, essentially, creates various tests
to make sure that it actually has the necessary permissions
in order to do so, and it creates the initial database
schema.
All right, so that is the Metasploit framework database
initialized.
We can now check the status of the database
to make sure that it's active.
We hit Enter.
As you can see, it tells us right over here
that the PostgreSQL service is active and loaded.
Furthermore, we can see that the PostgreSQL database is
listening on its appropriate port right
over here, so five, four, three, two,
and again, you can see, right over here,
detected configuration file.
And it provides you the path to the configuration file,
which is the database.yml file.
So everything looks good.
We can now initialize the Metasploit framework console
by typing in MSF console.
We hit Enter, and we shouldn't get any errors.
And that should bring up the Metasploit framework console,
and we are ready to get started with the course.
So give that a few seconds.
It will take a few seconds to a couple
of minutes on your first run.
As you can see, starting the Metasploit framework database.
And voila, so welcome to the Metasploit framework console.
The Metasploit framework console will usually
give you a very nice looking Ascii banner here,
and will give you a summary of the total number
of exploit modules, auxiliary modules,
and post exploitation modules available,
as well as payloads, encoders, nops, et cetera.
All right, we can also confirm that the database is connected
to the Metasploit framework console
by using the DB command.
So db underscore, and we can say db_status to check
the status of the database.
As you can see, connected to MSF, connection type
PostgreSQL.
So everything is ready to go, and we
are ready to begin exploring how to utilize the Metasploit
framework for penetration testing.
All right.
So we have everything ready to go.
And I'll see you in the next video, where
we will be getting started with the fundamentals
of the Metasploit framework console.