WEBVTT

00:00:00.000 --> 00:00:03.388 align:middle line:90%


00:00:03.388 --> 00:00:06.776 align:middle line:90%
[OPENING MUSIC]

00:00:06.776 --> 00:00:10.170 align:middle line:90%


00:00:10.170 --> 00:00:14.760 align:middle line:84%
Installing and configuring
the Metasploit framework.

00:00:14.760 --> 00:00:19.140 align:middle line:84%
So we're finally ready to get
started with the Metasploit

00:00:19.140 --> 00:00:22.020 align:middle line:84%
framework, and the first
step in that process

00:00:22.020 --> 00:00:24.810 align:middle line:84%
is getting the Metasploit
framework installed

00:00:24.810 --> 00:00:26.800 align:middle line:90%
and configured correctly.

00:00:26.800 --> 00:00:29.880 align:middle line:84%
So first of all,
let's take a look

00:00:29.880 --> 00:00:32.610 align:middle line:84%
at how we can go about
installing the Metasploit

00:00:32.610 --> 00:00:35.310 align:middle line:84%
framework and what
solutions we can utilize

00:00:35.310 --> 00:00:38.310 align:middle line:84%
and what Linux
distribution we we'll be

00:00:38.310 --> 00:00:40.240 align:middle line:90%
using throughout this course.

00:00:40.240 --> 00:00:43.410 align:middle line:84%
Now, it's important to note
that the Metasploit framework is

00:00:43.410 --> 00:00:47.160 align:middle line:84%
distributed by Rapid7 and can
be downloaded and installed

00:00:47.160 --> 00:00:50.868 align:middle line:84%
as a standalone package
on both Windows and Linux.

00:00:50.868 --> 00:00:52.410 align:middle line:84%
Now, given the fact
that we are going

00:00:52.410 --> 00:00:55.290 align:middle line:84%
to be using the Metasploit
framework for penetration

00:00:55.290 --> 00:00:58.500 align:middle line:84%
testing, we are going to
be utilizing or running

00:00:58.500 --> 00:01:00.540 align:middle line:84%
the Metasploit
framework on Linux.

00:01:00.540 --> 00:01:04.290 align:middle line:84%
And our preferred distribution
of choice is Kali Linux.

00:01:04.290 --> 00:01:08.010 align:middle line:84%
Kali Linux is an offensive
security penetration testing

00:01:08.010 --> 00:01:12.090 align:middle line:84%
distribution that comes with
Kali Linux preinstalled.

00:01:12.090 --> 00:01:15.000 align:middle line:84%
And as a result, we don't have
to go about installing it.

00:01:15.000 --> 00:01:16.830 align:middle line:84%
The only thing we
need to know how to do

00:01:16.830 --> 00:01:20.100 align:middle line:84%
is essentially updating
the Metasploit framework.

00:01:20.100 --> 00:01:22.230 align:middle line:84%
And secondly, we
need to know how

00:01:22.230 --> 00:01:26.010 align:middle line:84%
to interact with the
Metasploit framework database.

00:01:26.010 --> 00:01:29.880 align:middle line:84%
So we are going to be
utilizing Kali Linux as the de

00:01:29.880 --> 00:01:32.490 align:middle line:84%
facto penetration
testing distribution

00:01:32.490 --> 00:01:33.610 align:middle line:90%
throughout this course.

00:01:33.610 --> 00:01:35.940 align:middle line:84%
So you can go ahead
and setup Kali Linux

00:01:35.940 --> 00:01:37.390 align:middle line:90%
if you want to follow along.

00:01:37.390 --> 00:01:40.980 align:middle line:84%
You can also utilize Parrot
OS or Parrot Security OS

00:01:40.980 --> 00:01:45.000 align:middle line:84%
as it also comes with clearly
with the Metasploit framework

00:01:45.000 --> 00:01:46.290 align:middle line:90%
preinstalled.

00:01:46.290 --> 00:01:49.080 align:middle line:84%
Now as I said, the
Metasploit framework,

00:01:49.080 --> 00:01:52.530 align:middle line:84%
insofar as it does come
as a standalone package,

