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:13.950 align:middle line:84%
Importing Nmap scan results
into the Metasploit framework.

00:00:13.950 --> 00:00:15.720 align:middle line:84%
This is going to
be a continuation

00:00:15.720 --> 00:00:17.340 align:middle line:84%
from the previous
video, where we

00:00:17.340 --> 00:00:20.100 align:middle line:84%
took a look at how to
perform port scanning

00:00:20.100 --> 00:00:21.960 align:middle line:90%
and enumeration with Nmap.

00:00:21.960 --> 00:00:24.780 align:middle line:84%
And we were able to
identify various open ports

00:00:24.780 --> 00:00:28.200 align:middle line:84%
on the target system, as well
as the target system operating

00:00:28.200 --> 00:00:28.890 align:middle line:90%
system.

00:00:28.890 --> 00:00:33.330 align:middle line:84%
And we were able to output the
scan results into an XML file

00:00:33.330 --> 00:00:36.760 align:middle line:84%
that we will now be importing
into the Metasploit framework.

00:00:36.760 --> 00:00:40.170 align:middle line:84%
So I'm just going to be resuming
within the same lab environment

00:00:40.170 --> 00:00:43.700 align:middle line:84%
that we were using and
I'll see you there.

00:00:43.700 --> 00:00:46.090 align:middle line:84%
So I am back within
the lab environment.

00:00:46.090 --> 00:00:47.970 align:middle line:84%
And the first thing
that we want to do

00:00:47.970 --> 00:00:50.910 align:middle line:84%
is, again, just make sure you
have the scan results that we

00:00:50.910 --> 00:00:54.090 align:middle line:84%
output in the previous
video, as we can see here.

00:00:54.090 --> 00:00:58.620 align:middle line:84%
What we want to do, firstly, is
start the PostgreSQL Database

00:00:58.620 --> 00:00:59.430 align:middle line:90%
Service.

00:00:59.430 --> 00:01:00.930 align:middle line:84%
And in order to do
this, we're going

00:01:00.930 --> 00:01:06.383 align:middle line:84%
to say service postgresql
right over here,

00:01:06.383 --> 00:01:07.800 align:middle line:84%
and then we're
going to say Start.

00:01:07.800 --> 00:01:09.780 align:middle line:90%
So service postgresql start.

00:01:09.780 --> 00:01:12.720 align:middle line:84%
And we hit Enter, and that
is going to be started.

00:01:12.720 --> 00:01:15.690 align:middle line:84%
We can now start up the
Metasploit framework console.

00:01:15.690 --> 00:01:17.520 align:middle line:84%
I'm going to do
that and hit Enter.

00:01:17.520 --> 00:01:19.890 align:middle line:84%
That's going to take a
few seconds to start up.

00:01:19.890 --> 00:01:23.010 align:middle line:84%
There we are, starting the
Metasploit framework console.

00:01:23.010 --> 00:01:24.030 align:middle line:90%
And there we are.

00:01:24.030 --> 00:01:27.370 align:middle line:84%
So we are currently on version
five, which is perfectly fine.

00:01:27.370 --> 00:01:30.210 align:middle line:84%
And again, we can check
the status of the database

00:01:30.210 --> 00:01:31.920 align:middle line:90%
by saying db_status.

00:01:31.920 --> 00:01:32.880 align:middle line:90%
Hit Enter.

00:01:32.880 --> 00:01:36.600 align:middle line:84%
We are connected to MSF, and the
connection type is postgreql.

00:01:36.600 --> 00:01:37.290 align:middle line:90%
Excellent.

00:01:37.290 --> 00:01:41.220 align:middle line:84%
So before we import the scan
results into the Metasploit

00:01:41.220 --> 00:01:44.730 align:middle line:84%
framework database, we need
to create a new workspace

00:01:44.730 --> 00:01:46.313 align:middle line:90%
for our scan results.

00:01:46.313 --> 00:01:48.480 align:middle line:84%
And again, that is something
that I recommend doing.

00:01:48.480 --> 00:01:50.460 align:middle line:84%
So if we say
workspace, you can see

00:01:50.460 --> 00:01:52.200 align:middle line:90%
we have the default workspace.

00:01:52.200 --> 00:01:55.120 align:middle line:84%
We want to import our scan
results into a new workspace.

00:01:55.120 --> 00:01:57.390 align:middle line:84%
So to create one, we're
going to say workspace A.

00:01:57.390 --> 00:02:00.720 align:middle line:84%
And we're just going
to say Win2k12,

00:02:00.720 --> 00:02:04.740 align:middle line:84%
so that's an abbreviation
for Windows Server 2012.

00:02:04.740 --> 00:02:06.060 align:middle line:90%
And we're going to hit Enter.

00:02:06.060 --> 00:02:07.480 align:middle line:84%
It's going to
create that for us.

00:02:07.480 --> 00:02:10.800 align:middle line:84%
So workspaces, and
we have Win2k12.

00:02:10.800 --> 00:02:14.990 align:middle line:84%
That's the current workspace
that we're working under.

00:02:14.990 --> 00:02:17.872 align:middle line:84%
We can now begin importing
these scan results.

00:02:17.872 --> 00:02:20.330 align:middle line:84%
And to do that, we're just
going to clear the terminal here

00:02:20.330 --> 00:02:22.520 align:middle line:84%
and we're going
to say db_import.

00:02:22.520 --> 00:02:26.120 align:middle line:84%
We now need to provide the
path to where the Nmap scan

00:02:26.120 --> 00:02:28.470 align:middle line:84%
results was saved,
and in our case,

00:02:28.470 --> 00:02:30.080 align:middle line:90%
it's going to be on the root.

00:02:30.080 --> 00:02:34.790 align:middle line:84%
And if we just specify or try
and use the tab auto completion

00:02:34.790 --> 00:02:37.070 align:middle line:84%
we can see that we have
the file within the home

00:02:37.070 --> 00:02:38.700 align:middle line:90%
directory of the root user.

00:02:38.700 --> 00:02:40.970 align:middle line:84%
So we can just say or
provide the name there.

00:02:40.970 --> 00:02:43.760 align:middle line:84%
So root Windows Server
2012, hit Enter,

00:02:43.760 --> 00:02:46.700 align:middle line:84%
that is going to import
the Nmap XML data.

00:02:46.700 --> 00:02:48.500 align:middle line:84%
There we are, it looks
like it successfully

00:02:48.500 --> 00:02:50.930 align:middle line:90%
imported the Nmap scan results.

00:02:50.930 --> 00:02:53.840 align:middle line:84%
We can now confirm
that this has been--

00:02:53.840 --> 00:02:56.180 align:middle line:84%
that the data has been
imported successfully

00:02:56.180 --> 00:02:57.740 align:middle line:90%
by typing in hosts.

00:02:57.740 --> 00:03:01.070 align:middle line:84%
As you can see, we have the
Windows Server 2012 hosts here.

00:03:01.070 --> 00:03:04.670 align:middle line:84%
And the IP address is displayed
as well as the operating system

00:03:04.670 --> 00:03:07.080 align:middle line:84%
name and its purpose,
which in this case,

00:03:07.080 --> 00:03:08.990 align:middle line:90%
we know is as a server.

00:03:08.990 --> 00:03:12.860 align:middle line:84%
So this is a good indication
that we've imported

00:03:12.860 --> 00:03:14.930 align:middle line:90%
all the data successfully.

00:03:14.930 --> 00:03:18.620 align:middle line:84%
We can also get confirmation
by, again, trying to enumerate

00:03:18.620 --> 00:03:22.250 align:middle line:84%
or trying to print out the
services for the various hosts

00:03:22.250 --> 00:03:23.330 align:middle line:90%
that we have imported.

00:03:23.330 --> 00:03:24.950 align:middle line:84%
In this case, we've
just imported one.

00:03:24.950 --> 00:03:27.170 align:middle line:84%
If we hit Services,
you can see that it's

00:03:27.170 --> 00:03:31.290 align:middle line:84%
going to display the services
for the Windows Server 2012

00:03:31.290 --> 00:03:31.790 align:middle line:90%
target.

00:03:31.790 --> 00:03:32.600 align:middle line:90%
And there we are.

00:03:32.600 --> 00:03:35.360 align:middle line:84%
You can see that it's
sorted based on the host,

00:03:35.360 --> 00:03:37.160 align:middle line:84%
and in this case,
the IP address.

00:03:37.160 --> 00:03:41.510 align:middle line:84%
You get the port, the protocol,
the name of the service as well

00:03:41.510 --> 00:03:44.310 align:middle line:84%
as the information or
rather the service version,

00:03:44.310 --> 00:03:47.150 align:middle line:84%
which in this case, we
know we have the HTTP file

00:03:47.150 --> 00:03:50.660 align:middle line:84%
server as well as the
standard Windows services