00:01:52.530 --> 00:01:55.590 align:middle line:84%
has various dependencies
that are required in order

00:01:55.590 --> 00:01:59.280 align:middle line:84%
for it to run correctly and
that is one of the reasons why

00:01:59.280 --> 00:02:01.830 align:middle line:84%
we are using a distribution
like Kali Linux

00:02:01.830 --> 00:02:04.410 align:middle line:84%
because it comes
pre-packaged with Kali.

00:02:04.410 --> 00:02:06.600 align:middle line:84%
And as a result, we
don't have to install

00:02:06.600 --> 00:02:08.100 align:middle line:90%
all the dependencies.

00:02:08.100 --> 00:02:10.470 align:middle line:84%
And again, this
will save us time

00:02:10.470 --> 00:02:14.790 align:middle line:84%
in regards to installing all
of these dependencies manually.

00:02:14.790 --> 00:02:18.600 align:middle line:84%
Now, I mentioned briefly the
Metasploit framework database,

00:02:18.600 --> 00:02:21.310 align:middle line:90%
or MSFDB as it's called.

00:02:21.310 --> 00:02:24.030 align:middle line:84%
So you may be asking yourself,
well, what exactly is this?

00:02:24.030 --> 00:02:25.447 align:middle line:84%
You haven't mentioned
this before.

00:02:25.447 --> 00:02:28.530 align:middle line:84%
Well, the Metasploit
framework database, or MSFDB

00:02:28.530 --> 00:02:30.150 align:middle line:84%
is really very
simple to understand.

00:02:30.150 --> 00:02:32.790 align:middle line:84%
It's essentially
the main database

00:02:32.790 --> 00:02:35.160 align:middle line:84%
that is used by the
Metasploit framework

00:02:35.160 --> 00:02:39.660 align:middle line:84%
to store all the relevant data
pertinent to your assessments,

00:02:39.660 --> 00:02:43.800 align:middle line:84%
host data scans, et
cetera, all of your data

00:02:43.800 --> 00:02:46.860 align:middle line:84%
that you will be working
with or interacting

00:02:46.860 --> 00:02:49.410 align:middle line:84%
within the Metasploit
framework console

00:02:49.410 --> 00:02:52.830 align:middle line:84%
will be stored within the
Metasploit framework database.

00:02:52.830 --> 00:02:56.640 align:middle line:84%
Now, the Metasploit framework
utilizes the PostgreSQL

00:02:56.640 --> 00:02:59.610 align:middle line:84%
database as the primary
database server.

00:02:59.610 --> 00:03:01.410 align:middle line:84%
And as a result,
we will also need

00:03:01.410 --> 00:03:03.480 align:middle line:84%
to ensure that the
PostgreSQL Database

00:03:03.480 --> 00:03:06.480 align:middle line:84%
Service is running and
configured correctly

00:03:06.480 --> 00:03:09.930 align:middle line:84%
in order to utilize the
Metasploit framework database.

00:03:09.930 --> 00:03:11.730 align:middle line:84%
Now, the Metasploit
framework database

00:03:11.730 --> 00:03:15.300 align:middle line:84%
also facilitates the importation
and storage of scan results

00:03:15.300 --> 00:03:18.210 align:middle line:84%
from various third-party
tools like Nmap and Nessus,

00:03:18.210 --> 00:03:19.510 align:middle line:90%
which we will be using.

00:03:19.510 --> 00:03:22.200 align:middle line:84%
So it's very important to
have the Metasploit framework

00:03:22.200 --> 00:03:26.370 align:middle line:84%
database set up, and I will
be frequently referring to it

00:03:26.370 --> 00:03:29.950 align:middle line:90%
as MSFDB so be aware of that.

00:03:29.950 --> 00:03:32.010 align:middle line:84%
All right, so the
installation steps

00:03:32.010 --> 00:03:33.630 align:middle line:84%
are fairly simple
when it comes down

00:03:33.630 --> 00:03:35.850 align:middle line:84%
to getting the Metasploit
framework installed

00:03:35.850 --> 00:03:37.860 align:middle line:90%
and configured on Kali Linux.