00:03:50.660 --> 00:03:51.800 align:middle line:90%
and ports open.

00:03:51.800 --> 00:03:54.080 align:middle line:84%
So that is a good
confirmation that we

00:03:54.080 --> 00:03:55.970 align:middle line:90%
have everything imported.

00:03:55.970 --> 00:03:57.920 align:middle line:84%
As we move along, we're
going to take a look

00:03:57.920 --> 00:04:00.110 align:middle line:84%
at how this
information can then be

00:04:00.110 --> 00:04:02.690 align:middle line:84%
used in conjunction
with auxiliary modules

00:04:02.690 --> 00:04:04.490 align:middle line:84%
to perform various
types of scans

00:04:04.490 --> 00:04:07.370 align:middle line:84%
as well as exploit
modules when we'll be,

00:04:07.370 --> 00:04:11.210 align:middle line:84%
again, exploring exploitation
of specific services.

00:04:11.210 --> 00:04:16.339 align:middle line:84%
What we can do now is we can
also, again, initiate an Nmap

00:04:16.339 --> 00:04:18.589 align:middle line:84%
scan from within the
Metasploit framework, which

00:04:18.589 --> 00:04:22.910 align:middle line:84%
is additional functionality
that you should be aware of.

00:04:22.910 --> 00:04:26.720 align:middle line:84%
MSF console allows us
to initiate and perform

00:04:26.720 --> 00:04:29.900 align:middle line:84%
an Nmap scan from within the
Metasploit framework console,

00:04:29.900 --> 00:04:33.750 align:middle line:84%
and consequently save the
results into the database.

00:04:33.750 --> 00:04:35.580 align:middle line:84%
And again, we can
do that as well.

00:04:35.580 --> 00:04:37.580 align:middle line:84%
So if you don't want to
go through the process

00:04:37.580 --> 00:04:40.220 align:middle line:84%
of performing an
Nmap scan externally

00:04:40.220 --> 00:04:42.140 align:middle line:84%
and then importing
them manually,

00:04:42.140 --> 00:04:44.370 align:middle line:84%
you can do it from within
the Metasploit framework.

00:04:44.370 --> 00:04:47.720 align:middle line:84%
So what we're going to do is
we list out the workspace here.

00:04:47.720 --> 00:04:50.990 align:middle line:84%
You can see that we are
currently within Win2k12.

00:04:50.990 --> 00:04:53.280 align:middle line:84%
What I'm going to do is I'm
going to create a new one.

00:04:53.280 --> 00:04:55.700 align:middle line:84%
So we're going to
say workspace A,

00:04:55.700 --> 00:04:57.530 align:middle line:84%
and then we're
just going to say--

00:04:57.530 --> 00:05:01.370 align:middle line:84%
we're just going to
call this Nmap_MSF.

00:05:01.370 --> 00:05:03.950 align:middle line:90%
So Nmap_MSF.

00:05:03.950 --> 00:05:04.572 align:middle line:90%
There we go.

00:05:04.572 --> 00:05:06.530 align:middle line:84%
Just going to Enter,
that's going to create it,

00:05:06.530 --> 00:05:08.773 align:middle line:84%
and we're currently
within that workspace.

00:05:08.773 --> 00:05:09.815 align:middle line:90%
Let me just confirm that.

00:05:09.815 --> 00:05:11.690 align:middle line:90%
That is the case, fantastic.

00:05:11.690 --> 00:05:14.810 align:middle line:84%
So in order to initiate an
Nmap scan, all we need to do

00:05:14.810 --> 00:05:19.160 align:middle line:84%
is type in db_nmap and then
provide the various scan

00:05:19.160 --> 00:05:21.140 align:middle line:90%
options that we want to provide.

00:05:21.140 --> 00:05:23.300 align:middle line:84%
And in this case, we
are going to use the Pn

00:05:23.300 --> 00:05:24.980 align:middle line:90%
option like we did previously.

00:05:24.980 --> 00:05:28.220 align:middle line:84%
We're then going to say we
want to perform some service

00:05:28.220 --> 00:05:32.180 align:middle line:84%
enumeration as well as some
operating system enumeration,

00:05:32.180 --> 00:05:34.790 align:middle line:84%
and I'm just going to
copy the target IP there.

00:05:34.790 --> 00:05:35.730 align:middle line:90%
There we go.

00:05:35.730 --> 00:05:37.640 align:middle line:84%
And in this case, we
don't need to output

00:05:37.640 --> 00:05:39.890 align:middle line:84%
or export the scan
results into a file

00:05:39.890 --> 00:05:42.050 align:middle line:84%
because the results
will automatically

00:05:42.050 --> 00:05:45.260 align:middle line:84%
be saved into the Metasploit
framework database

00:05:45.260 --> 00:05:46.787 align:middle line:90%
within our current workspace.

00:05:46.787 --> 00:05:47.870 align:middle line:90%
So I'm going to hit Enter.

00:05:47.870 --> 00:05:50.270 align:middle line:84%
That is going to, again,
execute or initiate

00:05:50.270 --> 00:05:53.270 align:middle line:84%
the Nmap scan from within the
Metasploit framework console.

00:05:53.270 --> 00:05:55.640 align:middle line:84%
So again, we're just going
to give this a few seconds

00:05:55.640 --> 00:05:57.770 align:middle line:90%
to complete.

00:05:57.770 --> 00:05:59.638 align:middle line:90%
All right, the scan is complete.

00:05:59.638 --> 00:06:01.930 align:middle line:84%
And as you can see, we get
pretty much the same results

00:06:01.930 --> 00:06:05.350 align:middle line:84%
that we did if we were
to run Nmap externally.

00:06:05.350 --> 00:06:08.110 align:middle line:84%
And in this case, the
results have automatically

00:06:08.110 --> 00:06:10.450 align:middle line:84%
been imported into the
Metasploit framework

00:06:10.450 --> 00:06:12.370 align:middle line:90%
database for this workspace.

00:06:12.370 --> 00:06:14.120 align:middle line:84%
That's very important
to understand.

00:06:14.120 --> 00:06:17.170 align:middle line:84%
So again, the two workspaces
are different from each other

00:06:17.170 --> 00:06:18.880 align:middle line:84%
and the data is,
again, considered

00:06:18.880 --> 00:06:20.680 align:middle line:84%
different irregardless
of whether we

00:06:20.680 --> 00:06:22.220 align:middle line:90%
scanned the same target.

00:06:22.220 --> 00:06:24.460 align:middle line:84%
So again, if we
list out the hosts,

00:06:24.460 --> 00:06:26.960 align:middle line:84%
you can see that we
get the same host.

00:06:26.960 --> 00:06:28.750 align:middle line:84%
And then if we list
out the services,

00:06:28.750 --> 00:06:29.950 align:middle line:90%
we get the same thing.

00:06:29.950 --> 00:06:32.080 align:middle line:84%
An additional piece
of functionality

00:06:32.080 --> 00:06:35.630 align:middle line:84%
that you can also perform is
to list out the vulnerability.

00:06:35.630 --> 00:06:36.880 align:middle line:90%
So we type in vulns.

00:06:36.880 --> 00:06:39.670 align:middle line:84%
As you can see, we don't have
any current vulnerabilities,

00:06:39.670 --> 00:06:42.190 align:middle line:84%
but again, we will get to
that when we get there.

00:06:42.190 --> 00:06:43.720 align:middle line:84%
At the moment,
we're still working

00:06:43.720 --> 00:06:46.540 align:middle line:84%
on enumerating as much
information as possible

00:06:46.540 --> 00:06:49.940 align:middle line:84%
from our targets and the
services running on the target.

00:06:49.940 --> 00:06:52.690 align:middle line:84%
So that is how to utilize
the Metasploit framework

00:06:52.690 --> 00:06:56.140 align:middle line:84%
database in regards to
importing Nmap scan results

00:06:56.140 --> 00:06:59.530 align:middle line:84%
and also how to perform an Nmap
scan from within the Metasploit

00:06:59.530 --> 00:07:00.710 align:middle line:90%
framework console.

00:07:00.710 --> 00:07:04.250 align:middle line:84%
So that's going to
be it for this video.

00:07:04.250 --> 00:07:06.580 align:middle line:84%
In the next video,
we'll begin the process

00:07:06.580 --> 00:07:09.880 align:middle line:84%
of performing information
gathering more specifically

00:07:09.880 --> 00:07:12.970 align:middle line:84%
port scanning, through the use
of the Metasploit framework

00:07:12.970 --> 00:07:14.140 align:middle line:90%
auxiliary modules.

00:07:14.140 --> 00:07:16.500 align:middle line:90%
So I'll see you there.

00:07:16.500 --> 00:07:17.000 align:middle line:90%