00:03:37.860 --> 00:03:40.140 align:middle line:84%
We first need to
update our repositories

00:03:40.140 --> 00:03:42.810 align:middle line:84%
and upgrade our Metasploit
framework to the latest version

00:03:42.810 --> 00:03:45.090 align:middle line:84%
because, as I mentioned,
we should already

00:03:45.090 --> 00:03:46.800 align:middle line:90%
have it pre-packaged with Kali.

00:03:46.800 --> 00:03:50.550 align:middle line:84%
The next step will involve
starting and enabling

00:03:50.550 --> 00:03:53.700 align:middle line:84%
the PostgreSQL database
service so that it starts up

00:03:53.700 --> 00:03:56.760 align:middle line:84%
on whenever you boot up your
Kali Linux virtual machine,

00:03:56.760 --> 00:03:58.770 align:middle line:84%
and it's always
running so that we

00:03:58.770 --> 00:04:02.410 align:middle line:84%
don't have any issues whenever
you restart your system.

00:04:02.410 --> 00:04:04.890 align:middle line:84%
The next step would be to
initialize the Metasploit

00:04:04.890 --> 00:04:07.290 align:middle line:84%
framework database,
and essentially,

00:04:07.290 --> 00:04:11.100 align:middle line:84%
get it set up with the
relevant database tables

00:04:11.100 --> 00:04:13.740 align:middle line:84%
and essentially get
it ready for use.

00:04:13.740 --> 00:04:17.010 align:middle line:84%
Once that is done, we can check
the status of the Metasploit

00:04:17.010 --> 00:04:18.120 align:middle line:90%
framework database.

00:04:18.120 --> 00:04:21.269 align:middle line:84%
If everything is good, we
can launch MSF console,

00:04:21.269 --> 00:04:23.290 align:middle line:90%
and we should be ready to go.

00:04:23.290 --> 00:04:25.680 align:middle line:84%
So let's take a look at
how to do all of this

00:04:25.680 --> 00:04:28.860 align:middle line:84%
and I'll see you
back on my Kali VM.

00:04:28.860 --> 00:04:31.530 align:middle line:84%
All right, so I'm
back on my Kali VM.

00:04:31.530 --> 00:04:34.380 align:middle line:84%
And I'm just going to head
over into the full screen mode

00:04:34.380 --> 00:04:36.220 align:middle line:90%
here and let's get started.

00:04:36.220 --> 00:04:38.430 align:middle line:84%
So as I said, the first
thing you want to do

00:04:38.430 --> 00:04:42.450 align:middle line:84%
is you want to make sure you
have your repositories updated

00:04:42.450 --> 00:04:44.850 align:middle line:84%
and you have the
Metasploit framework

00:04:44.850 --> 00:04:46.830 align:middle line:90%
upgraded to the latest version.

00:04:46.830 --> 00:04:49.890 align:middle line:84%
This can be done through the
use of the aptitude package

00:04:49.890 --> 00:04:54.010 align:middle line:84%
manager on Kali Linux as it is
a Debian-based distribution.

00:04:54.010 --> 00:05:01.540 align:middle line:84%
So we can say sudo
apt-get update

00:05:01.540 --> 00:05:12.380 align:middle line:84%
and so we can say sudo apt-get
update and sudo apt-get

00:05:12.380 --> 00:05:14.660 align:middle line:90%
install Metasploit framework.

00:05:14.660 --> 00:05:17.600 align:middle line:84%
The Kali repositories already
have the Metasploit framework

00:05:17.600 --> 00:05:20.180 align:middle line:84%
as a package, so we
can install it directly

00:05:20.180 --> 00:05:22.100 align:middle line:84%
with the aptitude
package manager.

00:05:22.100 --> 00:05:24.500 align:middle line:84%
So I'm just going to
hit Enter, and I'm

00:05:24.500 --> 00:05:27.780 align:middle line:84%
going to provide my password
for my Kali user account.

00:05:27.780 --> 00:05:31.070 align:middle line:84%
And that is going to begin
updating my repositories,

00:05:31.070 --> 00:05:34.220 align:middle line:84%
and it is then going to
upgrade my Metasploit framework

00:05:34.220 --> 00:05:36.930 align:middle line:84%
installation to
the latest version.

00:05:36.930 --> 00:05:40.600 align:middle line:84%
So I'm just going to
let this complete.

00:05:40.600 --> 00:05:44.650 align:middle line:84%
All right, so the installation
process is complete.

00:05:44.650 --> 00:05:47.260 align:middle line:84%
As you can see, it
updated my repositories

00:05:47.260 --> 00:05:50.890 align:middle line:84%
and it's already telling me
that my version of Metasploit

00:05:50.890 --> 00:05:54.350 align:middle line:84%
framework is already at the
newest version, which is great.

00:05:54.350 --> 00:05:56.180 align:middle line:84%
We can now move on
to the next step,

00:05:56.180 --> 00:05:58.780 align:middle line:84%
which again involves
enabling and starting

00:05:58.780 --> 00:06:00.310 align:middle line:90%
the PostgreSQL service.

00:06:00.310 --> 00:06:04.210 align:middle line:84%
Now, given that this is a
Debian distribution, the tool

00:06:04.210 --> 00:06:07.990 align:middle line:84%
or utility that we will be using
to interact with the services,

00:06:07.990 --> 00:06:12.160 align:middle line:84%
and essentially setting them
up, is the system control

00:06:12.160 --> 00:06:13.210 align:middle line:90%
or systemctl.

00:06:13.210 --> 00:06:17.170 align:middle line:90%
So we can say sudo systemctl.

00:06:17.170 --> 00:06:19.840 align:middle line:84%
We want to enable the
PostgreSQL service

00:06:19.840 --> 00:06:21.910 align:middle line:90%
to start on system startup.

00:06:21.910 --> 00:06:24.550 align:middle line:84%
So we'll say sudo
systemctl enable.

00:06:24.550 --> 00:06:29.580 align:middle line:90%


00:06:29.580 --> 00:06:31.320 align:middle line:90%
Postgresql.

00:06:31.320 --> 00:06:32.520 align:middle line:90%
We hit Enter.

00:06:32.520 --> 00:06:36.990 align:middle line:84%
As you can see, it's going
to set up the actual script

00:06:36.990 --> 00:06:38.850 align:middle line:90%
to start on system startup.

00:06:38.850 --> 00:06:42.510 align:middle line:84%
Once that is done, we
can then say start.

00:06:42.510 --> 00:06:45.930 align:middle line:90%
So systemctl start.

00:06:45.930 --> 00:06:49.110 align:middle line:84%
That is going to start the
PostgreSQL database server.

00:06:49.110 --> 00:06:51.360 align:middle line:84%
Once that is done, we
can check the status

00:06:51.360 --> 00:06:55.440 align:middle line:84%
to ensure that it is started,
and that can be done by simply

00:06:55.440 --> 00:06:57.810 align:middle line:90%
replacing start with status.

00:06:57.810 --> 00:06:58.800 align:middle line:90%
We hit Enter.

00:06:58.800 --> 00:07:02.160 align:middle line:84%
As you can see, the
PostgreSQL service is active

00:07:02.160 --> 00:07:04.890 align:middle line:84%
and it's loaded which means
we can interact with it.

00:07:04.890 --> 00:07:09.420 align:middle line:84%
The next step will involve the
use of the Metasploit framework

00:07:09.420 --> 00:07:10.440 align:middle line:90%
database.

00:07:10.440 --> 00:07:14.880 align:middle line:84%
And we can interact with
it by typing in sudo msfdb.

00:07:14.880 --> 00:07:16.170 align:middle line:90%
So that is the command.

00:07:16.170 --> 00:07:18.030 align:middle line:84%
If we hit Enter,
you can see it is

00:07:18.030 --> 00:07:20.310 align:middle line:84%
going to tell you that
this utility allows

00:07:20.310 --> 00:07:22.890 align:middle line:84%
you to manage the Metasploit
framework database.

00:07:22.890 --> 00:07:27.460 align:middle line:84%
And this is, essentially,
the documentation here,

00:07:27.460 --> 00:07:28.750 align:middle line:90%
which is fairly simple.

00:07:28.750 --> 00:07:32.490 align:middle line:84%
What we want to do is
initialize the database.

00:07:32.490 --> 00:07:34.860 align:middle line:84%
In my case, I already
have it initialized.

00:07:34.860 --> 00:07:37.990 align:middle line:84%
But if this is your first time,
then again, you should do that.

00:07:37.990 --> 00:07:42.990 align:middle line:84%
So I'm going to say
sudo msfdb initialize.

00:07:42.990 --> 00:07:43.800 align:middle line:90%
I hit Enter.

00:07:43.800 --> 00:07:46.860 align:middle line:84%
As you can see, it's going to
say database already started.

00:07:46.860 --> 00:07:49.650 align:middle line:84%
And the database appears
to be already configured,

00:07:49.650 --> 00:07:51.720 align:middle line:84%
and it's going to
skip initialization.

00:07:51.720 --> 00:07:55.050 align:middle line:84%
Now, if you ever encounter any
issues with your Metasploit

00:07:55.050 --> 00:07:57.360 align:middle line:84%
framework database,
you can always

00:07:57.360 --> 00:07:59.050 align:middle line:90%
re-initialize the database.

00:07:59.050 --> 00:08:02.190 align:middle line:84%
However, you do need to keep
in mind that this will, again,

00:08:02.190 --> 00:08:05.550 align:middle line:84%
delete and re-initialize the
database so you may lose,

00:08:05.550 --> 00:08:08.020 align:middle line:84%
or rather, you will
lose all your data.

00:08:08.020 --> 00:08:09.820 align:middle line:84%
In my case, I don't
have any data.

00:08:09.820 --> 00:08:11.590 align:middle line:84%
So I'm just going
to re-initialize it.

00:08:11.590 --> 00:08:16.410 align:middle line:84%
So we're going to say
sudo msfdb re-initialize.

00:08:16.410 --> 00:08:17.310 align:middle line:90%
I hit Enter.

00:08:17.310 --> 00:08:20.250 align:middle line:84%
As you can see, it's going
to begin initializing

00:08:20.250 --> 00:08:22.410 align:middle line:90%
the database for me again.

00:08:22.410 --> 00:08:24.510 align:middle line:84%
And we should not
get any errors.

00:08:24.510 --> 00:08:27.360 align:middle line:84%
If you do, you can
always troubleshoot it.

00:08:27.360 --> 00:08:29.370 align:middle line:84%
In our case if you
follow the steps,

00:08:29.370 --> 00:08:31.740 align:middle line:84%
you shouldn't experience
or have any errors.

00:08:31.740 --> 00:08:34.799 align:middle line:84%
As you can see, it
again gives us a warning

00:08:34.799 --> 00:08:36.570 align:middle line:84%
that the database
has already started.

00:08:36.570 --> 00:08:41.909 align:middle line:84%
It then creates the database for
us, and the database uses MSF--

00:08:41.909 --> 00:08:44.220 align:middle line:90%
the database itself is MSF.

00:08:44.220 --> 00:08:46.680 align:middle line:84%
And then it, essentially,
creates various tests

00:08:46.680 --> 00:08:51.000 align:middle line:84%
to make sure that it actually
has the necessary permissions

00:08:51.000 --> 00:08:54.150 align:middle line:84%
in order to do so, and it
creates the initial database

00:08:54.150 --> 00:08:54.930 align:middle line:90%
schema.

00:08:54.930 --> 00:08:58.170 align:middle line:84%
All right, so that is the
Metasploit framework database

00:08:58.170 --> 00:08:59.130 align:middle line:90%
initialized.

00:08:59.130 --> 00:09:01.530 align:middle line:84%
We can now check the
status of the database

00:09:01.530 --> 00:09:05.020 align:middle line:90%
to make sure that it's active.

00:09:05.020 --> 00:09:05.800 align:middle line:90%
We hit Enter.

00:09:05.800 --> 00:09:08.710 align:middle line:84%
As you can see, it
tells us right over here

00:09:08.710 --> 00:09:11.800 align:middle line:84%
that the PostgreSQL service
is active and loaded.

00:09:11.800 --> 00:09:14.950 align:middle line:84%
Furthermore, we can see that
the PostgreSQL database is

00:09:14.950 --> 00:09:17.380 align:middle line:84%
listening on its
appropriate port right

00:09:17.380 --> 00:09:19.300 align:middle line:84%
over here, so five,
four, three, two,

00:09:19.300 --> 00:09:21.580 align:middle line:84%
and again, you can
see, right over here,

00:09:21.580 --> 00:09:23.320 align:middle line:90%
detected configuration file.

00:09:23.320 --> 00:09:26.330 align:middle line:84%
And it provides you the path
to the configuration file,

00:09:26.330 --> 00:09:28.760 align:middle line:90%
which is the database.yml file.

00:09:28.760 --> 00:09:30.470 align:middle line:90%
So everything looks good.

00:09:30.470 --> 00:09:33.850 align:middle line:84%
We can now initialize the
Metasploit framework console

00:09:33.850 --> 00:09:37.090 align:middle line:90%
by typing in MSF console.

00:09:37.090 --> 00:09:39.910 align:middle line:84%
We hit Enter, and we
shouldn't get any errors.

00:09:39.910 --> 00:09:42.430 align:middle line:84%
And that should bring up the
Metasploit framework console,

00:09:42.430 --> 00:09:46.400 align:middle line:84%
and we are ready to get
started with the course.

00:09:46.400 --> 00:09:47.860 align:middle line:90%
So give that a few seconds.

00:09:47.860 --> 00:09:50.230 align:middle line:84%
It will take a few
seconds to a couple

00:09:50.230 --> 00:09:51.970 align:middle line:90%
of minutes on your first run.

00:09:51.970 --> 00:09:54.760 align:middle line:84%
As you can see, starting the
Metasploit framework database.

00:09:54.760 --> 00:09:59.080 align:middle line:84%
And voila, so welcome to the
Metasploit framework console.

00:09:59.080 --> 00:10:01.180 align:middle line:84%
The Metasploit framework
console will usually

00:10:01.180 --> 00:10:04.510 align:middle line:84%
give you a very nice
looking Ascii banner here,

00:10:04.510 --> 00:10:06.910 align:middle line:84%
and will give you a
summary of the total number

00:10:06.910 --> 00:10:09.220 align:middle line:84%
of exploit modules,
auxiliary modules,

00:10:09.220 --> 00:10:12.070 align:middle line:84%
and post exploitation
modules available,

00:10:12.070 --> 00:10:15.730 align:middle line:84%
as well as payloads,
encoders, nops, et cetera.

00:10:15.730 --> 00:10:19.000 align:middle line:84%
All right, we can also confirm
that the database is connected

00:10:19.000 --> 00:10:20.770 align:middle line:84%
to the Metasploit
framework console

00:10:20.770 --> 00:10:23.110 align:middle line:90%
by using the DB command.

00:10:23.110 --> 00:10:27.490 align:middle line:84%
So db underscore, and we
can say db_status to check

00:10:27.490 --> 00:10:28.900 align:middle line:90%
the status of the database.

00:10:28.900 --> 00:10:32.050 align:middle line:84%
As you can see, connected
to MSF, connection type

00:10:32.050 --> 00:10:33.070 align:middle line:90%
PostgreSQL.

00:10:33.070 --> 00:10:36.100 align:middle line:84%
So everything is
ready to go, and we

00:10:36.100 --> 00:10:39.670 align:middle line:84%
are ready to begin exploring
how to utilize the Metasploit

00:10:39.670 --> 00:10:43.010 align:middle line:84%
framework for
penetration testing.

00:10:43.010 --> 00:10:43.510 align:middle line:90%
All right.

00:10:43.510 --> 00:10:45.360 align:middle line:84%
So we have everything
ready to go.

00:10:45.360 --> 00:10:47.825 align:middle line:84%
And I'll see you in
the next video, where

00:10:47.825 --> 00:10:50.940 align:middle line:84%
we will be getting started
with the fundamentals

00:10:50.940 --> 00:10:54.110 align:middle line:84%
of the Metasploit
framework console.

00:10:54.110 --> 00:10:55.000 align:middle line:90%